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:
@@ -26,7 +26,9 @@ describe("useControlsVisibility", () => {
|
||||
it("hides 3 s after the last activity while playing", () => {
|
||||
const { result } = setup();
|
||||
act(() => result.current.wake());
|
||||
act(() => vi.advanceTimersByTime(3000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(result.current.uiVisible).toBe(false);
|
||||
});
|
||||
|
||||
@@ -36,16 +38,45 @@ describe("useControlsVisibility", () => {
|
||||
result.current.wake();
|
||||
result.current.holdOnHover(true);
|
||||
});
|
||||
act(() => vi.advanceTimersByTime(10_000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(10_000);
|
||||
});
|
||||
expect(result.current.uiVisible).toBe(true);
|
||||
|
||||
act(() => result.current.holdOnHover(false));
|
||||
act(() => vi.advanceTimersByTime(2900));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(2900);
|
||||
});
|
||||
expect(result.current.uiVisible).toBe(true); // a fresh 3 s from the leave, not from the wake
|
||||
act(() => vi.advanceTimersByTime(100));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(100);
|
||||
});
|
||||
expect(result.current.uiVisible).toBe(false);
|
||||
});
|
||||
|
||||
// E28 E6 / round 2 P4: a keyboard focus in the chrome holds the bar — but only for FOCUS_HOLD_MS
|
||||
// after the last key, not for the whole film. The 3 s timer finds the hold, re-arms for what is
|
||||
// left of it, and hides once it is over (E32 rewrote that re-arm without recursion).
|
||||
it("holds for a keyboard focus until 10 s after the last key, then hides", () => {
|
||||
const { result } = setup();
|
||||
act(() => {
|
||||
result.current.holdOnFocus(true);
|
||||
result.current.wake();
|
||||
});
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(result.current.uiVisible).toBe(true); // the hold, not the 3 s
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(6900);
|
||||
});
|
||||
expect(result.current.uiVisible).toBe(true); // 9.9 s after the key
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(100);
|
||||
});
|
||||
expect(result.current.uiVisible).toBe(false); // the hold is over, focus or not
|
||||
});
|
||||
|
||||
// C3: on touch nothing moves a mouse, so a tap toggles the bar and playback arms the timer.
|
||||
it("toggle hides a shown bar at once and shows a hidden one", () => {
|
||||
const { result } = setup();
|
||||
|
||||
Reference in New Issue
Block a user