refactor(ui): every function compiles under the React Compiler but VirtualGrid, and react-hooks/refs is on
E32 S4 — the burn-down from 29 skipped functions to 1: - try/finally (26 sites): the cleanup runs after a try/catch; steps that return early moved into their own function (push, the setup wizard's next, the share page's unlock). - A conditional, loop or optional call inside a try skips the function too, and react-hooks/todo does not see it: the value is computed before the try, or the try lives in a module-level helper (config writes, clip queueing, clipboard, frame counts, seekable end, YouTube player times). - The two exhaustive-deps suppressions are gone. useYtProgress takes its per-item snapshot through one effect event, read once when the player is built; PlexPlayer's unmount relies on the leaving-the-item cleanup for the generation bump it duplicated. - What the skips hid: PlexPlayer's 17 render-phase ref writes (useLatest), its tracks popover alias, the loadSession self-reference (declared early, set after commit); PlayerModal's session-position read during render (now where the player starts), navRef/modeRef writes, and a description helper that ran a ref-carrying callback during render (now PlayerDescription); SavedViewsProvider's latest-cfg ref, and its setState in the seed effect (preferSticky now prefers the starred default among same-filter views, so the seed needs no sticky write — test seen red on the old helper). - A store's hook was called `use()`, which the compiler does not know as a hook: inside the newly compiled usePlaylistActions it was memoized, ran on the first render alone, and the playlist rail threw "rendered fewer hooks" on its second render. Renamed to `useValue()` everywhere; the old contract test claimed the call was safe inside any `use…` function, which was false — replaced by a render test that is red under the old name. - PlexPlayer's palette ref was written and never read since the Backspace guard moved to the layer stack: removed. react-hooks/refs is back at error with no exception. The ratchet lists only VirtualGrid (IncompatibleLibrary) and pins both players as compiled. No size or complexity ceiling was raised.
This commit is contained in:
+14
-26
@@ -542,9 +542,10 @@ export default tseslint.config(
|
||||
// The React Compiler's own diagnostics that `recommended` leaves out (E32). Each is a function
|
||||
// the compiler SKIPS, silently — `panicThreshold` is "none" and there is no logger, so a lint
|
||||
// error is the only place the skip is said out loud. `todo` is the compiler's "cannot lower
|
||||
// this shape yet" (31 try statements, each suppressed inline until E32 S3 rewrites them); the
|
||||
// rest had 0 hits when switched on and are tripwires. The full per-function picture is
|
||||
// components/compilerCoverage.contract.test.ts.
|
||||
// this shape yet" (E32 S4 rewrote all 31 try statements it found); the rest had 0 hits when
|
||||
// switched on and are tripwires. `todo` does NOT see every such shape — a conditional, a loop
|
||||
// or an optional call inside a try skips the function with no lint hit at all — so the full
|
||||
// per-function picture is components/compilerCoverage.contract.test.ts.
|
||||
"react-hooks/todo": "error",
|
||||
"react-hooks/memo-dependencies": "error",
|
||||
"react-hooks/rule-suppression": "error",
|
||||
@@ -558,30 +559,17 @@ export default tseslint.config(
|
||||
"react-hooks/exhaustive-effect-dependencies": "error",
|
||||
"react-hooks/no-deriving-state-in-effects": "error",
|
||||
// eslint-plugin-react-hooks 7's `recommended` is no longer two rules — it carries the whole
|
||||
// React Compiler rule set (E27 S1). On this codebase that landed 283 findings, and they were
|
||||
// triaged rather than bulk-suppressed, because the two answers are different:
|
||||
// React Compiler rule set (E27 S1). On this codebase that landed 283 findings. 66 were fixed or
|
||||
// suppressed inline, each naming its invariant; there is DELIBERATELY no suppressions file — a
|
||||
// bulk `--suppress-all` would hide the next violation instead of answering it.
|
||||
//
|
||||
// react-hooks/refs 217 — OFF, see below.
|
||||
// the other 66 — real. They went into eslint-suppressions.json as a ratchet for one
|
||||
// sprint and E27 S2 burned the file down to nothing: what survives is
|
||||
// an inline directive at the site, each naming the invariant it
|
||||
// protects. There is DELIBERATELY no suppressions file any more — a
|
||||
// bulk `--suppress-all` would hide the next violation instead of
|
||||
// answering it, and it cannot hold a warning-level rule anyway.
|
||||
//
|
||||
// `refs` is OFF — the one rule here switched off while it has real hits, and recorded as such
|
||||
// in docs/gates.md. E27 turned it off calling 153 of its 217 hits false positives (the popover
|
||||
// engine's `pop.refs.setReference` / `getReferenceProps()`, a popover handle passed as a prop)
|
||||
// and the other ~64 real render-phase `someRef.current = x` writes. The E32 audit showed the
|
||||
// triage was wrong: the rule and the React Compiler share one analysis, so every one of those
|
||||
// "false positives" is a component the compiler SKIPS — 21 popover components among them, and
|
||||
// Channels' 0.9 s row menu was the bill. It stays off only because 245 hits (measured E32 S1)
|
||||
// could not be fixed in one sprint. E32 S3 took them to 31: the popover engine is read through
|
||||
// destructuring (`const { setReference } = pop.refs`), every render-phase write moved to
|
||||
// `useEffectEvent` / `useLatest`. The rest sit in PlexPlayer and PlayerModal, behind the
|
||||
// try/finally and suppression skips; until they are gone, compilerCoverage.contract.test.ts pins
|
||||
// every skipped function (none may be added), and this comes back on.
|
||||
"react-hooks/refs": "off",
|
||||
// `refs` (the other 217) was switched OFF in E27 as mostly false positives, and that triage was
|
||||
// wrong: the rule and the React Compiler share one analysis, so every hit was a function the
|
||||
// compiler SKIPS — 21 popover components among them, and Channels' 0.9 s row menu was the bill
|
||||
// (E32). E32 S3–S4 fixed every site (245 measured) instead of narrowing the rule: the popover
|
||||
// engine is read through destructuring, render-phase ref writes became `useEffectEvent` /
|
||||
// `useLatest`. It is on, at error, with no exception.
|
||||
"react-hooks/refs": "error",
|
||||
"local/jsx-comment-text": "error",
|
||||
"local/focus-safe-disabled": "error",
|
||||
"local/button-primitive": "error",
|
||||
|
||||
Reference in New Issue
Block a user