# max-dependencies

Rule `import/max-dependencies`. Enforce the maximum number of dependencies a module can have.

- Source: import
- Technologies: Imports
- Kind: suspicious
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1727 by reach

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
import a from './a'; // 1
const b = require('./b'); // 2
import c from './c'; // 3 - exceeds max!
```

```ts
import a from './a';
import b from './b';
import c from './c';
```

### Correct: the rule accepts this

```js
import a from './a'; // 1
const anotherA = require('./a'); // still 1
import {x, y, z} from './foo'; // 2
```

```ts
import a from './a';
import b from './b';
import type c from './c'; // Doesn't count against max
```

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/max-dependencies": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "import"
  ],
  "rules": {
    "import/max-dependencies": "error"
  }
}
```

## Related rules

- [import/group-exports](https://lintradar.dev/rules/import/group-exports.md): Prefer named exports to be grouped together in a single export declaration
- [import/no-named-export](https://lintradar.dev/rules/import/no-named-export.md): Forbid named exports.
- [import/no-namespace](https://lintradar.dev/rules/import/no-namespace.md): Forbid namespace (a.k.a. "wildcard" `*`) imports.
- [import/no-relative-parent-imports](https://lintradar.dev/rules/import/no-relative-parent-imports.md): Forbid importing modules from parent directories.
- [import/unambiguous](https://lintradar.dev/rules/import/unambiguous.md): Forbid potentially ambiguous parse goal (`script` vs. `module`).
- [import/enforce-node-protocol-usage](https://lintradar.dev/rules/import/enforce-node-protocol-usage.md): Enforce either using, or omitting, the `node:` protocol when importing Node.js builtin modules.

---

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