From dd7aa4b0443f77531d630b4bf543c435aea299f7 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Mon, 26 Jan 2026 11:29:51 -0500 Subject: [PATCH] [FA-misc] Resolve lint issues --- .../components/AddToReadingListButton.svelte | 19 +++++++++---------- .../chapters/[chapterNumber].astro | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fictionarchive-web-astro/src/lib/components/AddToReadingListButton.svelte b/fictionarchive-web-astro/src/lib/components/AddToReadingListButton.svelte index 2d52567..81154f6 100644 --- a/fictionarchive-web-astro/src/lib/components/AddToReadingListButton.svelte +++ b/fictionarchive-web-astro/src/lib/components/AddToReadingListButton.svelte @@ -33,10 +33,10 @@ let error: string | null = $state(null); // Track which lists the novel is in (by list ID) - let novelInLists = $state(new SvelteSet()); + let novelInLists = new SvelteSet(); // Track loading state for individual list toggles - let loadingListIds = $state(new SvelteSet()); + let loadingListIds = new SvelteSet(); // Quick-create state let showQuickCreate = $state(false); @@ -75,13 +75,12 @@ if (result.data) { readingLists = result.data.readingLists; // Build the set of list IDs that contain this novel - const inLists = new SvelteSet(); + novelInLists.clear(); for (const list of readingLists) { if (list.items.some((item) => item.novelId === novelId)) { - inLists.add(list.id); + novelInLists.add(list.id); } } - novelInLists = inLists; } } catch (e) { error = e instanceof Error ? e.message : 'Failed to load reading lists'; @@ -92,7 +91,7 @@ async function toggleNovelInList(listId: number) { const isInList = novelInLists.has(listId); - loadingListIds = new SvelteSet([...loadingListIds, listId]); + loadingListIds.add(listId); try { if (isInList) { @@ -115,7 +114,7 @@ if (result.data?.removeFromReadingList?.readingListPayload?.success) { // Update local state - novelInLists = new SvelteSet([...novelInLists].filter((id) => id !== listId)); + novelInLists.delete(listId); // Update item count in list readingLists = readingLists.map((list) => list.id === listId @@ -143,7 +142,7 @@ if (result.data?.addToReadingList?.readingListPayload?.success) { // Update local state - novelInLists = new SvelteSet([...novelInLists, listId]); + novelInLists.add(listId); // Update item count in list readingLists = readingLists.map((list) => list.id === listId @@ -159,7 +158,7 @@ } catch (e) { error = e instanceof Error ? e.message : 'An error occurred'; } finally { - loadingListIds = new SvelteSet([...loadingListIds].filter((id) => id !== listId)); + loadingListIds.delete(listId); } } @@ -218,7 +217,7 @@ items: [{ novelId, order: 0, addedTime: new Date().toISOString() }] }; readingLists = [...readingLists, fullNewList]; - novelInLists = new SvelteSet([...novelInLists, newList.id]); + novelInLists.add(newList.id); // Reset quick-create form showQuickCreate = false; diff --git a/fictionarchive-web-astro/src/pages/novels/[id]/volumes/[volumeOrder]/chapters/[chapterNumber].astro b/fictionarchive-web-astro/src/pages/novels/[id]/volumes/[volumeOrder]/chapters/[chapterNumber].astro index 923c6c8..55277bf 100644 --- a/fictionarchive-web-astro/src/pages/novels/[id]/volumes/[volumeOrder]/chapters/[chapterNumber].astro +++ b/fictionarchive-web-astro/src/pages/novels/[id]/volumes/[volumeOrder]/chapters/[chapterNumber].astro @@ -35,7 +35,7 @@ if (token) { } else { const result = await response.json(); - if (result.errors?.some((e: any) => e.extensions?.code === 'AUTH_NOT_AUTHENTICATED')) { + if (result.errors?.some((e: { extensions?: { code?: string } }) => e.extensions?.code === 'AUTH_NOT_AUTHENTICATED')) { authFailed = true; } else if (result.data?.chapter) { chapter = result.data.chapter;