Skip to content

Commit 017c18e

Browse files
committed
Add according documentation
1 parent c285962 commit 017c18e

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

docs/rules/order.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import bar from './bar';
2222
import baz from './bar/baz';
2323
// 6. "index" of the current directory
2424
import main from './';
25+
// 7. "object"-imports (only available in TypeScript)
26+
import log = console.log;
2527
```
2628

2729
Unassigned imports are ignored, as the order they are imported in may be important.
@@ -77,21 +79,24 @@ This rule supports the following options:
7779

7880
### `groups: [array]`:
7981

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"`, `"unknown"`, `"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:
82+
How groups are defined, and the order to respect. `groups` must be an array of `string` or [`string`]. The only allowed `string`s are:
83+
`"builtin"`, `"external"`, `"internal"`, `"unknown"`, `"parent"`, `"sibling"`, `"index"`, `"object"`.
84+
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:
8185
```js
8286
[
8387
'builtin', // Built-in types are first
8488
['sibling', 'parent'], // Then sibling and parent types. They can be mingled together
8589
'index', // Then the index file
90+
'object',
8691
// Then the rest: internal and external type
8792
]
8893
```
89-
The default value is `["builtin", "external", "parent", "sibling", "index"]`.
94+
The default value is `["builtin", "external", "parent", "sibling", "index", "object"]`.
9095

9196
You can set the options like this:
9297

9398
```js
94-
"import/order": ["error", {"groups": ["index", "sibling", "parent", "internal", "external", "builtin"]}]
99+
"import/order": ["error", {"groups": ["index", "sibling", "parent", "internal", "external", "builtin", "object"]}]
95100
```
96101

97102
### `pathGroups: [array of objects]`:
@@ -100,11 +105,11 @@ To be able to group by paths mostly needed with aliases pathGroups can be define
100105

101106
Properties of the objects
102107

103-
| property | required | type | description |
104-
|----------------|:--------:|--------|---------------|
105-
| pattern | x | string | minimatch pattern for the paths to be in this group (will not be used for builtins or externals) |
106-
| patternOptions | | object | options for minimatch, default: { nocomment: true } |
107-
| group | x | string | one of the allowed groups, the pathGroup will be positioned relative to this group |
108+
| property | required | type | description |
109+
| -------------- | :------: | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
110+
| pattern | x | string | minimatch pattern for the paths to be in this group (will not be used for builtins or externals) |
111+
| patternOptions | | object | options for minimatch, default: { nocomment: true } |
112+
| group | x | string | one of the allowed groups, the pathGroup will be positioned relative to this group |
108113
| position | | string | defines where around the group the pathGroup will be positioned, can be 'after' or 'before', if not provided pathGroup will be positioned like the group |
109114

110115
```json

0 commit comments

Comments
 (0)