22 lines
538 B
Markdown
22 lines
538 B
Markdown
#### Preserve end-of-line comment for if statements without blocks (#12017 by @sosukesuzuki)
|
|||
|
|
|
||
|
|
<!-- prettier-ignore -->
|
||
|
|
```jsx
|
||
|
|
// 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
|
||
|
|
|
||
|
|
```
|