Skip to content
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

fix(eslint-plugin): [no-extra-parens] handle ESLint 7.19.0 #2993

Merged
merged 4 commits into from Feb 6, 2021

Conversation

midgleyc
Copy link
Contributor

@midgleyc midgleyc commented Feb 2, 2021

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?

@typescript-eslint
Copy link
Contributor

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.

Copy link
Member

@bradzacher bradzacher left a 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.

@bradzacher bradzacher added the bug Something isn't working label Feb 2, 2021
@codecov
Copy link

codecov bot commented Feb 2, 2021

Codecov Report

Merging #2993 (982bb74) into master (58476a9) will decrease coverage by 0.07%.
The diff coverage is 30.76%.

@@            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     
Flag Coverage Δ
unittest 92.63% <30.76%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ackages/eslint-plugin/src/rules/no-extra-parens.ts 84.72% <30.76%> (-12.06%) ⬇️

@@ -256,6 +241,56 @@ export default util.createRule<Options, MessageIds>({
}
},
};
if (semver.satisfies(TSESLint.ESLint.version, '>=7.19.0')) {
Copy link
Member

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
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@armano2 armano2 added the package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin label Feb 6, 2021
Copy link
Member

@bradzacher bradzacher left a 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!

@bradzacher bradzacher changed the title fix(eslint-plugin): split for rules in no-extra-parens fix(eslint-plugin): [no-extra-parens] handle ESLint 7.19.0 Feb 6, 2021
@bradzacher bradzacher merged commit 4615048 into typescript-eslint:master Feb 6, 2021
@orgads
Copy link

orgads commented Feb 8, 2021

When do you plan to release?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception when upgrading to eslint 7.19.0
4 participants