Skip to content

Commit

Permalink
[Docs] describe the new options
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Sep 1, 2024
1 parent 529734c commit f1ae2d6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/rules/order.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,23 @@ import index from './';
import sibling from './foo';
```

### `named: true|false`
### `named: true|false|{enabled: true|false, import: true|false, export: true|false, require: true|false, groups: [array]}`

Enforce ordering of names within imports:

- If set to `true`, named imports must be ordered according to the `alphabetize` options
- If set to `false`, named imports can occur in any order

The default value is `false`
`import`, `export` and `require` allows forcing ordering of named `import`s/`export`s for the corresponding kind of expression.
Use `enabled` to force ordering all of the aforementioned groups.

The `groups` option allows to specify the order of the following kind of named `import`/`export` expressions:

- `value`: Importing/exporting ordinary values
- `default`: Exporting the `default` member in an expression like `export { default as Console } from './my-awesome-console.js'`
- `type`: Explicitly importing or exporting types: `import { type Readline } from 'node:readline'`

The default value is `false` and the default `groups`-option is `['default']`.

Example setting:

Expand Down

0 comments on commit f1ae2d6

Please sign in to comment.