From 0740d53d375bb8c1b23034bcb8d9f429f9380d0c Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 19 Oct 2025 12:27:19 +0200 Subject: [PATCH] fix: resolve all linter warnings - Add proper types (Filter, NostrEvent) to readingProgressController - Add eslint-disable comment for position dependency in useReadingPosition (position is derived from scroll and including it would cause infinite re-renders) - All lint warnings resolved - TypeScript type checks pass --- src/hooks/useReadingPosition.ts | 2 ++ src/services/readingProgressController.ts | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hooks/useReadingPosition.ts b/src/hooks/useReadingPosition.ts index bb635089..00531ff0 100644 --- a/src/hooks/useReadingPosition.ts +++ b/src/hooks/useReadingPosition.ts @@ -148,6 +148,8 @@ export const useReadingPosition = ({ clearTimeout(saveTimerRef.current) } } + // position is intentionally not in deps - it's computed from scroll and would cause infinite re-renders + // eslint-disable-next-line react-hooks/exhaustive-deps }, [enabled, onPositionChange, onReadingComplete, readingCompleteThreshold, scheduleSave]) // Reset reading complete state when enabled changes diff --git a/src/services/readingProgressController.ts b/src/services/readingProgressController.ts index c1d0043f..6fec89f8 100644 --- a/src/services/readingProgressController.ts +++ b/src/services/readingProgressController.ts @@ -1,5 +1,6 @@ import { RelayPool } from 'applesauce-relay' import { IEventStore } from 'applesauce-core' +import { Filter, NostrEvent } from 'nostr-tools' import { queryEvents } from './dataFetch' import { KINDS } from '../config/kinds' import { RELAYS } from '../config/relays' @@ -134,7 +135,7 @@ class ReadingProgressController { const needsFullSync = force || this.currentProgressMap.size === 0 const lastSynced = needsFullSync ? null : this.getLastSyncedAt(pubkey) - const filter: any = { + const filter: Filter = { kinds: [KINDS.ReadingProgress], authors: [pubkey] } @@ -179,7 +180,7 @@ class ReadingProgressController { /** * Process events and update progress map */ - private processEvents(events: any[]): void { + private processEvents(events: NostrEvent[]): void { console.log('[progress] 🔄 Processing', events.length, 'events') const readsMap = new Map()