Skip to content

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

Closed

Description

@JounQin

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

Activity

  1. added
    locked-due-to-inactivity
    on Oct 27, 2019
  2. locked as resolved and limited conversation to collaborators on Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions