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

mdx: SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. #6331

Closed
JounQin opened this issue Jul 27, 2019 · 0 comments · Fixed by #6332
Closed

mdx: SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. #6331

JounQin opened this issue Jul 27, 2019 · 0 comments · Fixed by #6332

Comments

@JounQin
Copy link
Contributor

@JounQin JounQin commented Jul 27, 2019

Prettier 1.18.2
Playground link

# Options (if any):
--parser mdx

Input:

import fs from 'fs'
import { PreCode } from '../components'

<section>
  <PreCode code={fs.readFileSync(__dirname + '/legacy2.ts')} language="typescript"></PreCode>
</section>
<section>
  <div className="fragment fade-out" style={{ color: 'red' }}>
    Why? Any difference????
  </div>
</section>

Output:

SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (4:1)
  2 |   <PreCode code={fs.readFileSync(__dirname + '/legacy2.ts')} language="typescript"></PreCode>
  3 | </section>
> 4 | <section>
    | ^
  5 |   <div className="fragment fade-out" style={{ color: 'red' }}>
  6 |     Why? Any difference????
  7 |   </div>

Expected behavior:
No Error

@lipis lipis closed this in #6332 Jul 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant
You can’t perform that action at this time.