Improve comment handling between if statement condition and the "body" (#17998)
This commit is contained in:
1 parent
ec2efea041
commit
3a3db39b32
6 files changed
+228
-59
No files matched your search
@@ -0,0 +1,31 @@
|
||||
#### 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();
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user