Stumbled across this while formatting an Angular codebase.
Input:
@NgModule({
// Imports.
imports: [
// Angular modules.
BrowserModule,
// App modules.
CoreModule,
SharedModule,
],
})
export class AppModule {}
Output:
// Imports.
// Angular modules.
// App modules.
@NgModule({
imports: [BrowserModule, CoreModule, SharedModule],
})
export class AppModule {}
Expected:
No difference between input and output.
The problem goes away when export
is removed from export class AppModule {}
.
A reproduction of this issue can be found here.
Turns out this isn't TypeScript specific. Happens with Babylon, too.
Perhaps related, adding // prettier-ignore
above the decorator removes it entirely, comments and class are preserved though. Again, removing export
fixes the issue.
I just published 1.4.3 which fixes it. Thanks for reporting it!
Most helpful comment
I just published 1.4.3 which fixes it. Thanks for reporting it!