Skip to content

Commit

Permalink
fix(linter): rule valid-typeof do not check for globals (#9140)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Feb 15, 2025
1 parent 29141d6 commit 9214661
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/valid_typeof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ impl Rule for ValidTypeof {
}

if let Expression::Identifier(ident) = sibling {
if ident.name == "undefined" && ctx.is_reference_to_global_variable(ident) {
if ident.name == "undefined"
&& ctx.scopes().root_unresolved_references().contains_key(ident.name.as_str())
{
ctx.diagnostic_with_fix(
if self.require_string_literals {
not_string(
Expand Down

0 comments on commit 9214661

Please sign in to comment.