diff --git a/tests/files/cycles/ignore/.eslintrc b/tests/files/cycles/ignore/.eslintrc new file mode 100644 index 0000000000..896eda6a31 --- /dev/null +++ b/tests/files/cycles/ignore/.eslintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "import/no-cycle": 0 + } +} diff --git a/tests/files/cycles/ignore/index.js b/tests/files/cycles/ignore/index.js new file mode 100644 index 0000000000..211fd972f6 --- /dev/null +++ b/tests/files/cycles/ignore/index.js @@ -0,0 +1,2 @@ +import { foo } from "../depth-zero"; +export { foo }; diff --git a/tests/files/cycles/intermediate-ignore.js b/tests/files/cycles/intermediate-ignore.js new file mode 100644 index 0000000000..1ba6fba79b --- /dev/null +++ b/tests/files/cycles/intermediate-ignore.js @@ -0,0 +1,2 @@ +import foo from "./ignore"; +export { foo }; diff --git a/tests/src/rules/no-cycle.js b/tests/src/rules/no-cycle.js index 233cae613b..de0083f563 100644 --- a/tests/src/rules/no-cycle.js +++ b/tests/src/rules/no-cycle.js @@ -267,5 +267,23 @@ ruleTester.run('no-cycle', rule, { parser: parsers.BABEL_OLD, errors: [error(`Dependency cycle via ./flow-types-depth-two:4=>./es6/depth-one:1`)], }), + test({ + code: 'import { foo } from "./intermediate-ignore"', + errors: [ + { + message: 'Dependency cycle via ./ignore:1', + line: 1, + }, + ], + }), + test({ + code: 'import { foo } from "./ignore"', + errors: [ + { + message: 'Dependency cycle detected.', + line: 1, + }, + ], + }), ), });