acornjs/acorn-jsx

`parseExpressionAt` throws `SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag` even though the element is wrapped in an enclosing tag

Momijiichigo opened this issue · 0 comments

Target code:

(<div>
    <Header />
</div>)

The code below throws SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag even though the Header element is wrapped in an enclosing tag:

const MyParser = Parser.extend(
  jsx()
)
console.log(
  MyParser.parseExpressionAt(code, code.indexOf('<Header'), { ecmaVersion: 'latest', sourceType: "module" })
)