Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alexkrautmann opened this issue Feb 20, 2021 · 1 comment · Fixed by #273
Closed

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

alexkrautmann opened this issue Feb 20, 2021 · 1 comment · Fixed by #273
Labels
🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on

Comments

@alexkrautmann
Copy link

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

  • OS: MacOS 10.15.7, CodeSandbox
  • Packages:
    • eslint@7.20.0
    • eslint-plugin-mdx@1.8.2
    • eslint-plugin-react@7.22.0
  • Env:
    • node@14.15.5, (10.23.0 in CodeSandbox)
    • yarn@1.22.10

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

@alexkrautmann alexkrautmann added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Feb 20, 2021
@JounQin
Copy link
Member

JounQin commented Feb 20, 2021

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.

JounQin added a commit that referenced this issue Feb 20, 2021
the parsed remark-mdx jsx nodes are not precise, but it will be resolved in v2
JounQin added a commit that referenced this issue Feb 20, 2021
the parsed remark-mdx jsx nodes are not precise, but it will be resolved in v2
@JounQin JounQin added 🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Feb 20, 2021
JounQin added a commit that referenced this issue Feb 20, 2021
…g - close #272 (#273)

* feat: bump (dev)Dependencies, fix related errors

* fix: consider first jsx node as open tag - close #272

the parsed remark-mdx jsx nodes are not precise, but it will be resolved in v2

* chore: lerna config changes

* test: do not use user environment related test cases

* fix: open close tag regex, push remaining nodes

* fix: part of #207, markdown in jsx is still not supported

improve fixtures test case

* test: remove unnecessary fixture

* docs: add comments for // @ts-ignore and never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment