Clear useExhaustiveDependencies lint debt and gate CI on full lint#69
Merged
Conversation
Closes #68. Resolves the 66 useExhaustiveDependencies error-class cases the issue called out (#67 already cleared the other rule classes), and adds typecheck + lint as CI gates so they can't pile up again. Approach in DocumentLayout (the bulk of the cases): - `resolveIdentity` is now a `useCallback([displayName, effectiveDisplayName])` so downstream callbacks list it as a single dep instead of mirroring the two display-name fields. - `refreshDoc` / `refreshThreads` hoisted above the useEffects / useCallbacks that need them as deps (the dep array is evaluated at render time — TDZ otherwise). - 12 callback dep arrays updated to reference `resolveIdentity` and `refreshThreads`/`refreshDoc` directly. The corresponding eslint-disables are removed. `biome-ignore` (with reason) is reserved for genuine intentional re-trigger effects: mount-time deep link, doc-swap resets, layout remeasure, headings scroll, content-swap re-attach, events subscription. Each ignore explains *why* the dep is there or omitted. Other files: same pattern — callback deps updated where straight- forward, biome-ignore for re-trigger / mount-once / static-fn cases. `InlineCommentsLayer` hoists `resolveAnchorElement` to module scope so it's stable as a dep. CI now runs `bun run typecheck` and `bun run lint` before tests, so any future PR introducing a biome error fails the build. Lint warnings stay non-blocking. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
753c99b to
3ee48cd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR clears the remaining Biome lint/correctness/useExhaustiveDependencies error-level violations in the web app by making hook dependencies explicit (or explicitly ignored with rationale), and prevents regressions by gating CI on typecheck and lint.
Changes:
- Refactors several effects/callbacks (notably in
DocumentLayout) to use stableuseCallbackhelpers and updated dependency arrays, removing prior hook-deps suppressions. - Adds targeted
biome-ignore lint/correctness/useExhaustiveDependenciesannotations (with reasons) for intentional “re-trigger” deps and mount-once subscriptions. - Updates GitHub Actions workflow to run
bun run typecheckandbun run lintas CI gates before tests.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/src/pages/ViewPage.tsx | Adds a Biome ignore to keep intentional refetch-trigger deps on the document-load effect. |
| apps/web/src/pages/HomePage.tsx | Adds a Biome ignore for an effect that intentionally omits a render-local reset function from deps. |
| apps/web/src/pages/EditPage.tsx | Tweaks deps and adds a Biome ignore for scroll-sync reattachment triggers. |
| apps/web/src/components/Toc.tsx | Adds Biome ignores for intentional re-trigger deps (expand/scroll behavior). |
| apps/web/src/components/ThreadComposer.tsx | Adds Biome ignores for mount-once editor dependency loading and single-mount editor setup. |
| apps/web/src/components/RenderedDoc.tsx | Adds Biome ignores to keep intentional re-attach / re-highlight triggers tied to rendered.html and related deps. |
| apps/web/src/components/PasswordPromptDialog.tsx | Adds a Biome ignore for a stable event subscription effect that intentionally omits a render-local function dep. |
| apps/web/src/components/InvitesPanel.tsx | Adds a Biome ignore to keep displayName as an explicit refetch trigger. |
| apps/web/src/components/inline-comments/InlineCommentsLayer.tsx | Hoists resolveAnchorElement to module scope and updates deps/ignores for layout remeasure + reattach behavior. |
| apps/web/src/components/HistoryList.tsx | Adds Biome ignores to preserve intentional refetch/reset triggers (version, uid). |
| apps/web/src/components/DocumentLayout.tsx | Hoists refreshDoc/refreshThreads, memoizes resolveIdentity, and updates many callback deps to remove hook-deps suppressions. |
| apps/web/src/components/BlockActions.tsx | Adds a Biome ignore to keep an intentional rebind trigger for a resize observer. |
| apps/web/src/components/ActivityList.tsx | Adds Biome ignores to preserve intentional refetch/reset triggers (version, uid). |
| .github/workflows/build-and-push.yml | Gates CI by adding bun run typecheck and bun run lint before tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ViewPage: reloadNonce is bumped by the "Try again" button on the
error screen, not after password unlock.
- ThreadComposer: the stronger invariant for omitting `format` from
the deps is that ProposalSourceField is keyed on `${docFormat}-…`
by its parent, so a format change remounts the component with a
fresh closure rather than mutating the existing one.
Co-Authored-By: Claude Opus 4.7 <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
Closes #68. Resolves the 66
useExhaustiveDependencieserror-class cases the issue called out (#67 already cleared the other rule classes), and addstypecheck+lintas CI gates so they can't pile up again.DocumentLayout (the bulk)
resolveIdentityis now auseCallback([displayName, effectiveDisplayName])so downstream callbacks list it as a single dep instead of mirroring the two display-name fields.refreshDoc/refreshThreadshoisted above the effects/callbacks that need them as deps (the dep array is evaluated at render time — TDZ otherwise).resolveIdentityandrefreshThreads/refreshDocdirectly. The correspondingeslint-disablecomments are removed.Other files
Same pattern — callback deps updated where straightforward,
biome-ignorefor re-trigger / mount-once / static-fn cases. InlineCommentsLayer hoistsresolveAnchorElementto module scope so it's stable as a dep.Discipline for
biome-ignoreEach ignore carries a reason explaining why the dep is there or omitted — so future readers can judge whether the rationale still holds. Reserved for: mount-time deep link, doc-swap resets, layout remeasure, headings scroll, content-swap re-attach, events subscription, mount-once editor setup, etc.
CI gate
build-and-push.yml now runs
bun run typecheckandbun run lintbefore tests. Any future PR introducing a biome error fails the build. Lint warnings stay non-blocking.Test plan
bun run typecheckcleanbun run lintexits 0 (0 errors; 512 warnings only)bun run test:ci— 393 pass, 4 skip, 0 failDocumentLayoutdep-array refactor didn't break the effects that drive heading-scroll, comment refresh, or layout remeasure.🤖 Generated with Claude Code