mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(linter): react/exhaustive-deps update span for unknown deps diagnostic (#7249)
Relates to #7246
This commit is contained in:
parent
3dcac1ae0b
commit
62b6327879
2 changed files with 7 additions and 8 deletions
|
|
@ -226,7 +226,7 @@ impl Rule for ExhaustiveDeps {
|
|||
Argument::SpreadElement(_) => {
|
||||
ctx.diagnostic(unknown_dependencies_diagnostic(
|
||||
hook_name.as_str(),
|
||||
callback_node.span(),
|
||||
call_expr.callee.span(),
|
||||
));
|
||||
None
|
||||
}
|
||||
|
|
@ -312,7 +312,7 @@ impl Rule for ExhaustiveDeps {
|
|||
_ => {
|
||||
ctx.diagnostic(unknown_dependencies_diagnostic(
|
||||
hook_name.as_str(),
|
||||
callback_node.span(),
|
||||
call_expr.callee.span(),
|
||||
));
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1953,12 +1953,11 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Either include it or remove the dependency array.
|
||||
|
||||
⚠ react_hooks(exhaustive-deps): React Hook useEffect received a function whose dependencies are unknown.
|
||||
╭─[exhaustive_deps.tsx:3:21]
|
||||
2 │ const local = {};
|
||||
3 │ ╭─▶ useEffect(debounce(() => {
|
||||
4 │ │ console.log(local);
|
||||
5 │ ╰─▶ }, delay), []);
|
||||
6 │ }
|
||||
╭─[exhaustive_deps.tsx:3:11]
|
||||
2 │ const local = {};
|
||||
3 │ useEffect(debounce(() => {
|
||||
· ─────────
|
||||
4 │ console.log(local);
|
||||
╰────
|
||||
help: Pass an inline function instead.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue