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-2
Original file line number
Diff line number
Diff line change
@@ -77,16 +77,29 @@ This rule supports the following options:
77
77
78
78
### `groups: [array]`:
79
79
80
-
How groups are defined, and the order to respect. `groups` must be an array of `string` or [`string`]. The only allowed `string`s are: `"builtin"`, `"external"`, `"internal"`, `"parent"`, `"sibling"`, `"index"`. The enforced order is the same as the order of each element in a group. Omitted types are implicitly grouped together as the last element. Example:
80
+
How groups are defined, and the order to respect. `groups` must be an array of types or [types].
81
+
82
+
The types can be either `"String"`: `"builtin"`, `"external"`, `"internal"`, `"parent"`, `"sibling"`, `"index"`,
We intentionally made `"absolute"` type matching with optional pattern, because a lot of projects use aliases and have complicated absolute path logic.
86
+
The meaning of `"private"` type is to separate project/company level packages and libs from all `"external"`
87
+
88
+
The enforced order is the same as the order of each element in a group. Omitted types are implicitly grouped together as the last element. Example:
81
89
```js
82
90
[
83
91
'builtin', // Built-in types are first
92
+
[{ name:'private', pattern:'^my-awesome-project/libs' }, 'internal'] // The private types and internal (@myproject) are mixed together
93
+
{ name:'absolute', pattern:'^src' }, // Then absolute types
84
94
['sibling', 'parent'], // Then sibling and parent types. They can be mingled together
85
95
'index', // Then the index file
86
96
// Then the rest: internal and external type
87
97
]
88
98
```
89
-
The default value is `["builtin", "external", "parent", "sibling", "index"]`.
99
+
The default value is `["builtin", "external", "absolute", "parent", "sibling", "index"]`.
100
+
By default `"absolute"` type will be applied to any import which path starts with `"/"` if you want to change
101
+
that behavior you can specify absolute type with ```Object``` literal ```{ name: 'absolute'<String>, pattern: //<RegExp> }```.
102
+
Custom pattern behavior can be applied only for `"absolute"` and `"private"` types
0 commit comments