-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [no-extra-parens] keep parens around call expression arguments when type arguments contain parens #7375
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
…ion arguments when type arguments contain parens
Thanks for the PR, @auvred! 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. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #7375 +/- ##
==========================================
+ Coverage 87.40% 87.41% +0.01%
==========================================
Files 381 381
Lines 13313 13316 +3
Branches 3934 3935 +1
==========================================
+ Hits 11636 11640 +4
- Misses 1292 1298 +6
+ Partials 385 378 -7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
What a great PR description - thanks both for the fix and excellent writeup @auvred!
PR Checklist
Overview
This issue has a long story
After a little investigation I restored the chronology of changes:
This PR introduced fix for this issue fix(eslint-plugin): [no-extra-parens] stop reporting on calling generic functions with one argument and type parameters containing parentheses #2319. Everything worked fine, and there was even a test case for such a situation
https://github.com/typescript-eslint/typescript-eslint/pull/2319/files#diff-fbb45da7466e6a089a93155bac8bc3e3e16758e9ec33d941286852ed7d64f48bR31
In this PR (feat: remove
TSParenthesizedType
#3340) theTSParenthesizedType
was removedhttps://github.com/typescript-eslint/typescript-eslint/pull/3340/files#diff-a916a57c423a9435766d31cbea70b6434185d7f227eaff16df942efaab05b08bR86-R88
The corresponding test case was also changed (I think this is a kind of regression)
https://github.com/typescript-eslint/typescript-eslint/pull/3340/files#diff-fbb45da7466e6a089a93155bac8bc3e3e16758e9ec33d941286852ed7d64f48bR30-R32
There was added check for
TSArrayType
fix(eslint-plugin): [no-extra-parens] handle generic ts array type. #5550. But as far as I understand it was just the edge case, because the same code without an array[]
turns into a broken oneI couldn't find any other way to fix this problem other than checking if there any opening parenthesis between
node.callee
and first argument (node.arguments[0]
). Otherwiseeslint/no-extra-parens
treats it as an opening parenthesis for the arguments listMany thanks to this explanation #2314 (comment)