Skip to content

chore(eslint): enable @eslint-react/exhaustive-deps rule#1054

Draft
carlosthe19916 wants to merge 3 commits into
guacsec:mainfrom
carlosthe19916:hotfix/enable-exhaustive-deps
Draft

chore(eslint): enable @eslint-react/exhaustive-deps rule#1054
carlosthe19916 wants to merge 3 commits into
guacsec:mainfrom
carlosthe19916:hotfix/enable-exhaustive-deps

Conversation

@carlosthe19916

@carlosthe19916 carlosthe19916 commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Remove the @eslint-react/exhaustive-deps override from ESLint config
  • Simplify OidcProvider effect to depend on auth object directly
  • Add clearActiveItem to useActiveItemEffects dependency array (also removes the TODO comment)
  • Suppress useUrlParams deps warning with justification (adding deps causes render loops)

Test plan

  • npm run lint passes 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:

  • Adjust OidcProvider effect to depend on the auth object directly.
  • Update useActiveItemEffects hook dependencies to include clearActiveItem for exhaustive-deps compliance.
  • Document and suppress the exhaustive-deps warning in useUrlParams where adding dependencies would cause render loops.

Build:

  • Remove the @eslint-react/exhaustive-deps override from the ESLint configuration to enforce the rule.

@sourcery-ai

sourcery-ai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Enables 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

Change Details Files
Simplify AuthEnabledOidcProvider effect dependencies to rely on the stable auth object rather than individual properties.
  • Update useEffect dependency array to depend on the auth object instead of specific auth fields
client/src/app/components/OidcProvider.tsx
Fix exhaustive-deps warning in useActiveItemEffects by including clearActiveItem in the dependency array.
  • Add clearActiveItem to useEffect dependency list to reflect actual usage in the effect body
  • Remove outdated TODO comment about fixing exhaustive-deps warning
client/src/app/hooks/table-controls/active-item/useActiveItemEffects.ts
Document and suppress a specific exhaustive-deps warning in useUrlParams where adding dependencies would cause render loops.
  • Add eslint-disable-next-line comment for @eslint-react/exhaustive-deps on the effect that uses allParamsEmpty
  • Explain in the comment that setParams and defaultValue are stable per mount and including them causes render loops
client/src/app/hooks/useUrlParams.ts
Enable @eslint-react/exhaustive-deps rule globally in ESLint configuration.
  • Remove the @eslint-react/exhaustive-deps: off override from the ESLint config
eslint.config.mjs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@carlosthe19916 carlosthe19916 marked this pull request as draft May 27, 2026 12:14
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.71%. Comparing base (c00479e) to head (b7792b0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1054      +/-   ##
==========================================
+ Coverage   50.70%   50.71%   +0.01%     
==========================================
  Files         253      253              
  Lines        5491     5491              
  Branches     1659     1659              
==========================================
+ Hits         2784     2785       +1     
  Misses       2436     2436              
+ Partials      271      270       -1     
Flag Coverage Δ
e2e 68.95% <ø> (+0.02%) ⬆️
unit 2.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

carlosthe19916 and others added 3 commits June 1, 2026 13:16
- 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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant