Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_redeclare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ fn no_redeclare_as_builtin_in_diagnostic(name: &str, span: Span) -> OxcDiagnosti
.with_label(span)
}

#[derive(Debug, Default, Clone)]
#[derive(Debug, Clone)]
pub struct NoRedeclare {
built_in_globals: bool,
}

impl Default for NoRedeclare {
fn default() -> Self {
Self { built_in_globals: true }
}
}

declare_oxc_lint!(
/// ### What it does
///
Expand Down Expand Up @@ -131,6 +137,9 @@ impl Rule for NoRedeclare {
fn test() {
use crate::tester::Tester;

let defaults = NoRedeclare::default();
assert!(defaults.built_in_globals);

let pass = vec![
("var a = 3; var b = function() { var a = 10; };", None),
("var a = 3; a = 10;", None),
Expand Down
Loading