From 3a2c18bbeb3fb6c719acaa0ea31b321d1523c08a Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Sun, 13 Sep 2026 17:36:14 +0100 Subject: [PATCH] fix: repair defects surfaced by gating CI on lint and typecheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `npm run check` reported 15 errors and `npm run lint` 20, all pre-existing, so neither gate could pass. Fixing them turned up three real bugs: - SignOut destructured `{ error }` off `.then(() => {})`, which resolves to undefined, so every sign-out threw a TypeError - after the signed-out event had already been emitted. Sign-out also left the user on the protected page they were on, still showing its content; it now returns them to the home page and re-runs the server loads. - SignUp passed `redirectTo`, which is not a signUp option and was silently ignored, so the confirmation link has always used Supabase's configured site URL. Documented rather than changed, since pointing it elsewhere needs an absolute allow-listed URL. - The Pokédex page tracked totalRecordsCreated but never passed it to the box view, so the "Processed N entries so far" progress message never rendered. The rest is typing and dead code: cookie callback parameters in hooks.server.ts and +layout.ts, the untyped supabase props, a query-builder type that made PostgREST rows untyped downstream, an unused session destructure, and `while (true)` paging loops rewritten as `for (;;)`. --- src/hooks.server.ts | 7 +++--- src/lib/components/Pagination.svelte | 4 ++-- src/lib/components/SignIn.svelte | 3 ++- src/lib/components/SignOut.svelte | 16 +++++++++----- src/lib/components/SignUp.svelte | 12 +++++----- .../pokedex/PokedexViewBoxes.svelte | 10 ++++----- .../repositories/CombinedDataRepository.ts | 6 ++--- .../PokedexExportIntegrationRepository.ts | 18 ++++++++++----- src/lib/utils/auth.ts | 8 +++---- src/lib/utils/boxPlacement.ts | 1 - src/routes/+layout.ts | 2 +- src/routes/+page.svelte | 11 ++-------- src/routes/pokedex/[id]/+page.svelte | 22 +++++++------------ 13 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 6d6e55e..21cb307 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,21 +1,22 @@ import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; import { createServerClient } from '@supabase/ssr'; import type { Handle } from '@sveltejs/kit'; +import type { CookieSerializeOptions } from 'cookie'; export const handle: Handle = async ({ event, resolve }) => { event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, { cookies: { - get: (key) => event.cookies.get(key), + get: (key: string) => event.cookies.get(key), /** * Note: You have to add the `path` variable to the * set and remove method due to sveltekit's cookie API * requiring this to be set, setting the path to an empty string * will replicate previous/standard behaviour (https://kit.svelte.dev/docs/types#public-types-cookies) */ - set: (key, value, options) => { + set: (key: string, value: string, options: CookieSerializeOptions) => { event.cookies.set(key, value, { ...options, path: '/' }); }, - remove: (key, options) => { + remove: (key: string, options: CookieSerializeOptions) => { event.cookies.delete(key, { ...options, path: '/' }); } } diff --git a/src/lib/components/Pagination.svelte b/src/lib/components/Pagination.svelte index 00448ed..34725be 100644 --- a/src/lib/components/Pagination.svelte +++ b/src/lib/components/Pagination.svelte @@ -11,8 +11,8 @@ currentPage = Math.max(currentPage - 1, 1); } - function setItemsPerPage(event: any) { - itemsPerPage = parseInt(event.target.value, 10); + function setItemsPerPage(event: Event) { + itemsPerPage = parseInt((event.target as HTMLSelectElement).value, 10); } diff --git a/src/lib/components/SignIn.svelte b/src/lib/components/SignIn.svelte index 333ae56..2260d00 100644 --- a/src/lib/components/SignIn.svelte +++ b/src/lib/components/SignIn.svelte @@ -1,4 +1,5 @@ diff --git a/src/lib/components/SignUp.svelte b/src/lib/components/SignUp.svelte index 19ceab8..1d010a4 100644 --- a/src/lib/components/SignUp.svelte +++ b/src/lib/components/SignUp.svelte @@ -1,4 +1,5 @@ @@ -599,7 +593,6 @@ {#if pokedex.description}

{pokedex.description}

{/if} - @@ -637,6 +630,7 @@ bind:combinedData bind:boxNumbers bind:creatingRecords + {totalRecordsCreated} bind:failedToLoad {markBoxAsNotCaught} {markBoxAsCaught}