-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
ESLint sort-imports
has a option allowSeparatedGroups
that checks the sorting of import declaration statements only for those that appear on consecutive lines. But import/order
doesn't have. Although you can achieve it by using groups
and newlines-between
options, I don't want to set the groups at eslint config, but respect the existed separated groups in the file.
For example:
Config rule:
{
"import/order": ["warn", {
"alphabetize": { "order": "asc", "orderImportKind": "asc", "caseInsensitive": false },
"named": true,
}],
}
Original code:
import c from "c";
import b from "b";
import a from "a";
Current fix behavior:
import a from "a";
import b from "b";
import c from "c";
Expected fix behavior:
import c from "c";
import a from "a";
import b from "b";
Original code:
// Group 1
import c from "c";
// Group 2
import e from "e";
import d from "d";
// Group 3
import b from "b";
import a from "a";
Current fix behavior:
// Group 1
import a from "a";
import b from "b";
import c from "c";
// Group 2
import d from "d";
import e from "e";
// Group 3
Expected fix behavior:
// Group 1
import c from "c";
// Group 2
import d from "d";
import e from "e";
// Group 3
import a from "a";
import b from "b";
I wish there will be a new option like allowSeparatedGroups
in import/order
rule to achieve this behavior.
Metadata
Metadata
Assignees
Labels
No labels