-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
refactor(eslint-plugin): avoid looking for nodes that do not match the provided options #3922
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
refactor(eslint-plugin): avoid looking for nodes that do not match the provided options #3922
Conversation
Thanks for the PR, @rafaelss95! 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. |
context, | ||
[ | ||
{ | ||
arrayDestructuring, |
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.
I went with destructuring options to avoid options[Option.xyz]
everywhere, but I can revert this part if desired.
206ae6e
to
87d54b7
Compare
87d54b7
to
b84b05f
Compare
Codecov Report
@@ Coverage Diff @@
## master #3922 +/- ##
==========================================
+ Coverage 93.12% 93.37% +0.24%
==========================================
Files 277 153 -124
Lines 9781 8132 -1649
Branches 2851 2576 -275
==========================================
- Hits 9109 7593 -1516
+ Misses 244 182 -62
+ Partials 428 357 -71
Flags with carried forward coverage won't be shown. Click here to find out more.
|
2544848
to
72ad35b
Compare
2d047c1
to
48b3de8
Compare
250dd28
to
d7c2e70
Compare
499e847
to
612f02d
Compare
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.
I love it 🚀 !
Wondering if it would be doable to make a lint rule for ESLint rules that enforces this kind of check...
it's probably too complicated to statically analyse for. |
!node.value || | ||
!isVariableDeclarationIgnoreFunction(node.value) || | ||
!node.typeAnnotation |
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.
this change in logic is incorrect - #4033
There was no "valid" test case covering memberVariableDeclaration: true
- hence this slipped through
old logic
if (
!(node.value && isVariableDeclarationIgnoreFunction(node.value)) &&
!node.typeAnnotation
) {
report();
}
new logic
if (
!node.value ||
!isVariableDeclarationIgnoreFunction(node.value) ||
!node.typeAnnotation
) {
report();
}
Context: #3899 (comment)