Skip to content

Fix all lint:js warnings and enforce zero-warning policy#340

Open
obenland wants to merge 4 commits intotrunkfrom
fix/lint-warnings
Open

Fix all lint:js warnings and enforce zero-warning policy#340
obenland wants to merge 4 commits intotrunkfrom
fix/lint-warnings

Conversation

@obenland
Copy link
Copy Markdown
Member

Summary

  • Fix all 21 react-hooks/exhaustive-deps warnings across 12 files
  • Add --max-warnings=0 to the lint:js script so warnings fail CI going forward

The main changes:

  • Add missing dependencies to useCallback and useEffect dependency arrays
  • Convert currentUrl from a let variable to useRef in script.js (was being reassigned inside callbacks)
  • Add dependency arrays to useCallback calls that were missing them entirely
  • Remove inputsRef from useEffect dependency array in totp.js (refs don't change identity)

Test plan

  • npm run lint:js passes with zero warnings and zero errors
  • npm run test:unit -w settings — all JS tests pass
  • Smoke test the settings UI: navigate between screens, generate SVN password, register a security key, set up TOTP, manage backup codes

🤖 Generated with Claude Code

- Add missing dependencies to useCallback and useEffect hooks
- Convert currentUrl from let variable to useRef in script.js
- Add dependency arrays to useCallback calls missing them entirely
- Remove ref from useEffect dependency array in totp.js
- Set --max-warnings=0 on lint:js to fail on warnings going forward

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to eliminate existing react-hooks/exhaustive-deps lint warnings in the Settings UI and enforce a zero-warning lint policy in CI going forward.

Changes:

  • Updates multiple useEffect/useCallback dependency arrays to satisfy react-hooks/exhaustive-deps.
  • Refactors URL handling in settings/src/script.js by replacing a reassigned let currentUrl with a useRef.
  • Updates lint:js to fail on any warnings via --max-warnings=0.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
settings/src/script.js Switches currentUrl to useRef and adjusts navigation/popstate handling deps.
settings/src/components/webauthn/register-key.js Adds missing dependencies to onRegister callback.
settings/src/components/webauthn/list-keys.js Adds missing dependencies to delete callback.
settings/src/components/totp.js Adds deps for setup-method click handlers and adjusts deps in setup form hooks.
settings/src/components/svn-password.js Adds dependency array to password generation callback.
settings/src/components/screen-link.js Adds missing deps for screen navigation click handler.
settings/src/components/revalidate-modal.js Updates effect deps for message listener to avoid stale closures.
settings/src/components/numeric-control.js Adds missing deps to callbacks using index/handlers.
settings/src/components/email-address.js Adds missing deps to save/discard callbacks.
settings/src/components/backup-codes.js Adds missing deps to setup effect and finished handler.
settings/src/components/auto-tabbing-input.js Adds deps to input callbacks (change/paste).
settings/package.json Enforces zero-warning lint policy via --max-warnings=0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

secretKey starts as an empty string and is populated async. If the
user switches to manual setup before the API responds, match() returns
null and .join() throws.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

obenland and others added 2 commits March 25, 2026 11:19
- Use refs for userRecord in revalidate-modal.js to avoid re-subscribing message listener on every render
- Use replaceState with guard in script.js to prevent duplicate history entries
- Use ref for userRecord in backup-codes.js to prevent re-firing generate-backup-codes API call

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `{ ...userRecord }` spread created a new object identity every
render for no benefit, compounding the instability of useEntityRecord.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants