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

Conflict with import/newline-after-import #287

Open
codectl opened this issue May 2, 2024 · 5 comments
Open

Conflict with import/newline-after-import #287

codectl opened this issue May 2, 2024 · 5 comments

Comments

@codectl
Copy link

codectl commented May 2, 2024

I have the following set of rules:

import importPlugin from "eslint-plugin-import"
import prettierPlugin from "eslint-plugin-prettier"

export default [
  {
    plugins: {
      "import": importPlugin,
      "prettier": prettierPlugin,
    },
    rules: {
      "prettier/prettier": "error",
      "import/newline-after-import": ["error", { count: 2 }],
  }
]

Which results in an error:

Expected 2 empty lines after import statement not followed by another import  import/newline-after-import
@JounQin
Copy link
Member

JounQin commented May 3, 2024

What do you mean by conflict? prettier will not add new lines at all.

@vilnytskyi
Copy link

@JounQin Not sure OP came here with the same issue as I have but prettier basically overwrites 2 newlines with 1, so it doesn't respect that rule for some reason.

@JounQin
Copy link
Member

JounQin commented Jun 23, 2024

Sorry, but that's how prettier works that it prints codes on its own style, so two empty lines will be reprinted as one line.

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2024
@JounQin
Copy link
Member

JounQin commented Jul 4, 2024

Or do you mean we should disable import/newline-after-import in this config?

@lydell
Copy link
Member

lydell commented Jul 4, 2024

To me, this issue sounds like a feature request for supporting the eslint-plugin-import plugin (and its fork?). For import/newline-after-import, it looks safe to use with Prettier as long as you set it to 1 empty line (not more), so it would need a validator and “special rule” docs.

@JounQin JounQin reopened this Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants