mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(react): use find_binding helper for finding React binding (#4108)
Discovered `find_binding()` when hacking on https://github.com/oxc-project/oxc/pull/4087 seemed like a nice refactor.
This commit is contained in:
parent
ed4c54c0de
commit
2687ebc1c5
1 changed files with 1 additions and 4 deletions
|
|
@ -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_none() {
|
||||
ctx.diagnostic(react_in_jsx_scope_diagnostic(node_span));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue