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: Subsequent lines with self-closing JSX tags #138

Closed
cpboyd opened this issue Jan 24, 2020 · 7 comments
Closed

Parsing error: Subsequent lines with self-closing JSX tags #138

cpboyd opened this issue Jan 24, 2020 · 7 comments
Labels
💪 phase/solved Post is done

Comments

@cpboyd
Copy link

cpboyd commented Jan 24, 2020

Subject of the issue

Two lines with self-closing JSX tags seem to have issues:

error  Parsing error: unknown jsx node: "<Hero />\n<Featured />"

Your environment

  • OS: macOS 10.15.2
  • Packages:
    "@typescript-eslint/eslint-plugin": "^2.17.0",
    "@typescript-eslint/parser": "^2.17.0",
    "eslint": "^6.8.0",
    "eslint-config-prettier": "^6.9.0",
    "eslint-config-react-app": "^5.1.0",
    "eslint-plugin-flowtype": "^4.6.0",
    "eslint-plugin-graphql": "^3.1.1",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-mdx": "^1.6.5",
    "eslint-plugin-prettier": "^3.1.2",
    "eslint-plugin-react": "^7.18.0",
    "eslint-plugin-react-hooks": "^2.3.0",
  • Env: yarn 1.21.1

Steps to reproduce

import Hero from '../components/hero';
import Featured from '../components/favorites';

<Hero />
<Featured />

Expected behaviour

The parser should be able to handle two separate self-closing JSX tags on subsequent lines.

Actual behaviour

The parser throws an error.

@cpboyd cpboyd added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Jan 24, 2020
@JounQin
Copy link
Member

JounQin commented Jan 25, 2020

Please provide a minimal runnable reproduction.

@cpboyd
Copy link
Author

cpboyd commented Jan 26, 2020

@JounQin Here you go: https://github.com/cpboyd/bug-mdx

yarn
yarn lint

And you should see the same error.

@JounQin JounQin added 🙆 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 Jan 26, 2020
@JounQin
Copy link
Member

JounQin commented Jan 26, 2020

This error is thrown from https://github.com/mdx-js/eslint-mdx/blob/master/packages/eslint-mdx/src/traverse.ts#L57
and adjacent self-closing jsx nodes are not parsed separately, it can be handlered by wrapping with <$></$>, I'll try to fix it ASAP.

@JounQin
Copy link
Member

JounQin commented Jan 26, 2020

@mdx-js/maintainers Should that be parsed as separated nodes via remark-mdx?

@JounQin
Copy link
Member

JounQin commented Jan 26, 2020

@mdx-js/releasers Would you like to publish a patch version by yarn publish?
And is NPM_AUTH_TOKEN available in the GitHub Actions?

@JounQin JounQin reopened this Jan 26, 2020
@JounQin JounQin closed this as completed Jan 26, 2020
@JounQin
Copy link
Member

JounQin commented Jan 26, 2020

@cpboyd Would you like to check whether v1.6.6 works?

@cpboyd
Copy link
Author

cpboyd commented Jan 27, 2020

@JounQin it works, thanks!

@wooorm wooorm added ⛵️ status/released and removed 🙆 yes/confirmed This is confirmed and ready to be worked on labels Mar 30, 2020
@wooorm wooorm added the 💪 phase/solved Post is done label Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

No branches or pull requests

3 participants