Preserve blank line before comments above else (#18813)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-01-31 00:21:33 +08:00
1 parent 8394315a36
commit dba734dc12
7 files changed
+304 -25

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
#### Fix comments above `else` (#18813 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
/* Case 1 */
if (1) {
}
/* Case 2 */
else if (2) {
}
// Prettier stable
/* Case 1 */
if (1) {
} else if (2) {
/* Case 2 */
}
// Prettier main
/* Case 1 */
if (1) {
}
/* Case 2 */
else if (2) {
}
```