# no-duplicates

Rule `import/no-duplicates`. Forbid repeated import of the same module in multiple places.

- Source: import
- Technologies: Imports
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 98.1M weekly downloads of presets that enable it
- Trend: +30.5% last quarter
- Rank: #185 by reach, #1122 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/no-duplicates` | yes | safe | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/no-duplicates.md) |
| Oxlint | `import/no-duplicates` | no | safe | plugin `import`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/import/no-duplicates.html) |

## Code examples

### Incorrect: the rule reports this

```js
import SomeDefaultClass from './mod'

// oops, some other import separated these lines
import foo from './some-other-mod'

import * as names from './mod'

// will catch this too, assuming it is the same target module
import { something } from './mod.js'
```

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

import { CValue } from './papa-mia'
import type { CType } from './papa-mia'
```

### Correct: the rule accepts this

```js
import SomeDefaultClass, * as names from './mod'
// Flow `type` import from same module is fine
import type SomeType from './mod'
```

```js
import minifiedMod from './mod?minify'
import noCommentsMod from './mod?comments=0'
import originalMod from './mod'
```

```js
import SomeDefaultClass from './mod?minify'

// This is invalid, assuming `./mod` and `./mod.js` are the same target:
import * from './mod.js?minify'
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import importPlugin from "eslint-plugin-import";

export default [
  {
    plugins: { import: importPlugin },
    rules: {
      "import/no-duplicates": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "import"
  ],
  "rules": {
    "import/no-duplicates": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [import recommended](https://lintradar.dev/presets/import-recommended.md) | ESLint | `eslint-plugin-import` | 8 | 80.3M | +33.7% |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [import/no-named-as-default](https://lintradar.dev/rules/import/no-named-as-default.md): Forbid use of exported name as identifier of default export.
- [import/no-named-as-default-member](https://lintradar.dev/rules/import/no-named-as-default-member.md): Forbid use of exported name as property of default export.
- [import/named](https://lintradar.dev/rules/import/named.md): Ensure named imports correspond to a named export in the remote file.
- [import/no-unresolved](https://lintradar.dev/rules/import/no-unresolved.md): Ensure imports point to a file/module that can be resolved.
- [import/namespace](https://lintradar.dev/rules/import/namespace.md): Ensure imported namespaces contain dereferenced properties as they are dereferenced.
- [import/default](https://lintradar.dev/rules/import/default.md): Ensure a default export is present, given a default import.

---

Web page: https://lintradar.dev/rules/import/no-duplicates. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
