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

Update optional chaining representation to match ESTree spec #2204

Closed
3 tasks done
bradzacher opened this issue Jun 11, 2020 · 1 comment · Fixed by #2308 or #2330
Closed
3 tasks done

Update optional chaining representation to match ESTree spec #2204

bradzacher opened this issue Jun 11, 2020 · 1 comment · Fixed by #2308 or #2330
Labels
AST PRs and Issues about the AST structure breaking change This change will require a new major version to be released package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Milestone

Comments

@bradzacher
Copy link
Member

bradzacher commented Jun 11, 2020

ESTree just merged the representation for optional chaining.
estree/estree#204

They chose a different representation to babel's representation, which we went with originally (as it was the only representation in the ecosystem).

We now need to update our parser to match this representation.

interface ChainExpression <: Expression {
  type: "ChainExpression"
  expression: ChainElement
}
interface ChainElement <: Node {
  optional: boolean
}
extend interface CallExpression <: ChainElement {}
extend interface MemberExpression <: ChainElement {}

In terms of timelines, we need to track ESLint here, as they will be moving to implement this as well. With it, they will update their lint rules to support it.


This is ofc a breaking change in the AST structure, and will unfortunately be a relatively painful one for consumers of our plugins.

I don't see this as being too painful, however. There will be some new false-negatives in the ecosystem due to the ChainExpression node, but because everything is now just a Call/MemberExpression, most of the plugins should "just work".


This is required to support ESLint 7.5.0, which added support to rules for optional chaining.
https://eslint.org/blog/2020/07/eslint-v7.5.0-released

@bradzacher bradzacher added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin package: typescript-estree Issues related to @typescript-eslint/typescript-estree breaking change This change will require a new major version to be released AST PRs and Issues about the AST structure labels Jun 11, 2020
@bradzacher bradzacher added this to the 4.0.0 milestone Jun 11, 2020
@bradzacher
Copy link
Member Author

bradzacher commented Jul 18, 2020

ESLint has merged and released the PR adding support for the new AST as v7.5.0

@bradzacher bradzacher pinned this issue Jul 19, 2020
@bradzacher bradzacher linked a pull request Aug 3, 2020 that will close this issue
@bradzacher bradzacher unpinned this issue Aug 21, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AST PRs and Issues about the AST structure breaking change This change will require a new major version to be released package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
1 participant