fix(linter): useExhaustiveDependencies regressions, fixes #8802, fixes #8883, fixes #8885#8900
Conversation
…erations and assignment expressions, fixes biomejs#8885
…ions without parens, fixes biomejs#8883
…s and non-constant property access, fixes biomejs#8802
🦋 Changeset detectedLatest commit: a7d697e The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
useExhaustiveDependencies regressions, fixes #8802, fixes #8883, fixes #8885
WalkthroughUpdates the useExhaustiveDependencies analysis to: avoid suggesting callback‑scoped variables or method names as dependencies; stop reporting false positives when props are destructured in the function body; and treat values derived from pre/post‑increment or compound assignments as required dependencies. Adds constant‑aware checks via is_constant, refines declaration resolution for arrow‑function parameters and identifier bindings, and introduces early returns/guards for computed/member/call expression patterns. New tests exercise these cases. Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
useExhaustiveDependencies regressions, fixes #8802, fixes #8883, fixes #8885useExhaustiveDependencies regressions, fixes #8802, fixes #8883, fixes #8885
Summary
Several bug-fixes:
Fixed #8802:
useExhaustiveDependenciesnow correctly suggests dependencies without including callback-scoped variables or method names.When accessing object properties with a callback-scoped variable, only the object path is suggested:
When calling methods on objects, only the object is suggested as a dependency:
Fixed #8883:
useExhaustiveDependenciesno longer produces false positives when props are destructured in the function body of arrow function components without parentheses around the parameter.Fixed #8885:
useExhaustiveDependenciesno longer incorrectly reports variables as unnecessary dependencies when they are derived from expressions containing post/pre-increment operators (++/--) or compound assignment operators (+=,-=, etc.).Test Plan
Tests are included.
Docs
Changesets are included.