-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [no-extra-parens] handle ESLint 7.19.0 #2993
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
Conversation
Thanks for the PR, @midgleyc! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! π Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
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.
Thanks for the PR!
We need to maintain compatibility with old versions of eslint as well as new versions - so we need to maintain a (guarded) call to the old selector.
Codecov Report
@@ Coverage Diff @@
## master #2993 +/- ##
==========================================
- Coverage 92.71% 92.63% -0.08%
==========================================
Files 313 313
Lines 10655 10665 +10
Branches 3018 3021 +3
==========================================
+ Hits 9879 9880 +1
- Misses 355 363 +8
- Partials 421 422 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -256,6 +241,56 @@ export default util.createRule<Options, MessageIds>({ | |||
} | |||
}, | |||
}; | |||
if (semver.satisfies(TSESLint.ESLint.version, '>=7.19.0')) { |
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.
Instead of using a semver check here, as these can be pretty hairy to get right.
Just guard appropriately.
if (rules.ForInStatement && rules.ForOfStatement) {
// new version
} else {
// old version
}
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.
Nice, thanks!
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.
thanks for doing this!
When do you plan to release? |
Fixes #2986.
This works on eslint 7.19.0, but breaks on earlier versions (I'd expect). If I left in the previous version of the function (and types) with
'ForInStatement, ForOfStatement'
, it might work on those as well.If I don't do that, I think the version of eslint in
package.json
should be bumped.Which would you prefer?