@@ -74,7 +74,9 @@ use swc_ecma_visit::{Fold, VisitMutWith};
74
74
75
75
pub use crate :: plugin:: PluginConfig ;
76
76
use crate :: {
77
- builder:: PassBuilder , dropped_comments_preserver:: dropped_comments_preserver, SwcImportResolver ,
77
+ builder:: { should_enable, PassBuilder } ,
78
+ dropped_comments_preserver:: dropped_comments_preserver,
79
+ SwcImportResolver ,
78
80
} ;
79
81
80
82
#[ cfg( test) ]
@@ -579,6 +581,7 @@ impl Options {
579
581
) ;
580
582
581
583
let keep_import_attributes = experimental. keep_import_attributes . into_bool ( ) ;
584
+ let disable_all_lints = experimental. disable_all_lints . into_bool ( ) ;
582
585
583
586
#[ cfg( feature = "plugin" ) ]
584
587
let plugin_transforms = {
@@ -697,23 +700,33 @@ impl Options {
697
700
} ;
698
701
699
702
Box :: new ( chain ! (
700
- lint_to_fold( swc_ecma_lints:: rules:: all( LintParams {
701
- program: & program,
702
- lint_config: & lints,
703
- top_level_ctxt,
704
- unresolved_ctxt,
705
- es_version,
706
- source_map: cm. clone( ) ,
707
- } ) ) ,
703
+ Optional :: new(
704
+ lint_to_fold( swc_ecma_lints:: rules:: all( LintParams {
705
+ program: & program,
706
+ lint_config: & lints,
707
+ top_level_ctxt,
708
+ unresolved_ctxt,
709
+ es_version,
710
+ source_map: cm. clone( ) ,
711
+ } ) ) ,
712
+ !disable_all_lints
713
+ ) ,
708
714
// Decorators may use type information
709
- Optional :: new( decorator_pass, syntax. decorators( ) ) ,
715
+ Optional :: new(
716
+ decorator_pass,
717
+ should_enable( es_version, EsVersion :: EsNext ) && syntax. decorators( )
718
+ ) ,
710
719
Optional :: new(
711
720
explicit_resource_management( ) ,
712
- syntax. explicit_resource_management( )
721
+ should_enable( es_version, EsVersion :: EsNext )
722
+ && syntax. explicit_resource_management( )
713
723
) ,
714
724
// The transform strips import assertions, so it's only enabled if
715
725
// keep_import_assertions is false.
716
- Optional :: new( import_assertions( ) , !keep_import_attributes) ,
726
+ Optional :: new(
727
+ import_assertions( ) ,
728
+ should_enable( es_version, EsVersion :: EsNext ) && !keep_import_attributes
729
+ ) ,
717
730
Optional :: new(
718
731
typescript:: tsx:: <Option <& dyn Comments >>(
719
732
cm. clone( ) ,
@@ -1229,6 +1242,9 @@ pub struct JscExperimental {
1229
1242
/// This requires `isolatedDeclartion` feature of TypeScript 5.5.
1230
1243
#[ serde( default ) ]
1231
1244
pub emit_isolated_dts : BoolConfig < false > ,
1245
+
1246
+ #[ serde( default ) ]
1247
+ pub disable_all_lints : BoolConfig < false > ,
1232
1248
}
1233
1249
1234
1250
#[ derive( Debug , Clone , Copy , Serialize , Deserialize ) ]
0 commit comments