#20168·prettier

JSX: a line comment between `<` and the tag name prints `<// c`, which doesn't parse

Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026

Prettier 3.9.9 Playground link

bash
--parser typescript

Input:

typescript
const a = <
  // c
  div />;

Output:

typescript
const a = (
  <// c
  div
  />
);

Second format (of the output above) fails:

Expression expected. (2:3)

Expected output:

typescript
const a = (
  <
    // c
    div
  />
);

Why?

<// doesn't parse as the start of an element. The comment needs a line break after <.

Related: #8030 (the same in a closing tag, fixed).

Also reproduces on main (88d8e96).