32 lines
416 B
Markdown
32 lines
416 B
Markdown
#### Improve comment handing inside if statement (#17998 by @fisker)
|
|
|
|
<!-- prettier-ignore -->
|
|
```jsx
|
|
// Input
|
|
if (foo) // comment
|
|
{
|
|
doThing();
|
|
} else // comment for else
|
|
{
|
|
doSomethingElse();
|
|
}
|
|
|
|
// Prettier stable
|
|
if (foo) {
|
|
// comment
|
|
doThing();
|
|
} // comment for else
|
|
else {
|
|
doSomethingElse();
|
|
}
|
|
|
|
// Prettier main
|
|
if (foo) // comment
|
|
{
|
|
doThing();
|
|
} else // comment for else
|
|
{
|
|
doSomethingElse();
|
|
}
|
|
```
|