File tree 5 files changed +60
-2
lines changed
5 files changed +60
-2
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "plugins" : [" import" ],
3
+ "rules" : {
4
+ "import/no-cycle" : " error"
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ import { b } from "./b" ;
2
+
3
+ console . log ( b ) ;
Original file line number Diff line number Diff line change
1
+ import "./a" ;
2
+
3
+ export const b = "b" ;
Original file line number Diff line number Diff line change @@ -316,8 +316,15 @@ impl Runner for LintRunner {
316
316
}
317
317
}
318
318
319
- let mut options = LintServiceOptions :: new ( self . cwd , paths)
320
- . with_cross_module ( config_builder. plugins ( ) . has_import ( ) ) ;
319
+ // TODO(refactor): pull this into a shared function, so that the language server can use
320
+ // the same functionality.
321
+ let use_cross_module = if use_nested_config {
322
+ nested_configs. values ( ) . any ( |config| config. plugins ( ) . has_import ( ) )
323
+ } else {
324
+ config_builder. plugins ( ) . has_import ( )
325
+ } ;
326
+ let mut options =
327
+ LintServiceOptions :: new ( self . cwd , paths) . with_cross_module ( use_cross_module) ;
321
328
322
329
let lint_config = match config_builder. build ( ) {
323
330
Ok ( config) => config,
@@ -1057,4 +1064,10 @@ mod test {
1057
1064
let args = & [ "overrides_same_directory" ] ;
1058
1065
Tester :: new ( ) . with_cwd ( "fixtures/extends_config" . into ( ) ) . test_and_snapshot ( args) ;
1059
1066
}
1067
+
1068
+ #[ test]
1069
+ fn test_nested_config_multi_file_analysis_imports ( ) {
1070
+ let args = & [ "issue_10054" ] ;
1071
+ Tester :: new ( ) . with_cwd ( "fixtures" . into ( ) ) . test_and_snapshot ( args) ;
1072
+ }
1060
1073
}
Original file line number Diff line number Diff line change
1
+ -- -
2
+ source : apps / oxlint / src / tester .rs
3
+ -- -
4
+ ##########
5
+ arguments : issue_10054
6
+ working directory : fixtures
7
+ ----------
8
+
9
+ x ]8 ;;https :// oxc.rs/docs/guide/usage/linter/rules/import/no-cycle.html\eslint-plugin-import(no-cycle)]8;;\: Dependency cycle detected
10
+ ,- [issue_10054 / a .ts :1 :19 ]
11
+ 1 | import { b } from " ./b" ;
12
+ : ^^^^^
13
+ 2 |
14
+ ` ----
15
+ help: These paths form a cycle:
16
+ -> ./b - fixtures/issue_10054/b.ts
17
+ -> ./a - fixtures/issue_10054/a.ts
18
+
19
+ x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/import/no-cycle.html\e slint-plugin-import(no-cycle)]8;;\: Dependency cycle detected
20
+ ,-[issue_10054/b.ts:1:8]
21
+ 1 | import "./a";
22
+ : ^^^^^
23
+ 2 |
24
+ ` ----
25
+ help : These paths form a cycle :
26
+ - > ./ a - fixtures / issue_10054 / a .ts
27
+ - > ./ b - fixtures / issue_10054 / b .ts
28
+
29
+ Found 0 warnings and 2 errors .
30
+ Finished in <variable >ms on 2 files using 1 threads.
31
+ ----------
32
+ CLI result: LintFoundErrors
33
+ ----------
You can’t perform that action at this time.
0 commit comments