mdx-js / eslint-mdx

ESLint Parser/Plugin for MDX
https://npmjs.org/eslint-plugin-mdx
MIT License
266 stars 32 forks source link

`Parsing error: unknown jsx node` when newlines are between nested jsx nodes #272

Closed alexkrautmann closed 3 years ago

alexkrautmann commented 3 years ago

Subject of the issue

When newlines exist between 2 nested jsx nodes, linting of the file fails with Parsing error: unknown jsx node.

Your environment

Steps to reproduce

codesandbox

Error

<div>
  <p>test</p> 

  <p>test</p>
</div>

No Error

<div>
  <p>test</p> 
  <p>test</p>
</div>

Expected behaviour

This should pass lint without error

Actual behaviour

Lint fails with error

JounQin commented 3 years ago

Thanks for your reporting, I can imagine that's caused by strict RegExp to match jsx node which does not allow leading space.

I'll try to resolve it when I'm free.