Parsing error: Subsequent lines with self-closing JSX tags
See original GitHub issueSubject 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Expected corresponding JSX closing tag for input Reactjs
In my case, the hr and input elements weren't closed properly. Parent Error was: JSX element 'div' has no corresponding closing tag, due...
Read more >Troubleshooting MDX
The reason for this error is that only opening tags can be marked as self-closing. Remove the slash after the tag name and...
Read more >React JSX - W3Schools
JSX will throw an error if the HTML is not properly closed. Attribute class = className. The class attribute is a much used...
Read more >Adjacent JSX elements must be wrapped in an enclosing tag
Output: I get an error specifying that Adjacent JSX elements must be wrapped in an enclosing tag . To fix this error <h1>...
Read more >vue/html-closing-bracket-newline
People have their own preference about the location of closing brackets. This rule enforces a line break (or no line break) before tag's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cpboyd Would you like to check whether v1.6.6 works?
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.