build(frontend): close the lint gaps the E32 audit measured

eslint now also enforces:
- the React Compiler diagnostics that `recommended` leaves out (todo,
  memo-dependencies and ten zero-hit tripwires);
- a description on every suppression, and no blanket disables;
- no focused or skipped tests (vitest and playwright);
- the typed pair no-floating-promises and no-deprecated.

Lint also covers e2e/ and the TypeScript build configs, which `eslint .`
had been skipping in silence.

Every hit is fixed or suppressed inline with a named reason:
- The 31 try statements the compiler cannot lower yet carry a suppression
  until S3 rewrites them. Five other compiler skips were plain fixes:
  a module counter bumped inside a hook, a ref read in a default
  parameter, and a local named like the <section> it renders.
- The real defects behind floating promises are fixed. ChatDock threw at
  nobody when the device key store could not be opened. VideoEditor's
  play() rejection went unhandled. loadYouTubeApi never rejected, so a
  blocked IFrame API left the player on an empty stage forever; it now
  fails on a script error or after 15 s, shows its own error with the
  way out, and lets the next open try again.
- MutableRefObject, FormEvent and lucide's deprecated brand icon are
  replaced. The YouTube glyph now lives in lib/brandIcons.
- The lint-probe harness lets its virtual file names into TypeScript's
  default project, so the contract tests still run the real config.
This commit is contained in:
2026-10-03 16:34:20 +02:00
parent 3c16012524
commit 471846d784
72 changed files with 938 additions and 216 deletions
+27 -24
View File
@@ -3,7 +3,6 @@ import {
useEffect,
useRef,
useState,
type MutableRefObject,
type RefObject,
type WheelEvent as ReactWheelEvent,
} from "react";
@@ -113,16 +112,23 @@ export function useControlsVisibility(opts: {
if (hideTimer.current) window.clearTimeout(hideTimer.current);
if (!barAutoHideRef.current) return; // per-user setting: never auto-hide the control bar
const wokeAt = Date.now();
const arm = (ms: number) => {
hideTimer.current = window.setTimeout(() => {
// Keep the controls up while the audio/subtitle menu is open, else it would vanish mid-choice.
if (videoRef.current?.paused || menuOpenRef.current || hovered.current) return;
const held = FOCUS_HOLD_MS - (Date.now() - wokeAt);
if (focused.current && held > 0) return arm(held);
setVisible(false);
}, ms);
};
arm(HIDE_MS);
// Keep the controls up while the audio/subtitle menu is open, else it would vanish mid-choice.
const busy = () => !!videoRef.current?.paused || menuOpenRef.current || hovered.current;
// Not a timer that re-arms itself: a self-calling `arm` read to the compiler's analysis as a
// value from outside this callback (memo-dependencies), and a self-naming function expression
// tripped one of its invariants. The focus hold re-arms at most once — the second timer fires
// when the hold is over, so it has only `busy` left to ask.
hideTimer.current = window.setTimeout(() => {
if (busy()) return;
const held = FOCUS_HOLD_MS - (Date.now() - wokeAt);
if (focused.current && held > 0) {
hideTimer.current = window.setTimeout(() => {
if (!busy()) setVisible(false);
}, held);
return;
}
setVisible(false);
}, HIDE_MS);
}, [barAutoHideRef, menuOpenRef, videoRef, setVisible]);
const show = useCallback(
(visible: boolean) => {
@@ -188,8 +194,8 @@ export function usePlexProgress(opts: {
id: string;
qc: QueryClient;
videoRef: RefObject<HTMLVideoElement | null>;
absRef: MutableRefObject<number>;
durationRef: MutableRefObject<number>;
absRef: RefObject<number>;
durationRef: RefObject<number>;
}): { settle: () => void; finish: (confirmed?: Promise<unknown>) => void } {
const { id, qc, videoRef, absRef, durationRef } = opts;
const settleRef = useRef<() => void>(() => {});
@@ -341,10 +347,7 @@ export function usePlexProgress(opts: {
* answer is where the session was ASKED to start. Anything that restarts the session "here" — an
* audio switch, an A/V offset, a keyboard seek — must use this: reading `abs` restarted a resume at
* 20:00 from 0:00, and the next checkpoint saved that (deep-review round 4). */
export function playhead(
absRef: MutableRefObject<number>,
loadStartRef: MutableRefObject<number>,
): number {
export function playhead(absRef: RefObject<number>, loadStartRef: RefObject<number>): number {
return absRef.current > 0 ? absRef.current : loadStartRef.current;
}
@@ -439,8 +442,8 @@ export function useAutoSkip(opts: {
}): {
activeMarker: PlexMarker | undefined;
skipProgress: number | null;
skipProgressRef: MutableRefObject<number | null>;
cancelAutoSkipRef: MutableRefObject<() => void>;
skipProgressRef: RefObject<number | null>;
cancelAutoSkipRef: RefObject<() => void>;
doSkip: (m: PlexMarker) => void;
} {
const {
@@ -594,12 +597,12 @@ export function usePlexTracks(opts: {
videoRef: RefObject<HTMLVideoElement | null>;
hlsRef: RefObject<Hls | null>;
multiAudioRef: RefObject<boolean>;
audioRef: MutableRefObject<number | null>;
aoffRef: MutableRefObject<number>;
absRef: MutableRefObject<number>;
audioRef: RefObject<number | null>;
aoffRef: RefObject<number>;
absRef: RefObject<number>;
/** The position the current (or still in-flight) session was ASKED to start at — written before
* the session request goes out, unlike `sessionK`, which only lands once it has answered. */
loadStartRef: MutableRefObject<number>;
loadStartRef: RefObject<number>;
}): {
audioOrd: number | null;
setAudioOrd: (ord: number | null) => void;
@@ -677,7 +680,7 @@ export function usePlexTracks(opts: {
}
} else {
// Single audio (or the session has not answered yet): re-map the track server-side.
loadSession(playhead(absRef, loadStartRef));
void loadSession(playhead(absRef, loadStartRef));
}
},
[loadSession, detail, patchPrefs, audioRef, multiAudioRef, hlsRef, absRef, loadStartRef],