Skip to content

Comments in decorators are moved to top when class is exported #1956

@mafredri

Description

@mafredri

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions