-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: correct decorator traversal for AssignmentPattern #2375
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, @bradzacher! 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. |
2b75c5b
to
60a6051
Compare
60a6051
to
1bdd6b1
Compare
Codecov Report
@@ Coverage Diff @@
## v4 #2375 +/- ##
==========================================
- Coverage 93.00% 92.96% -0.04%
==========================================
Files 286 286
Lines 9060 9038 -22
Branches 2523 2513 -10
==========================================
- Hits 8426 8402 -24
- Misses 304 305 +1
- Partials 330 331 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
BREAKING CHANGE: - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) - Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago.
BREAKING CHANGE: - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) - Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago.
BREAKING CHANGE: - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) - Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago.
BREAKING CHANGE: - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) - Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago.
BREAKING CHANGE: - Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration) - Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago.
Fixes #2369
BREAKING CHANGE:
decorators
property from severalNode
s that could never semantically have them (FunctionDeclaration
,TSEnumDeclaration
, andTSInterfaceDeclaration
)AST_NODE_TYPES.Import
. This is a minor breaking change as the node type that used this was removed ages ago.This was an interesting bug to fix!
We had a bug in our visitor keys here - they didn't declare the
decorators
key forAssignmentPattern
, this meant that when ESLint traversed the tree, it wouldn't traverse assignment pattern's decorators, so it wouldn't add theparent
property.So when
no-unused-vars
attempted to get theparent
of theOptional
Identifier
for the decorator, it wouldn't find one, and hence it would crash.This PR:
AssignmentPattern
decorator
keys for nodes that aren't semantically allowed to have them.AST_NODE_TYPES.Import
AST_NODE_TYPES
members have an associatedTSESTree.Node
type (so we don't forget to delete them ever again)vistor-keys
so that IDEs give autocomplete, and we ensure that both the array of keys is valid, and that the node types all exist inAST_NODE_TYPES
.