#20171·prettier

`/* prettier-ignore */` in a `for` initializer adds a second `;` (regression in 3.8)

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

Prettier 3.9.9 Playground link

bash
--parser typescript

Input:

typescript
for (/* prettier-ignore */ let i  = 0; i < 1; i++) {}

Output:

typescript
for (/* prettier-ignore */ let i  = 0;; i < 1; i++) {}

Second format (of the output above) fails:

')' expected. (1:46)

Expected output:

typescript
for (/* prettier-ignore */ let i  = 0; i < 1; i++) {}

Why?

The output doesn't parse. Prettier 3.7.4 prints the input unchanged. The ignored VariableDeclaration always prints its ;, even in a for head (probably since #18734).

Also reproduces on main (88d8e96).