Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Jun 10, 2022
1 parent 457c167 commit 47a6647
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/rules/no-duplicates.md
Expand Up @@ -61,6 +61,27 @@ import SomeDefaultClass from './mod?minify'
import * from './mod.js?minify'
```

### Inline Type imports

TypeScript 4.5 introduced a new [feature](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#type-on-import-names) that allows mixing of named value and type imports. In order to support fixing to an inline type import when duplicate imports are detected, `inlineTypeImport` can be set to true.

Config:

```json
"import/no-duplicates": ["error", {"inlineTypeImport": true}]
```

```js
import { AValue, type AType } from './mama-mia'
import type { BType } from './mama-mia'
```

will fix to

```js
import { AValue, type AType, type BType } from './mama-mia'
```

## When Not To Use It

If the core ESLint version is good enough (i.e. you're _not_ using Flow and you _are_ using [`import/extensions`](./extensions.md)), keep it and don't use this.
Expand Down

0 comments on commit 47a6647

Please sign in to comment.