Two comments before an arrow's `=>` print a line break before `=>`, which doesn't parse
Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026
Prettier 3.9.9 Playground link
--parser typescriptInput:
const f = (a) /* b */ /* c */ => a;Output:
const f = (a) /* b */
/* c */ => a;Second Output:
const f = (a /* b */) => /* c */ a;Expected output:
const f = (a) /* b */ /* c */ => a;Why?
A line break before => is a syntax error (TS1200: Line terminator not permitted before arrow). With one comment ((a) /* b */ => a) the output is stable. async (a) /* b */ /* c */ => a does the same.
Related: #11100 (fixed by #17421), the single-comment case.
Also reproduces on main (88d8e96).
Source: prettier/prettier