You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/order.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ This rule supports the following options (none of which are required):
106
106
-[`alphabetize`][30]
107
107
-[`named`][33]
108
108
-[`warnOnUnassignedImports`][5]
109
-
-[`sortTypesAmongThemselves`][7]
109
+
-[`sortTypesGroup`][7]
110
110
-[`newlines-between-types`][27]
111
111
-[`consolidateIslands`][25]
112
112
@@ -159,7 +159,7 @@ Roughly speaking, the grouping algorithm is as follows:
159
159
160
160
1. If the import has no corresponding identifiers (e.g. `import './my/thing.js'`), is otherwise "unassigned," or is an unsupported use of `require()`, and [`warnOnUnassignedImports`][5] is disabled, it will be ignored entirely since the order of these imports may be important for their [side-effects][31]
161
161
2. If the import is part of an arcane TypeScript declaration (e.g. `import log = console.log`), it will be considered **object**. However, note that external module references (e.g. `import x = require('z')`) are treated as normal `require()`s and import-exports (e.g. `export import w = y;`) are ignored entirely
162
-
3. If the import is [type-only][6], `"type"` is in `groups`, and [`sortTypesAmongThemselves`][7] is disabled, it will be considered **type** (with additional implications if using [`pathGroups`][8] and `"type"` is in [`pathGroupsExcludedImportTypes`][9])
162
+
3. If the import is [type-only][6], `"type"` is in `groups`, and [`sortTypesGroup`][7] is disabled, it will be considered **type** (with additional implications if using [`pathGroups`][8] and `"type"` is in [`pathGroupsExcludedImportTypes`][9])
163
163
4. If the import's specifier matches [`import/internal-regex`][28], it will be considered **internal**
164
164
5. If the import's specifier is an absolute path, it will be considered **unknown**
165
165
6. If the import's specifier has the name of a Node.js core module (using [is-core-module][10]), it will be considered **builtin**
@@ -174,7 +174,7 @@ Roughly speaking, the grouping algorithm is as follows:
174
174
15. If the import's specifier has a name that starts with a word character, it will be considered **external**
175
175
16. If this point is reached, the import will be ignored entirely
176
176
177
-
At the end of the process, if they co-exist in the same file, all top-level `require()` statements that haven't been ignored are shifted (with respect to their order) below any ES6 `import` or similar declarations. Finally, any type-only declarations are potentially reorganized according to [`sortTypesAmongThemselves`][7].
177
+
At the end of the process, if they co-exist in the same file, all top-level `require()` statements that haven't been ignored are shifted (with respect to their order) below any ES6 `import` or similar declarations. Finally, any type-only declarations are potentially reorganized according to [`sortTypesGroup`][7].
178
178
179
179
### `pathGroups`
180
180
@@ -545,7 +545,7 @@ import path from 'path';
545
545
import'./styles.css';
546
546
```
547
547
548
-
### `sortTypesAmongThemselves`
548
+
### `sortTypesGroup`
549
549
550
550
Valid values: `boolean`\
551
551
Default: `false`
@@ -589,14 +589,14 @@ import e from "./";
589
589
590
590
This happens because [type-only imports][6] are considered part of one global
591
591
[`"type"` group](#how-imports-are-grouped) by default. However, if we set
@@ -610,9 +610,9 @@ Default: the value of [`newlines-between`][20]
610
610
611
611
> \[!NOTE]
612
612
>
613
-
> This setting is only meaningful when [`sortTypesAmongThemselves`][7] is enabled.
613
+
> This setting is only meaningful when [`sortTypesGroup`][7] is enabled.
614
614
615
-
`newlines-between-types` is functionally identical to [`newlines-between`][20] except it only enforces or forbids new lines between _[type-only][6] import groups_, which exist only when [`sortTypesAmongThemselves`][7] is enabled.
615
+
`newlines-between-types` is functionally identical to [`newlines-between`][20] except it only enforces or forbids new lines between _[type-only][6] import groups_, which exist only when [`sortTypesGroup`][7] is enabled.
616
616
617
617
In addition, when determining if a new line is enforceable or forbidden between the type-only imports and the normal imports, `newlines-between-types` takes precedence over [`newlines-between`][20].
@@ -750,7 +750,7 @@ When set to `"inside-groups"`, this ensures imports spanning multiple lines are
750
750
> -`consolidateIslands` is set to `"inside-groups"`
751
751
> -[`newlines-between`][20] is set to `"always-and-inside-groups"`
752
752
> -[`newlines-between-types`][27] is set to `"never"`
753
-
> -[`sortTypesAmongThemselves`][7] is set to `true`
753
+
> -[`sortTypesGroup`][7] is set to `true`
754
754
>
755
755
> Then [`newlines-between-types`][27] will yield to `consolidateIslands` and allow new lines to separate multi-line imports and a single new line to separate all [type-only imports][6] from all normal imports. Other than that, [`newlines-between-types: "never"`][27] functions as described.
756
756
>
@@ -847,7 +847,7 @@ The same holds true for the next example; when given the following settings:
847
847
"newlines-between":"always-and-inside-groups",
848
848
"newlines-between-types":"never",
849
849
"pathGroupsExcludedImportTypes": [],
850
-
"sortTypesAmongThemselves":true,
850
+
"sortTypesGroup":true,
851
851
"consolidateIslands":"inside-groups"
852
852
}]
853
853
}
@@ -1006,7 +1006,7 @@ import type { H } from './bbb';
0 commit comments