You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior
Previously babel parser, using the estree plugin, would read optional chaining as a OptionalMemberExpression, now the optional chain is broken into two nodes a ChainExpression and a MemberExpression.
I stumbled upon this while trying to use react-doc-gen against a component with optional chanining and the ast-types library that it uses fails when it tries to understand the ChainExpression type.
Hey @mjhenkes! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."
The change is intentional: estree does not support experimental features so when optional chaining was a proposal, Babel used own AST. When estree supports optional chaining in a way different to Babel's AST design, we have to implement changes in the estree plugin. In this case, it is considered a new feature because optional chaining's estree AST is never well-defined before.
Bug Report
Current behavior
Previously babel parser, using the estree plugin, would read optional chaining as a
OptionalMemberExpression
, now the optional chain is broken into two nodes aChainExpression
and aMemberExpression
.This change was made in: #11815
I stumbled upon this while trying to use react-doc-gen against a component with optional chanining and the ast-types library that it uses fails when it tries to understand the
ChainExpression
type.Input Code
I have setup a repo to recreate the issue here:
https://github.com/mjhenkes/babel-parser-test
It contains sample AST outputs that can be compared from version 1.11.0 and 1.10.5.
Expected behavior
Is this considered a breaking change? If so i'd expect it to be included in a major version.
Or is it a bug in ast-types that
ChainExpression
isn't supported?Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
babel.config.js
Below is how i'm calling the babel parser.
Environment
Possible Solution
Additional context
Example diff of the AST as well as i could make in MD 🤷♂️
The text was updated successfully, but these errors were encountered: