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:
@@ -219,7 +219,9 @@ describe("a tap on the picture (C3)", () => {
|
||||
video()._paused = true;
|
||||
act(() => void video().play());
|
||||
expect(bandHidden()).toBe(false);
|
||||
act(() => vi.advanceTimersByTime(3000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -247,10 +249,14 @@ describe("keyboard focus in the bands", () => {
|
||||
fireEvent.keyDown(document.body, { key: "Tab" }); // the keyboard is in use: focus shows
|
||||
act(() => vol.focus());
|
||||
fireEvent.keyDown(vol, { key: "ArrowUp" });
|
||||
act(() => vi.advanceTimersByTime(5000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(5000);
|
||||
});
|
||||
expect(bandHidden()).toBe(false);
|
||||
act(() => vol.blur());
|
||||
act(() => vi.advanceTimersByTime(3000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -264,9 +270,13 @@ describe("keyboard focus in the bands", () => {
|
||||
fireEvent.keyDown(document.body, { key: "Tab" });
|
||||
act(() => vol.focus());
|
||||
fireEvent.keyDown(vol, { key: "ArrowUp" });
|
||||
act(() => vi.advanceTimersByTime(9000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(9000);
|
||||
});
|
||||
expect(bandHidden()).toBe(false);
|
||||
act(() => vi.advanceTimersByTime(1500));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(1500);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
expect(document.activeElement).toBe(vol);
|
||||
fireEvent.keyDown(vol, { key: "ArrowUp" });
|
||||
@@ -283,7 +293,9 @@ describe("keyboard focus in the bands", () => {
|
||||
fireEvent.keyDown(document.body, { key: "Tab" });
|
||||
act(() => mute.focus());
|
||||
fireEvent.keyDown(mute, { key: "ArrowUp" });
|
||||
act(() => vi.advanceTimersByTime(10_500));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(10_500);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
const pauses = pause.mock.calls.length;
|
||||
// prevented: the unseen Mute is not pressed on keyup
|
||||
@@ -304,7 +316,9 @@ describe("keyboard focus in the bands", () => {
|
||||
fireEvent.keyDown(document.body, { key: "Tab" });
|
||||
act(() => mute.focus());
|
||||
fireEvent.keyDown(mute, { key: "ArrowUp" });
|
||||
act(() => vi.advanceTimersByTime(10_500));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(10_500);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
const pauses = pause.mock.calls.length;
|
||||
expect(fireEvent.keyDown(mute, { key: "Enter" })).toBe(false);
|
||||
@@ -325,7 +339,9 @@ describe("keyboard focus in the bands", () => {
|
||||
fireEvent.keyDown(document.body, { key: "Tab" });
|
||||
act(() => mute.focus());
|
||||
fireEvent.keyDown(mute, { key: "ArrowUp" });
|
||||
act(() => vi.advanceTimersByTime(10_500));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(10_500);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
expect(fireEvent.keyDown(mute, { key })).toBe(false);
|
||||
const toggles = pause.mock.calls.length + play.mock.calls.length;
|
||||
@@ -352,7 +368,9 @@ describe("keyboard focus in the bands", () => {
|
||||
const skip = screen.getByRole("button", { name: /plex\.player\.skipIntro/ });
|
||||
fireEvent.keyDown(document.body, { key: "Tab" });
|
||||
act(() => skip.focus());
|
||||
act(() => vi.advanceTimersByTime(10_500));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(10_500);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
const pauses = pause.mock.calls.length;
|
||||
// not prevented: the button's own activation runs, and Space does not pause the film instead
|
||||
@@ -377,7 +395,9 @@ describe("keyboard focus in the bands", () => {
|
||||
return sel === ":focus-visible" ? false : matches.call(this, sel);
|
||||
});
|
||||
act(() => btn.focus());
|
||||
act(() => vi.advanceTimersByTime(3000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(bandHidden()).toBe(true);
|
||||
act(() => btn.blur()); // the tap on the picture takes the focus first…
|
||||
pressPicture("touch"); // …then toggles
|
||||
@@ -428,7 +448,9 @@ describe("a double-tap on a side third skips 10 s (C5)", () => {
|
||||
pressPicture("touch", 450); // reveal
|
||||
expect(bandHidden()).toBe(false);
|
||||
expect(band()).toContain("pointer-events-none");
|
||||
act(() => vi.advanceTimersByTime(300));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(300);
|
||||
});
|
||||
expect(band()).not.toContain("pointer-events-none");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user