Skip to content

Commit d32cb4b

Browse files
committed
fix(linter): fix default values for eslint/no-redeclare (#11911)
1 parent d80c19d commit d32cb4b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crates/oxc_linter/src/rules/eslint/no_redeclare.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ fn no_redeclare_as_builtin_in_diagnostic(name: &str, span: Span) -> OxcDiagnosti
2222
.with_label(span)
2323
}
2424

25-
#[derive(Debug, Default, Clone)]
25+
#[derive(Debug, Clone)]
2626
pub struct NoRedeclare {
2727
built_in_globals: bool,
2828
}
2929

30+
impl Default for NoRedeclare {
31+
fn default() -> Self {
32+
Self { built_in_globals: true }
33+
}
34+
}
35+
3036
declare_oxc_lint!(
3137
/// ### What it does
3238
///
@@ -131,6 +137,9 @@ impl Rule for NoRedeclare {
131137
fn test() {
132138
use crate::tester::Tester;
133139

140+
let defaults = NoRedeclare::default();
141+
assert!(defaults.built_in_globals);
142+
134143
let pass = vec![
135144
("var a = 3; var b = function() { var a = 10; };", None),
136145
("var a = 3; a = 10;", None),

0 commit comments

Comments
 (0)