* Print as dangling comments * Add tests * Add changelog * Use symbol instead of string
538 B
538 B
Preserve end-of-line comment for if statements without blocks (#12017 by @sosukesuzuki)
// Input
if (condition1) expression1; // comment A
else if (condition2) expression2; // comment B
else expression3; // comment C
// Prettier stable
if (condition1) expression1;
// comment A
else if (condition2) expression2;
// comment B
else expression3; // comment C
// Prettier main
if (condition1) expression1; // comment A
else if (condition2) expression2; // comment B
else expression3; // comment C