Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] no-cycle: add passing test cases #2438

Merged
merged 1 commit into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
- [`dynamic-import-chunkname`]: prevent false report on a valid webpack magic comment ([#2330], thanks [@mhmadhamster])

### Changed
- [Tests] `named`: Run all TypeScript test ([#2427], thanks [@ProdigySim])
- [Tests] [`named`]: Run all TypeScript test ([#2427], thanks [@ProdigySim])
- [readme] note use of typescript in readme `import/extensions` section ([#2440], thanks [@OutdatedVersion])
- [Docs] `order`: use correct default value ([#2392], thanks [@hyperupcall])
- [Docs] [`order`]: use correct default value ([#2392], thanks [@hyperupcall])
- [meta] replace git.io link in comments with the original URL ([#2444], thanks [@liby])
- [Docs] remove global install in readme ([#2412], thanks [@aladdin-add])
- [readme] clarify `eslint-import-resolver-typescript` usage ([#2503], thanks [@JounQin])
- [Refactor] `no-cycle`: Add per-run caching of traversed paths ([#2419], thanks [@nokel81])
- [Refactor] [`no-cycle`]: Add per-run caching of traversed paths ([#2419], thanks [@nokel81])
- [Performance] `ExportMap`: add caching after parsing for an ambiguous module ([#2531], thanks [@stenin-nikita])
- [Docs] `no-useless-path-segments`: fix paths ([#2424] thanks [@s-h-a-d-o-w])
- [Docs] [`no-useless-path-segments`]: fix paths ([#2424], thanks [@s-h-a-d-o-w])
- [Tests] [`no-cycle`]: add passing test cases ([#2438], thanks [@georeith])

## [2.26.0] - 2022-04-05

Expand Down Expand Up @@ -1011,6 +1012,7 @@ for info on changes for earlier releases.
[#2490]: https://github.com/import-js/eslint-plugin-import/pull/2490
[#2466]: https://github.com/import-js/eslint-plugin-import/pull/2466
[#2440]: https://github.com/import-js/eslint-plugin-import/pull/2440
[#2438]: https://github.com/import-js/eslint-plugin-import/pull/2438
[#2427]: https://github.com/import-js/eslint-plugin-import/pull/2427
[#2424]: https://github.com/import-js/eslint-plugin-import/pull/2424
[#2419]: https://github.com/import-js/eslint-plugin-import/pull/2419
Expand Down Expand Up @@ -1583,6 +1585,7 @@ for info on changes for earlier releases.
[@futpib]: https://github.com/futpib
[@gajus]: https://github.com/gajus
[@gausie]: https://github.com/gausie
[@georeith]: https://github.com/georeith
[@gavriguy]: https://github.com/gavriguy
[@giodamelio]: https://github.com/giodamelio
[@golopot]: https://github.com/golopot
Expand Down
5 changes: 5 additions & 0 deletions tests/files/cycles/ignore/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"import/no-cycle": 0
}
}
2 changes: 2 additions & 0 deletions tests/files/cycles/ignore/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { foo } from "../depth-zero";
export { foo };
2 changes: 2 additions & 0 deletions tests/files/cycles/intermediate-ignore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import foo from "./ignore";
export { foo };
18 changes: 18 additions & 0 deletions tests/src/rules/no-cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
}),
),
});