Skip to content

Commit 8e57fc2

Browse files
committed
refactor(react): use find_binding helper for finding React binding
1 parent 5c31236 commit 8e57fc2

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

crates/oxc_linter/src/rules/react/react_in_jsx_scope.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ impl Rule for ReactInJsxScope {
5050
return;
5151
}
5252

53-
if !scope
54-
.ancestors(node.scope_id())
55-
.any(|v| scope.get_bindings(v).iter().any(|(k, _)| k.as_str() == react_name))
56-
{
53+
if scope.find_binding(node.scope_id(), react_name).is_none() {
5754
ctx.diagnostic(react_in_jsx_scope_diagnostic(node_span));
5855
}
5956
}

0 commit comments

Comments
 (0)