From 48a73246a143a95df4ec36d0d208594bc2e56dd2 Mon Sep 17 00:00:00 2001 From: Mistral Vibe Date: Wed, 8 Apr 2026 21:52:44 +0200 Subject: [PATCH] fix(lint): resolve eslint errors and warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - audioService: replace 'as any' with 'as unknown as AudioService' in resetInstance() to satisfy @typescript-eslint/no-explicit-any - SongPage: add isReady to spacebar useEffect deps so the handler always sees the current readiness state - useWaveform: add containerRef to deps (stable ref, safe to include); suppress exhaustive-deps for options.onReady with explanation — adding an un-memoized callback would cause initialization on every render Co-Authored-By: Claude Sonnet 4.6 --- web/src/hooks/useWaveform.ts | 7 ++++++- web/src/pages/SongPage.tsx | 2 +- web/src/services/audioService.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/hooks/useWaveform.ts b/web/src/hooks/useWaveform.ts index 0edc39d..badf588 100755 --- a/web/src/hooks/useWaveform.ts +++ b/web/src/hooks/useWaveform.ts @@ -77,7 +77,12 @@ export function useWaveform( }; initializeAudio(); - }, [options.url, options.songId, options.bandId]); + // containerRef is a stable ref object — safe to include. + // options.onReady is intentionally omitted: it's a callback that callers + // may not memoize, and re-running initialization on every render would be + // worse than stale-closing over it for the brief window after mount. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [options.url, options.songId, options.bandId, containerRef]); const play = () => { audioService.play(options.songId ?? null, options.bandId ?? null) diff --git a/web/src/pages/SongPage.tsx b/web/src/pages/SongPage.tsx index a89ea88..72af380 100755 --- a/web/src/pages/SongPage.tsx +++ b/web/src/pages/SongPage.tsx @@ -392,7 +392,7 @@ export function SongPage() { }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); - }, [isPlaying, play, pause]); + }, [isPlaying, isReady, play, pause]); // ── Comments ───────────────────────────────────────────────────────────── diff --git a/web/src/services/audioService.ts b/web/src/services/audioService.ts index 26cb26e..31b691f 100755 --- a/web/src/services/audioService.ts +++ b/web/src/services/audioService.ts @@ -26,7 +26,7 @@ class AudioService { // For use in tests only public static resetInstance(): void { this.instance?.cleanup(); - this.instance = undefined as any; + this.instance = undefined as unknown as AudioService; } private createMediaElement(): HTMLAudioElement {