Node type of JSXText is different from espree
golopot opened this issue · comments
For jsx texts like foo in <>foo</>
, espress has type JSXText
, while babel-eslint has type Literal
.
require("espree").parse("<>foo</>", { ecmaFeatures: { jsx: true } })
.body[0].expression.children[0].type; // JSXText
require("babel-eslint").parse("<>foo</>")
.body[0].expression.children[0].type; // Literal
Is this working as intended?
Can you share what version of babel-eslint you're using?
@kaicataldo It was 10.0.1
Can you confirm this is still an issue with the latest release?
Yes the issue still holds in 11.0.0-beta.0 .
require('babel-eslint').parse('<div>foo</div>', {babelOptions: {configFile: "./.babelrc"}} ).body[0].expression.children[0].type
With .babel
{"plugins": ["@babel/plugin-syntax-jsx"]}
.
@kaicataldo I think the bug is caused by
babel-eslint/lib/babylon-to-espree/convertAST.js
Lines 50 to 52 in 5102c31