Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint comment in import statement is moved to next line (v5) #335

Open
1 task
rothsandro opened this issue Dec 10, 2024 · 0 comments
Open
1 task

ESLint comment in import statement is moved to next line (v5) #335

rothsandro opened this issue Dec 10, 2024 · 0 comments

Comments

@rothsandro
Copy link

Your Environment

  • Prettier version: 3.4.2
  • node version: 20.18.0
  • package manager: npm 10.8.2
  • IDE: VScode

Describe the bug

To Reproduce

Create a file with the following imports and format the file with Prettier and the plugin v5 installed:

import {
  someValue1, // eslint-disable-line no-restricted-imports -- some comment
  someValue2, 
} from "some-package";

Expected behavior

The import someValue1 and the comment should be on the same line. But starting with v5.0.0 the comment is moved to it's own line, breaking the ESLint comment. It worked fine in v4.3.

Screenshots, code sample, etc

Result:

import {
  someValue1,
  // eslint-disable-line no-restricted-imports -- some comment
  someValue2,
} from "some-package";

Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)

Reproducible with minimal configuration:

{
  "plugins": ["@trivago/prettier-plugin-sort-imports"]
}

Our actual configuration:

{
  "endOfLine": "crlf",
  "importOrder": ["<THIRD_PARTY_MODULES>", "^@/(.*)$", "^[./]"],
  "importOrderSortSpecifiers": true,
  "plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-sort-json"],
  "printWidth": 100,
  "useTabs": false
}

Error log

Contribute to @trivago/prettier-plugin-sort-imports

  • I'm willing to fix this bug 🥇
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant