-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bolt tslint to eslint #529
Conversation
Codecov Report
@@ Coverage Diff @@
## main #529 +/- ##
==========================================
+ Coverage 83.13% 83.24% +0.11%
==========================================
Files 7 7
Lines 593 597 +4
Branches 184 193 +9
==========================================
+ Hits 493 497 +4
+ Misses 68 67 -1
- Partials 32 33 +1
Continue to review full report at Codecov.
|
Summary of new changes (07/08/2020)Added Prettier to the linting process and used the recommended prettier/@typescript-eslint plugin to disable ESLint rules that conflict with Prettier. Also made some pretty major improvements to the ESLint configuration structure to make it more maintainable and readable. Details
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'm fine with moving forward with this
.eslintrc.js
Outdated
of action is likely to adopt these rules and make the quick (and mostly automated) fixes | ||
needed in the repo to conform to these. ESLint and the airbnb-typecript config is more strict | ||
than the original TSLint configuration that this project had. */ | ||
'import/first': ['off'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely might want to conform to some of these airbnb rules.
I did a few updates to this branch.
|
88c033c
to
2d7338b
Compare
…rror messages on CI if prettier fails
9a4d5f2
to
0fbeb71
Compare
Summary
This PR aims to migrate Bolt.js from TSLint to ESLint. I used the
typescript-eslint
plugin to allow ESLint to work with TypeScript. I decided to go with this plugin as it was supported by both the backers behind TSLint (Palantir), who deprecated TSLint in favor of typescript-eslint, and the actual TypeScript team themselves.Details
In the process of migrating Bolt to ESLint, I used the tslint-to-eslint-config project (as recommended by
typescript-eslint
) to automate the initial bulkwork of the process such as converting all the TSLint rule flag comments in all files to ESLint-compatible comments.To match the original TSLint configuration as closely as possible (which extended the tslint-airbnb-config), I extended the
eslint-config-airbnb-typescript
plugin in the .eslintrc.js file. I also included recommended plugins like @typescript-eslint/recommended-requiring-type-checking to match the TSLint behavior. I commented out/disabled some of the recommended ESLint plugins as they introduce new rules that the project currently does not follow, raising linting errors. One challenge with this migration is that ESLint is more strict than TSLint. Since the new rules would require some changes in Bolt's source code (many of which can be fixed automatically), I'd like to discuss potentially including them as they do seem valuable. Alongside these potential additions, I also added some JSDoc rules that are currently commented out.I'd also like to discuss the idea of using Prettier for code formatting (ex. checking indentation) rather than the linter as recommended by the typescript-eslint and tslint-to-eslint-config team. Certain TSLint rules, such as "whitespace", are supposed to be replaced by Prettier when migrating to ESLint (as recommended in the roadmap) since there is no ESLint equivalent. Prettier also does a much better job at checking formatting than ESLint with regards to checking indentation (relevant issue here). The indent rule raises quite a few arbitrary errors which is why I decided to comment it out for this PR.
I also added src/middleware/builtin.ts to the .eslintignore file because it was the only file that was raising linting errors. Its formatting seems very different from the other files in the project and the errors are almost all formatting issues (ex: line length of 122 instead of 120, missing return types on functions, missing line breaks, not using dot notation etc). I think this is worth discussing
Requirements (place an
x
in each[ ]
)