Range formatting a `for…of` declaration adds a `;` that breaks the loop
Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026
Prettier 3.9.9 Playground link
--parser typescript
--range-start 5
--range-end 12Input:
for (const f of filters) {}Output:
for (const f; of filters) {}Expected output:
for (const f of filters) {}Why?
The range covers only const f in the loop head. The declaration is formatted as a statement of its own and gets a ;, so the output doesn't parse.
Related: #16292 (range format redesign), #16721.
Also reproduces on main (88d8e96).
Source: prettier/prettier