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
--parser typescriptInput:
const a = <
// c
div />;Output:
const a = (
<// c
div
/>
);Second format (of the output above) fails:
Expression expected. (2:3)Expected output:
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).
Source: prettier/prettier