# no-cycle

Rule `import/no-cycle`. Forbid a module from importing a module with a dependency path back to itself.

- Source: import
- Technologies: Imports
- Kind: suspicious
- Needs type information: no
- Autofix: no
- Reach: 12.4M weekly downloads of presets that enable it
- Trend: +13.0% last quarter
- Rank: #747 by reach, #1440 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/no-cycle` | no | no | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/no-cycle.md) |
| Oxlint | `import/no-cycle` | no | no | plugin `import`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/import/no-cycle.html) |
| Biome | `suspicious/noImportCycles` | no | no | group suspicious, since 2.0.0 | [docs](https://biomejs.dev/linter/rules/no-import-cycles/) |

## Code examples

### Incorrect: the rule reports this

```js
// dep-b.js
import './dep-a.js'
export function b() { /* ... */ }
```

```js
// dep-a.js
import { b } from './dep-b.js' // reported: Dependency cycle detected.
export function a() { /* ... */ }
```

### Correct: the rule accepts this

```js
// dep-b.js
export function b() { /* ... */ }
```

```js
// dep-a.js
import { b } from './dep-b.js' // no circular dependency
export function a() { /* ... */ }
```

Examples from the Oxlint documentation.

## Enable it

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

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

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

### Oxlint: `.oxlintrc.json`

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

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "noImportCycles": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [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% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [import/no-self-import](https://lintradar.dev/rules/import/no-self-import.md): Forbid a module from importing itself.
- [import/newline-after-import](https://lintradar.dev/rules/import/newline-after-import.md): Enforce a newline after import statements.
- [import/no-extraneous-dependencies](https://lintradar.dev/rules/import/no-extraneous-dependencies.md): Forbid the use of extraneous packages.
- [import/no-mutable-exports](https://lintradar.dev/rules/import/no-mutable-exports.md): Forbid the use of mutable exports with `var` or `let`.
- [import/no-absolute-path](https://lintradar.dev/rules/import/no-absolute-path.md): Forbid import of modules using absolute paths.
- [import/no-amd](https://lintradar.dev/rules/import/no-amd.md): Forbid AMD `require` and `define` calls.

---

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