WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

comment over class causing extra empty lines after imports #215

@luber

Description

@luber

Your Environment

  • Prettier version: 3.3.3
  • node version: 22.15.1
  • package manager: npm@11
  • IDE: Webstorm

Describe the bug

When I add comment above interface name - extra new lines appear after imports

To Reproduce

  1. Create a .ts file with next content:
import { HttpEvent } from '@angular/common/http';

export interface TestModel {
  readonly event: HttpEvent<any> | null;
}
  1. Add comment describing TestModel interface
// test comment
export interface TestModel {
  1. Save file to trigger prettier auto formatting

Expected behavior

The content does not change after adding line with comment:

Image

Actual behavior

Extra lines generated after import:

Image

Screenshots, code sample, etc

My .prettierrc:

{
  "singleQuote": true,
  "semi": true,
  "plugins": [
    "@ianvs/prettier-plugin-sort-imports",
    "prettier-plugin-sort-members"
  ],
  "keepGettersAndSettersTogether": true,
  "importOrder": [
    "<THIRD_PARTY_MODULES>",
    "",
    "^primeng/(.*)$",
    "",
    "^@my-app/(.*)$",
    "",
    "^[./]"
  ],
  "importOrderParserPlugins": [
    "typescript",
    "decorators-legacy"
  ]
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions