`semi: false`: a key unquoted by `quoteProps` loses its ASI protection
Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026
Prettier 3.9.9
Example 1
--parser typescript
--no-semiInput:
class C {
x = a
"in"() {}
}Output:
class C {
x = a
in() {}
}Second format (of the output above) fails:
Expression expected. (3:6)Example 2
--parser typescript
--no-semiInput:
interface I {
"get"
a: string
}Output:
interface I {
get
a: string
}Second format (of the output above) fails:
'(' expected. (3:4)Expected output
class C {
x = a;
in() {}
}
interface I {
get;
a: string
}Why?
Written unquoted in the input (x = a; + in() {}, get; + a: string), Prettier keeps the ;. The quoted key is unquoted after that check, so the output reads as x = a in ()… and as a get a accessor, and neither parses.
Related: #1875 (the same for keys written unquoted, fixed), #19618.
Also reproduces on main (88d8e96).
Source: prettier/prettier