Skip to content

Commit

Permalink
perf(es/lints): Disable lints by default (#9689)
Browse files Browse the repository at this point in the history
**Description:**

This is a footgun for users of `swc` crate. So I changed the default value of `jsc.experimental.disableAllLints` to `true`.


**Related issue:**

 - #9601
  • Loading branch information
kdy1 authored Oct 30, 2024
1 parent f1470cf commit 4d887d0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/poor-tools-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
swc: patch
swc_core: patch
---

perf(es/lints): Disable lints by default
2 changes: 1 addition & 1 deletion crates/swc/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ pub struct JscExperimental {
pub emit_isolated_dts: BoolConfig<false>,

#[serde(default)]
pub disable_all_lints: BoolConfig<false>,
pub disable_all_lints: BoolConfig<true>,
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
Expand Down
9 changes: 8 additions & 1 deletion crates/swc/tests/error_msg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::{Path, PathBuf};

use swc::{
config::{Config, IsModule, Options},
config::{Config, IsModule, JscConfig, JscExperimental, Options},
try_with_handler, Compiler, HandlerOpts,
};
use swc_common::{errors::ColorConfig, sync::Lrc, FilePathMapping, SourceMap, GLOBALS};
Expand Down Expand Up @@ -61,6 +61,13 @@ fn fixture(input: PathBuf) {
&Options {
config: Config {
is_module: Some(IsModule::Unknown),
jsc: JscConfig {
experimental: JscExperimental {
disable_all_lints: false.into(),
..Default::default()
},
..Default::default()
},
..Default::default()
},
swcrc: true,
Expand Down
8 changes: 7 additions & 1 deletion crates/swc/tests/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ use regex::Regex;
use serde::de::DeserializeOwned;
use serde_json::from_str;
use swc::{
config::{Config, JsMinifyOptions, JscConfig, ModuleConfig, Options, TransformConfig},
config::{
Config, JsMinifyOptions, JscConfig, JscExperimental, ModuleConfig, Options, TransformConfig,
},
try_with_handler, Compiler,
};
use swc_common::{
Expand Down Expand Up @@ -401,6 +403,10 @@ fn matrix(input: &Path) -> Vec<TestUnitData> {
..Default::default()
})
.into(),
experimental: JscExperimental {
disable_all_lints: false.into(),
..Default::default()
},
..Default::default()
},
module: Some(module.into()),
Expand Down

0 comments on commit 4d887d0

Please sign in to comment.