Skip to content

[import/order] newlines-between option breaks when alphabetize is enabled #1593

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

Closed
mixvar opened this issue Jan 4, 2020 · 1 comment
Closed

Comments

@mixvar
Copy link

mixvar commented Jan 4, 2020

When I enable newlines-between: always together with alphabetize the linter acts as if every import was its separate group - newline between every single import is forced.

config:

    "import/order": [
      "error",
      {
        "newlines-between": "always",
        "alphabetize": { "order": "asc" },
        "groups": [
          "builtin",
          "external",
          "internal",
          "parent",
          "sibling",
          "index"
        ]
      }
    ]

expected:

import external1 from 'A'
import external2 from 'B'

import sibling1 from './a'
import sibling2 from './b'

actual:

import external1 from 'A'

import external2 from 'B'

import sibling1 from './a'

import sibling2 from './b'

context:

    "eslint": "6.8.0",
    "@typescript-eslint/eslint-plugin": "2.14.0",
    "@typescript-eslint/parser": "2.14.0",
    "eslint-plugin-import": "2.19.1",
@ljharb
Copy link
Member

ljharb commented Jan 4, 2020

This is fixed in #1562 but not yet released. Duplicate of #1561.

@ljharb ljharb closed this as completed Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants