opensource-management-portal icon indicating copy to clipboard operation
opensource-management-portal copied to clipboard

Configure `eslint` for great TypeScript linting

Open jeffwilcox opened this issue 5 years ago • 4 comments

Configure with --fix to improve the formatting experience.

jeffwilcox avatar Jul 08 '20 00:07 jeffwilcox

Hi there, did you already started anything in this direction. If not I would be happy to set it up and cleaning up a bit of the existing code base using the eslint rules. If I do that, I would have a few points, where I would please like your input on how to best set it up:

  • What would be our target configuration? I would go for eslint:recommended and plugin:@typescript-eslint/recommended, which are the recommended rules by the typescript-eslint project.
  • A first run shows that there are quite a few errors (2k+) and so I would start with an empty rule set and add one rule after another and fixing the issues along the way. I saw that only a handful of them would be auto fixable (like 400)
    ✖ 2694 problems (672 errors, 2022 warnings)
    421 errors and 0 warnings potentially fixable with the `--fix` option.
    
  • With having a linter setup, it probably makes sense to setup a CI-check. Would adding it as a GitHub Action would be a good fit?

Shegox avatar Mar 24 '21 09:03 Shegox

Hey @Shegox 👋

I do want to get to a good place to do this, but at least on my side, I'm trying to do some heroic refactoring of our Microsoft-side of this app... and so there's still some churn in the hopper.

My goal is to be able to move to entirely using this open project to help everyone, and I think we're really close.

I'm personally looking to get some unit tests in place, finally, moving to use jest over mocha, etc.; and so my personal prioritization as I have time here is:

  1. refactor cleanup to be able to use this open project exclusively
  2. some early unit testing
  3. code cleanup in time

Now, I do think some targeted improvements to specific files could make sense, but until I get some more changes in, I worry we'll be in for some tough merge conflicts.

I'll also update the title, since you're right, typescript-eslint is no longer recommended over just core eslint and the right plug-ins.

jeffwilcox avatar Mar 24 '21 16:03 jeffwilcox

Sounds like a good plan, probably makes not much sense to invest to much into linting fixes when you anyway plan major refactors.

We now moved to build and use the opensource version directly from here and just injecting our configuration and that works great for us.

So if you have any specific topics/tasks in mind, where we/I can as well help out with, feel free to point them out and I'm happy to take a shot at them and see if we can help out there.

Thanks a lot already for the awesome project!

Shegox avatar Mar 24 '21 16:03 Shegox

I opened up https://github.com/microsoft/opensource-portal/pull/199 just as a "line in the sand" without impacting the refactoring

nschonni avatar Mar 25 '21 18:03 nschonni

This issue has been identified as stale because it has gone 30 days with no activity. The issue will be closed in 10 days. If this is incorrect, simply comment on the issue, or remove the stale label.

github-actions[bot] avatar Oct 11 '22 17:10 github-actions[bot]

Major kudos to @nschonni on landing all this work!

jeffwilcox avatar Oct 11 '22 17:10 jeffwilcox