chore(eslint): enable @eslint-react/exhaustive-deps rule#1054
Draft
carlosthe19916 wants to merge 6 commits into
Draft
chore(eslint): enable @eslint-react/exhaustive-deps rule#1054carlosthe19916 wants to merge 6 commits into
carlosthe19916 wants to merge 6 commits into
Conversation
- Simplify OidcProvider effect to depend on auth object directly - Add clearActiveItem to useActiveItemEffects deps (removes TODO) - Suppress useUrlParams deps warning with justification Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnables the @eslint-react/exhaustive-deps rule by fixing or explicitly handling hook dependency arrays in key React components/hooks and removing the rule override from the ESLint config. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
OidcProvider, depending on the wholeauthobject may cause the effect to re-run more often than necessary ifauthis not referentially stable; consider either ensuringauthis memoized or reverting to a field-based dependency list that still satisfies the rule (e.g., by disabling the rule locally with justification if needed). - Now that
clearActiveItemis in theuseActiveItemEffectsdependency array, ensure it isuseCallback-stable (or otherwise referentially stable); if it is recreated on each render this effect will fire more than intended. - For
useUrlParams, since the lint suppression relies onsetParamsanddefaultValuebeing stable per-mount, consider enforcing that viauseCallback/useMemoor adding a brief comment at their definitions to make this guarantee explicit and prevent future refactors from breaking the assumption.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `OidcProvider`, depending on the whole `auth` object may cause the effect to re-run more often than necessary if `auth` is not referentially stable; consider either ensuring `auth` is memoized or reverting to a field-based dependency list that still satisfies the rule (e.g., by disabling the rule locally with justification if needed).
- Now that `clearActiveItem` is in the `useActiveItemEffects` dependency array, ensure it is `useCallback`-stable (or otherwise referentially stable); if it is recreated on each render this effect will fire more than intended.
- For `useUrlParams`, since the lint suppression relies on `setParams` and `defaultValue` being stable per-mount, consider enforcing that via `useCallback`/`useMemo` or adding a brief comment at their definitions to make this guarantee explicit and prevent future refactors from breaking the assumption.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
The suppress comment needs to be on the useEffect call, not inside the callback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
eslint-disable-next-line doesn't cover the dependency array line; use block-level disable/enable instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1054 +/- ##
=======================================
Coverage 50.68% 50.68%
=======================================
Files 253 253
Lines 5499 5499
Branches 1660 1660
=======================================
Hits 2787 2787
Misses 2440 2440
Partials 272 272
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@eslint-react/exhaustive-depsoverride from ESLint configOidcProvidereffect to depend onauthobject directlyclearActiveItemtouseActiveItemEffectsdependency array (also removes the TODO comment)useUrlParamsdeps warning with justification (adding deps causes render loops)Test plan
npm run lintpasses with 0 warnings🤖 Generated with Claude Code
Summary by Sourcery
Enable the @eslint-react/exhaustive-deps rule and update React hooks to satisfy the stricter dependency checks without changing runtime behavior.
Enhancements:
Build: