JSX AST no longer uses Literal nodes inside of JSXElement children
See original GitHub issueThere was an issues that came in to typescript-eslint-parser
which suggested we were using the wrong node type for JSX text. (https://github.com/eslint/typescript-eslint-parser/issues/266) This lead to some discussion and eventually Facebook updated the JSX AST spec to use the JSXText
node type instead of the Literal
node type inside of JSXElement
children.
This is a breaking change that will cause eslint rules in eslint-plugin-react
and eslint-plugin-jsx-a11y
to not work if/when the change is made to espree. It does allow the produced AST to be more consistent with babel and flow-parser.
Is this something that we should change in ESLint v4? I think it might effect the JSX indent modification we have planned for this release. I have submitted a PR to acorn-jsx just in case we choose to make the change in espree.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top GitHub Comments
It might be possible to support both node types fairly easily. I will look into it and create issues in those plugin’s repositories.
It is very short notice and does not provide any enhancement other than conforming to spec. Waiting for v5 makes sense. We can make the change in
typescript-eslint-parser
and hide it behind a flag.