fix(hooks): clear last react-hooks warnings + promote 5 rules to error (#38 batch 3/3, closes #38) - #90
Merged
Conversation
…to error (#38 batch 3/3) Closes out the #38 burn-down (28 warnings -> 0): - admin/appearance: the restore-theme-on-leave cleanup needs the latest saved settings + palette override but must run only on unmount, so those were mirrored into refs *during render* (react-hooks/refs). Now mirrored from an effect (refs belong outside render); unmount cleanup reads them unchanged. - route-progress: reordered "finish" above "start" so it's a real dependency instead of used-before-declaration behind a lint-disable — clearing the immutability + preserve-manual-memoization warnings and dropping two eslint-disable comments. The route-commit effect now finishes on the next animation frame rather than synchronously (a genuine react-to-external-event; deferring also keeps the 100%-then-fade paint out of the route's own render). With the count at zero, the five React-Compiler-era rules (refs, set-state-in-effect, static-components, immutability, preserve-manual-memoization) are promoted from warn to error - explicit, so CI blocks any regression and the codebase stays React-Compiler-ready. Verified live: appearance palette preview applies and, on leaving unsaved, restores the saved palette (Sandstone preview -> Harbor on nav-away); the route progress bar shows during navigation and hides on commit. tsc clean, eslint 0 problems, vitest 130/130. Co-Authored-By: Claude <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.
Final batch for #38 — takes the react-hooks warning count to zero and promotes the five React-Compiler-era rules from
warnto error so regressions are a CI failure.Fixes:
react-hooks/refs, ×2): the restore-theme-on-leave cleanup needs the latest saved settings + palette override but must fire only on unmount, so they were mirrored into refs during render. Now mirrored from an effect (refs belong outside render); the mount-only cleanup reads them unchanged — behaviour identical.immutability+preserve-manual-memoization, and a strayexhaustive-depsdisable):finishwas declared afterstartand referenced before declaration behind a lint-disable. Reordered it abovestartas a proper dependency, which clears both warnings and removes twoeslint-disablecomments. The route-commit effect now finishes on the next animation frame instead of synchronously — a genuine react-to-external-event (the router committed), and deferring keeps the 100%→fade paint from being coalesced into the route's own render.Endgame: the five rules (
refs,set-state-in-effect,static-components,immutability,preserve-manual-memoization) are nowerror, set explicitly so the CI gate is unambiguous; the burn-down comment block is gone.Verification — live on the demo stack:
tscclean ·eslint0 problems (rules at error) · vitest 130/130.Sequenced after #88 and #89. With this, #38 is fully resolved.
🤖 Generated with Claude Code