@@ -32,6 +32,8 @@ pub struct LintServiceOptions {
32
32
33
33
/// TypeScript `tsconfig.json` path for reading path alias and project references
34
34
tsconfig : Option < PathBuf > ,
35
+
36
+ cross_module : bool ,
35
37
}
36
38
37
39
impl LintServiceOptions {
@@ -40,7 +42,7 @@ impl LintServiceOptions {
40
42
where
41
43
T : Into < Box < Path > > ,
42
44
{
43
- Self { cwd : cwd. into ( ) , paths, tsconfig : None }
45
+ Self { cwd : cwd. into ( ) , paths, tsconfig : None , cross_module : false }
44
46
}
45
47
46
48
#[ inline]
@@ -58,6 +60,13 @@ impl LintServiceOptions {
58
60
self
59
61
}
60
62
63
+ #[ inline]
64
+ #[ must_use]
65
+ pub fn with_cross_module ( mut self , cross_module : bool ) -> Self {
66
+ self . cross_module = cross_module;
67
+ self
68
+ }
69
+
61
70
#[ inline]
62
71
pub fn cwd ( & self ) -> & Path {
63
72
& self . cwd
@@ -165,7 +174,7 @@ pub struct Runtime {
165
174
166
175
impl Runtime {
167
176
fn new ( linter : Linter , options : LintServiceOptions ) -> Self {
168
- let resolver = linter . options ( ) . plugins . has_import ( ) . then ( || {
177
+ let resolver = options. cross_module . then ( || {
169
178
Self :: get_resolver ( options. tsconfig . or_else ( || Some ( options. cwd . join ( "tsconfig.json" ) ) ) )
170
179
} ) ;
171
180
Self {
@@ -310,7 +319,7 @@ impl Runtime {
310
319
. build_module_record ( path, program) ;
311
320
let module_record = semantic_builder. module_record ( ) ;
312
321
313
- if self . linter . options ( ) . plugins . has_import ( ) {
322
+ if self . resolver . is_some ( ) {
314
323
self . module_map . insert (
315
324
path. to_path_buf ( ) . into_boxed_path ( ) ,
316
325
ModuleState :: Resolved ( Arc :: clone ( & module_record) ) ,
@@ -392,7 +401,7 @@ impl Runtime {
392
401
}
393
402
394
403
fn init_cache_state ( & self , path : & Path ) -> bool {
395
- if ! self . linter . options ( ) . plugins . has_import ( ) {
404
+ if self . resolver . is_none ( ) {
396
405
return false ;
397
406
}
398
407
@@ -447,7 +456,7 @@ impl Runtime {
447
456
}
448
457
449
458
fn ignore_path ( & self , path : & Path ) {
450
- if self . linter . options ( ) . plugins . has_import ( ) {
459
+ if self . resolver . is_some ( ) {
451
460
self . module_map . insert ( path. to_path_buf ( ) . into_boxed_path ( ) , ModuleState :: Ignored ) ;
452
461
self . update_cache_state ( path) ;
453
462
}
0 commit comments