@@ -18,10 +18,10 @@ use tower_lsp_server::UriExt;
18
18
use crate :: linter:: {
19
19
error_with_position:: DiagnosticReport ,
20
20
isolated_lint_handler:: { IsolatedLintHandler , IsolatedLintHandlerOptions } ,
21
+ options:: { LintOptions as LSPLintOptions , Run , UnusedDisableDirectives } ,
21
22
tsgo_linter:: TsgoLinter ,
22
23
} ;
23
- use crate :: options:: { Run , UnusedDisableDirectives } ;
24
- use crate :: { ConcurrentHashMap , OXC_CONFIG_FILE , Options } ;
24
+ use crate :: { ConcurrentHashMap , OXC_CONFIG_FILE } ;
25
25
26
26
use super :: config_walker:: ConfigWalker ;
27
27
@@ -80,7 +80,7 @@ impl ServerLinterDiagnostics {
80
80
}
81
81
82
82
impl ServerLinter {
83
- pub fn new ( root_uri : & Uri , options : & Options ) -> Self {
83
+ pub fn new ( root_uri : & Uri , options : & LSPLintOptions ) -> Self {
84
84
let root_path = root_uri. to_file_path ( ) . unwrap ( ) ;
85
85
let mut nested_ignore_patterns = Vec :: new ( ) ;
86
86
let ( nested_configs, mut extended_paths) =
@@ -186,7 +186,7 @@ impl ServerLinter {
186
186
/// and insert them inside the nested configuration
187
187
fn create_nested_configs (
188
188
root_path : & Path ,
189
- options : & Options ,
189
+ options : & LSPLintOptions ,
190
190
nested_ignore_patterns : & mut Vec < ( Vec < String > , PathBuf ) > ,
191
191
) -> ( ConcurrentHashMap < PathBuf , Config > , Vec < PathBuf > ) {
192
192
let mut extended_paths = Vec :: new ( ) ;
@@ -397,9 +397,10 @@ mod test {
397
397
use std:: path:: { Path , PathBuf } ;
398
398
399
399
use crate :: {
400
- Options ,
401
- linter:: server_linter:: { ServerLinter , normalize_path} ,
402
- options:: Run ,
400
+ linter:: {
401
+ options:: { LintOptions , Run , UnusedDisableDirectives } ,
402
+ server_linter:: { ServerLinter , normalize_path} ,
403
+ } ,
403
404
tester:: { Tester , get_file_path} ,
404
405
} ;
405
406
use rustc_hash:: FxHashMap ;
@@ -420,7 +421,7 @@ mod test {
420
421
let mut nested_ignore_patterns = Vec :: new ( ) ;
421
422
let ( configs, _) = ServerLinter :: create_nested_configs (
422
423
Path :: new ( "/root/" ) ,
423
- & Options { flags, ..Options :: default ( ) } ,
424
+ & LintOptions { flags, ..LintOptions :: default ( ) } ,
424
425
& mut nested_ignore_patterns,
425
426
) ;
426
427
@@ -432,7 +433,7 @@ mod test {
432
433
let mut nested_ignore_patterns = Vec :: new ( ) ;
433
434
let ( configs, _) = ServerLinter :: create_nested_configs (
434
435
& get_file_path ( "fixtures/linter/init_nested_configs" ) ,
435
- & Options :: default ( ) ,
436
+ & LintOptions :: default ( ) ,
436
437
& mut nested_ignore_patterns,
437
438
) ;
438
439
let configs = configs. pin ( ) ;
@@ -451,7 +452,7 @@ mod test {
451
452
fn test_lint_on_run_on_type_on_type ( ) {
452
453
Tester :: new (
453
454
"fixtures/linter/lint_on_run/on_type" ,
454
- Some ( Options { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
455
+ Some ( LintOptions { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
455
456
)
456
457
. test_and_snapshot_single_file_with_run_type ( "on-type.ts" , Run :: OnType ) ;
457
458
}
@@ -461,7 +462,7 @@ mod test {
461
462
fn test_lint_on_run_on_type_on_save ( ) {
462
463
Tester :: new (
463
464
"fixtures/linter/lint_on_run/on_save" ,
464
- Some ( Options { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
465
+ Some ( LintOptions { type_aware : true , run : Run :: OnType , ..Default :: default ( ) } ) ,
465
466
)
466
467
. test_and_snapshot_single_file_with_run_type ( "on-save.ts" , Run :: OnSave ) ;
467
468
}
@@ -471,7 +472,7 @@ mod test {
471
472
fn test_lint_on_run_on_save_on_type ( ) {
472
473
Tester :: new (
473
474
"fixtures/linter/lint_on_run/on_save" ,
474
- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
475
+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
475
476
)
476
477
. test_and_snapshot_single_file_with_run_type ( "on-type.ts" , Run :: OnType ) ;
477
478
}
@@ -481,7 +482,7 @@ mod test {
481
482
fn test_lint_on_run_on_save_on_save ( ) {
482
483
Tester :: new (
483
484
"fixtures/linter/lint_on_run/on_type" ,
484
- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
485
+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
485
486
)
486
487
. test_and_snapshot_single_file_with_run_type ( "on-save.ts" , Run :: OnSave ) ;
487
488
}
@@ -491,7 +492,7 @@ mod test {
491
492
fn test_lint_on_run_on_type_on_save_without_type_aware ( ) {
492
493
Tester :: new (
493
494
"fixtures/linter/lint_on_run/on_type" ,
494
- Some ( Options { type_aware : false , run : Run :: OnType , ..Default :: default ( ) } ) ,
495
+ Some ( LintOptions { type_aware : false , run : Run :: OnType , ..Default :: default ( ) } ) ,
495
496
)
496
497
. test_and_snapshot_single_file_with_run_type ( "on-save-no-type-aware.ts" , Run :: OnSave ) ;
497
498
}
@@ -566,23 +567,22 @@ mod test {
566
567
fn test_multiple_suggestions ( ) {
567
568
Tester :: new (
568
569
"fixtures/linter/multiple_suggestions" ,
569
- Some ( Options {
570
+ Some ( LintOptions {
570
571
flags : FxHashMap :: from_iter ( [ (
571
572
"fix_kind" . to_string ( ) ,
572
573
"safe_fix_or_suggestion" . to_string ( ) ,
573
574
) ] ) ,
574
- ..Options :: default ( )
575
+ ..Default :: default ( )
575
576
} ) ,
576
577
)
577
578
. test_and_snapshot_single_file ( "forward_ref.ts" ) ;
578
579
}
579
580
580
581
#[ test]
581
582
fn test_report_unused_directives ( ) {
582
- use crate :: options:: UnusedDisableDirectives ;
583
583
Tester :: new (
584
584
"fixtures/linter/unused_disabled_directives" ,
585
- Some ( Options {
585
+ Some ( LintOptions {
586
586
unused_disable_directives : UnusedDisableDirectives :: Deny ,
587
587
..Default :: default ( )
588
588
} ) ,
@@ -601,7 +601,7 @@ mod test {
601
601
fn test_ts_alias ( ) {
602
602
Tester :: new (
603
603
"fixtures/linter/ts_path_alias" ,
604
- Some ( Options {
604
+ Some ( LintOptions {
605
605
ts_config_path : Some ( "./deep/tsconfig.json" . to_string ( ) ) ,
606
606
..Default :: default ( )
607
607
} ) ,
@@ -614,7 +614,7 @@ mod test {
614
614
fn test_tsgo_lint ( ) {
615
615
let tester = Tester :: new (
616
616
"fixtures/linter/tsgolint" ,
617
- Some ( Options { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
617
+ Some ( LintOptions { type_aware : true , run : Run :: OnSave , ..Default :: default ( ) } ) ,
618
618
) ;
619
619
tester. test_and_snapshot_single_file ( "no-floating-promises/index.ts" ) ;
620
620
}
0 commit comments