Skip to content

Commit

Permalink
refactor(react): use find_binding helper for finding React binding
Browse files Browse the repository at this point in the history
  • Loading branch information
jelly committed Jul 8, 2024
1 parent 5c31236 commit f2fbb0a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions crates/oxc_linter/src/rules/react/react_in_jsx_scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ impl Rule for ReactInJsxScope {
return;
}

if !scope
.ancestors(node.scope_id())
.any(|v| scope.get_bindings(v).iter().any(|(k, _)| k.as_str() == react_name))
{
if !scope.find_binding(node.scope_id(), react_name).is_some() {
ctx.diagnostic(react_in_jsx_scope_diagnostic(node_span));
}
}
Expand Down

0 comments on commit f2fbb0a

Please sign in to comment.