Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bradzacher merged 1 commit intov4from2369-decorator-traversal
Aug 9, 2020

Conversation

@bradzacher
Copy link
Member

Fixes#2369

BREAKING CHANGE:

  • Removeddecorators property from severalNodes that could never semantically have them (FunctionDeclaration,TSEnumDeclaration, andTSInterfaceDeclaration)
  • RemovedAST_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 thedecorators 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 whenno-unused-vars attempted to get theparent of theOptionalIdentifier for the decorator, it wouldn't find one, and hence it would crash.

This PR:

  • adds the missing visitor keys forAssignmentPattern
  • removesdecorator keys for nodes that aren't semantically allowed to have them.
    • I'm not sure why we ever bothered emitting invalid code here because:
      • TS will parse-time allow it, but will semantic error. And then it scrubs the decorator from compiled code, so the decorator is 100% invalid in all these cases.
      • Babel will parse-time error.
  • removesAST_NODE_TYPES.Import
  • adds a funky typecheck-time test to ensure allAST_NODE_TYPES members have an associatedTSESTree.Node type (so we don't forget to delete them ever again)
  • adds strict types tovistor-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.

@bradzacherbradzacher added bugSomething isn't working breaking changeThis change will require a new major version to be released labelsAug 8, 2020
@bradzacherbradzacher added this to the4.0.0 milestoneAug 8, 2020
@typescript-eslint
Copy link
Contributor

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 onhttps://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitorsper day.

@bradzacherbradzacherforce-pushed the2369-decorator-traversal branch 2 times, most recently from2b75c5b to60a6051CompareAugust 9, 2020 00:21
@bradzacherbradzacherforce-pushed the2369-decorator-traversal branch from60a6051 to1bdd6b1CompareAugust 9, 2020 00:29
@codecov
Copy link

codecovbot commentedAug 9, 2020
edited
Loading

Codecov Report

Merging#2375 intov4 willdecrease coverage by0.03%.
The diff coverage is66.66%.

@@            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
FlagCoverage Δ
#unittest92.96% <66.66%> (-0.04%)⬇️

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

Impacted FilesCoverage Δ
...kages/eslint-plugin/src/rules/no-empty-function.ts77.14% <0.00%> (-6.65%)⬇️
...nt-plugin/src/rules/no-unused-vars-experimental.ts91.48% <ø> (ø)
packages/typescript-estree/src/convert.ts98.34% <ø> (-0.02%)⬇️
...pt-estree/src/ts-estree/estree-to-ts-node-types.ts100.00% <ø> (ø)
packages/visitor-keys/src/visitor-keys.ts100.00% <100.00%> (ø)
...ckages/eslint-plugin/src/rules/no-throw-literal.ts96.07% <0.00%> (-0.85%)⬇️

@bradzacherbradzacher merged commit5ab473c intov4Aug 9, 2020
@bradzacherbradzacher deleted the 2369-decorator-traversal branchAugust 9, 2020 00:42
bradzacher added a commit that referenced this pull requestAug 9, 2020
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.
bradzacher added a commit that referenced this pull requestAug 10, 2020
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.
bradzacher added a commit that referenced this pull requestAug 19, 2020
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.
bradzacher added a commit that referenced this pull requestAug 29, 2020
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.
bradzacher added a commit that referenced this pull requestAug 29, 2020
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.
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsSep 9, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

breaking changeThis change will require a new major version to be releasedbugSomething isn't working

Projects

None yet

Milestone

4.0.0

Development

Successfully merging this pull request may close these issues.

[no-unused-vars] Exception hit with default parameter in v.4.0.0-alpha.5

2 participants

@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp