Prettier v3.9.4
Playground link
Input:
if (a) /*c*/{}
while (a) /*c*/{}
switch (a) /*c*/{}
Output:
if (a) /*c*/ {
}
while (a) /*c*/ {}
switch (a /*c*/) {
}
Expected output:
if (a) /*c*/ {
}
while (a) /*c*/ {}
switch (a) /*c*/ {
}
Why?
It's not easy to fix, since there is no node for the "body" in SwitchStatement to attach leading comments.
Prettier v3.9.4
Playground link
Input:
Output:
Expected output:
Why?
It's not easy to fix, since there is no node for the "body" in
SwitchStatementto attach leading comments.