Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"./config/.oxlintrc.json"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": [
"import"
],
"rules": {
"import/no-cycle": "error"
}
}
4 changes: 4 additions & 0 deletions apps/oxlint/fixtures/cross_module_extended_config/dep-a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// should report cycle detected
import { b } from './dep-b.ts';

b();
4 changes: 4 additions & 0 deletions apps/oxlint/fixtures/cross_module_extended_config/dep-b.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// this file is also included in dep-a.ts and dep-a.ts should report a no-cycle diagnostic
import './dep-a.ts';

export function b() { /* ... */ }
4 changes: 4 additions & 0 deletions apps/oxlint/fixtures/cross_module_nested_config/dep-a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// should report cycle detected
import { b } from './dep-b.ts';

b();
4 changes: 4 additions & 0 deletions apps/oxlint/fixtures/cross_module_nested_config/dep-b.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// this file is also included in dep-a.ts and dep-a.ts should report a no-cycle diagnostic
import './dep-a.ts';

export function b() { /* ... */ }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": [
"import"
],
"rules": {
"import/no-cycle": "error"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// should report cycle detected
import { b } from './folder-dep-b.ts';

b();
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// this file is also included in folder-dep-a.ts and folder-dep-a.ts should report a no-cycle diagnostic
import './folder-dep-a.ts';

export function b() { /* ... */ }
16 changes: 16 additions & 0 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,4 +1075,20 @@ mod test {
let args = &["issue_10054"];
Tester::new().with_cwd("fixtures".into()).test_and_snapshot(args);
}

#[test]
fn test_cross_modules_with_nested_config() {
let args = &[];
Tester::new()
.with_cwd("fixtures/cross_module_nested_config".into())
.test_and_snapshot(args);
}

#[test]
fn test_cross_modules_with_extended_config() {
let args = &[];
Tester::new()
.with_cwd("fixtures/cross_module_extended_config".into())
.test_and_snapshot(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
source: apps/oxlint/src/tester.rs
---
##########
arguments:
working directory: fixtures/cross_module_extended_config
----------

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/import/no-cycle.html\eslint-plugin-import(no-cycle)]8;;\: Dependency cycle detected
,-[dep-a.ts:2:19]
1 | // should report cycle detected
2 | import { b } from './dep-b.ts';
: ^^^^^^^^^^^^
3 |
`----
help: These paths form a cycle:
-> ./dep-b.ts - fixtures/cross_module_extended_config/dep-b.ts
-> ./dep-a.ts - fixtures/cross_module_extended_config/dep-a.ts

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/import/no-cycle.html\eslint-plugin-import(no-cycle)]8;;\: Dependency cycle detected
,-[dep-b.ts:2:8]
1 | // this file is also included in dep-a.ts and dep-a.ts should report a no-cycle diagnostic
2 | import './dep-a.ts';
: ^^^^^^^^^^^^
3 |
`----
help: These paths form a cycle:
-> ./dep-a.ts - fixtures/cross_module_extended_config/dep-a.ts
-> ./dep-b.ts - fixtures/cross_module_extended_config/dep-b.ts

Found 0 warnings and 2 errors.
Finished in <variable>ms on 2 files using 1 threads.
----------
CLI result: LintFoundErrors
----------
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
source: apps/oxlint/src/tester.rs
---
##########
arguments:
working directory: fixtures/cross_module_nested_config
----------

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/import/no-cycle.html\eslint-plugin-import(no-cycle)]8;;\: Dependency cycle detected
,-[folder/folder-dep-a.ts:2:19]
1 | // should report cycle detected
2 | import { b } from './folder-dep-b.ts';
: ^^^^^^^^^^^^^^^^^^^
3 |
`----
help: These paths form a cycle:
-> ./folder-dep-b.ts - fixtures/cross_module_nested_config/folder/folder-dep-b.ts
-> ./folder-dep-a.ts - fixtures/cross_module_nested_config/folder/folder-dep-a.ts

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/import/no-cycle.html\eslint-plugin-import(no-cycle)]8;;\: Dependency cycle detected
,-[folder/folder-dep-b.ts:2:8]
1 | // this file is also included in folder-dep-a.ts and folder-dep-a.ts should report a no-cycle diagnostic
2 | import './folder-dep-a.ts';
: ^^^^^^^^^^^^^^^^^^^
3 |
`----
help: These paths form a cycle:
-> ./folder-dep-a.ts - fixtures/cross_module_nested_config/folder/folder-dep-a.ts
-> ./folder-dep-b.ts - fixtures/cross_module_nested_config/folder/folder-dep-b.ts

Found 0 warnings and 2 errors.
Finished in <variable>ms on 4 files using 1 threads.
----------
CLI result: LintFoundErrors
----------
Loading