Fix comments around heritage clauses (#19897)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-08-20 18:53:23 +08:00
1 parent 24a616d0b7
commit e7b8a4f86e
5 files changed
+131 -17

No files matched your search

@@ -0,0 +1,32 @@
#### Fix comment before the first heritage clause (#19897 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
class Foo
extends Bar
implements
// Comment for Ifoo
IFoo,
IBar {
// ...
}
// Prettier stable
class Foo
extends Bar
// Comment for Ifoo
implements IFoo, IBar {
// ...
}
// Prettier main
class Foo
extends Bar
implements
// Comment for Ifoo
IFoo,
IBar {
// ...
}
```
+30
View File
@@ -0,0 +1,30 @@
#### Fix unstable comment before the first heritage clause (#19897 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
class MyClass extends MySuperClass implements /* foo */ ISomething, /* bar */ IOtherThing, /* baz */ IThirdThing {
}
// Prettier stable (First format)
class MyClass
extends MySuperClass
implements
/* foo */ ISomething,
/* bar */ IOtherThing,
/* baz */ IThirdThing {}
// Prettier stable (Second format)
class MyClass
extends MySuperClass
/* foo */
implements ISomething, /* bar */ IOtherThing, /* baz */ IThirdThing {}
// Prettier main
class MyClass
extends MySuperClass
implements
/* foo */ ISomething,
/* bar */ IOtherThing,
/* baz */ IThirdThing {}
```