From 9f9c9027a3fef31198c3d8db54240a1915e0ecbb Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 17 Jun 2026 18:06:56 +0000 Subject: [PATCH] fix(app): clear lint warnings breaking EAS deploy (--max-warnings 0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The App Deploy (EAS) workflow runs `npm run lint` (eslint --max-warnings 0) and failed on three warnings introduced by the review changes: - useChapterData.ts: synchronous setIsLoading(false) in the no-bookId effect branch tripped react-hooks/set-state-in-effect — disabled inline, matching how the rest of the codebase handles intentional cases. - useDifficultPassages.ts: the cleanup mutates the live genRef.current to invalidate an in-flight load, which react-hooks/exhaustive-deps flags as a ref-in-cleanup risk; the live ref is intentional here — disabled inline with a rationale comment. - connectivity.ts: removed the now-unused _polling flag (the start guard is _started after the duplicate-listener fix), clearing no-unused-vars. These surfaced on master because EAS deploy's lint gate uses --max-warnings 0. npm run lint, tsc, and the affected tests are all green. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01LjYFnGX1vcGk4h5Lz3xmng --- app/src/hooks/useChapterData.ts | 1 + app/src/hooks/useDifficultPassages.ts | 5 ++++- app/src/services/connectivity.ts | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/hooks/useChapterData.ts b/app/src/hooks/useChapterData.ts index 5ab04ce5..3882bd0e 100644 --- a/app/src/hooks/useChapterData.ts +++ b/app/src/hooks/useChapterData.ts @@ -45,6 +45,7 @@ export function useChapterData(bookId: string | null, chapterNum: number): Chapt if (!bookId) { // No book to load: clear the initial loading flag so consumers can // render a not-found/empty state instead of an indefinite skeleton. + // eslint-disable-next-line react-hooks/set-state-in-effect setIsLoading(false); return; } diff --git a/app/src/hooks/useDifficultPassages.ts b/app/src/hooks/useDifficultPassages.ts index bc57f000..9b1f5106 100644 --- a/app/src/hooks/useDifficultPassages.ts +++ b/app/src/hooks/useDifficultPassages.ts @@ -289,7 +289,10 @@ export function useDifficultPassage(passageId: string | undefined): DifficultPas useEffect(() => { // eslint-disable-next-line react-hooks/set-state-in-effect loadData(); - // Invalidate any in-flight load on unmount / passageId change. + // Invalidate any in-flight load on unmount / passageId change. We + // intentionally mutate the live ref here (not a copied value) so a load + // still in flight sees the bumped generation and drops its result. + // eslint-disable-next-line react-hooks/exhaustive-deps return () => { genRef.current++; }; }, [loadData]); diff --git a/app/src/services/connectivity.ts b/app/src/services/connectivity.ts index 21a385fe..5bafaf1c 100644 --- a/app/src/services/connectivity.ts +++ b/app/src/services/connectivity.ts @@ -16,7 +16,6 @@ type Listener = (connected: boolean) => void; let _connected = true; const _listeners = new Set(); let _started = false; -let _polling = false; let _pollTimer: ReturnType | null = null; let _netinfoUnsub: (() => void) | null = null; @@ -79,7 +78,6 @@ export function startMonitoring(): void { // Polling fallback: check reachability every 15 seconds. // Require two consecutive failures before marking offline so a single // slow/blocked fetch on startup doesn't flash the banner incorrectly. - _polling = true; let _consecutiveFails = 0; const check = async () => { try { @@ -116,7 +114,6 @@ export function stopMonitoring(): void { clearInterval(_pollTimer); _pollTimer = null; } - _polling = false; _started = false; _listeners.clear(); }