There are three .ts files, a.ts and b.ts are circular imported each other, while c.ts imports both a.ts and b.ts.
When checking c.ts, I expect that ESLint reports the circular depencency.
But for some reason, running yarn eslint src/c.ts does NOT raise any error !!!
a.ts:
import y from "./b";
const x: number = y + 1;
export default x;
b.ts:
import x from "./a";
const y: number = x + 1;
export default y;
c.ts:
import x from "./a";
import y from "./b";
console.log(x, y);
and the .eslintrc.json:
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"plugins": ["@typescript-eslint", "import"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"settings": {
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
}
},
"rules": {
"import/no-cycle": [
"error",
{
"maxDepth": 10,
"ignoreExternal": true
}
]
}
}
The github repo: https://github.com/Yaojian/no-cycle-test

