import/no-cycle Restriction ​
What it does ​
Ensures that there is no resolvable path back to this module via its dependencies.
This includes cycles of depth 1 (imported module imports me) to "∞" (or Infinity), if the maxDepth option is not set.
Why is this bad? ​
Dependency cycles lead to confusing architectures where bugs become hard to find.
It is common to import an undefined
value that is caused by a cyclic dependency.
Example ​
javascript
// dep-b.js
import "./dep-a.js";
export function b() {
/* ... */
}
javascript
// dep-a.js
import { b } from "./dep-b.js"; // reported: Dependency cycle detected.