chore: clear the mechanical lint and type findings

Dead imports and locals removed, each blocks keyed, `any` narrowed to unknown.
Two context setters kept their calls and lost only the unused binding; the
settings redirect no longer awaits a parent whose data it discards. A leading
underscore now marks a binding that only holds a position.
This commit is contained in:
2026-08-17 17:55:21 -04:00
parent 428168c07a
commit 3a29294f96
36 changed files with 76 additions and 91 deletions
@@ -1,7 +1,7 @@
<script lang="ts">
import BookDelete from '$lib/components/forms/book-delete.svelte';
import { BookEdit } from '$lib/components/forms/edit-book';
import { getBookOperationsState, setBookOperationsState } from '$lib/state/bookOperations.svelte';
import { getBookOperationsState } from '$lib/state/bookOperations.svelte';
import { getLibraryState } from '$lib/state/library.svelte';
import { setBookSelectionState } from '$lib/state/bookSelection.svelte';
import type { Snippet } from 'svelte';
@@ -28,22 +28,16 @@
import { getBookOperationsState } from '$lib/state/bookOperations.svelte.js';
import { getBookshelfState } from '$lib/state/bookshelf.svelte.js';
import { getLibraryState } from '$lib/state/library.svelte.js';
import { Progress } from '$lib/components/ui/progress/index.js';
import * as Accordion from '$lib/components/ui/accordion/index.js';
import * as Table from '$lib/components/ui/table/index.js';
import * as AlertDialog from '$lib/components/ui/alert-dialog/index.js';
import ShelfCreateDialog from '$lib/components/forms/shelf-create-dialog.svelte';
import { untrack } from 'svelte';
let { data } = $props();
// Seeded once, then kept in sync by the effect below — untrack says so
// explicitly rather than capturing the initial value and warning about it.
let book = $state(untrack(() => data.book));
$effect(() => {
book = data.book;
});
// Follows the loaded book, and stays assignable so an edit can update it locally
// until the next navigation supplies a fresh one.
let book = $derived(data.book);
const bookOps = getBookOperationsState();
const libraryState = getLibraryState();
+2 -4
View File
@@ -1,9 +1,7 @@
<script lang="ts">
import { listBookshelves } from '$lib/api';
import AppSidebar from '$lib/components/layout/app-sidebar.svelte';
import SiteHeader from '$lib/components/layout/site-header.svelte';
import UploadTray from '$lib/components/layout/upload-tray.svelte';
import { Loading } from '$lib/components/ui/command';
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
import type { Library, PaginatedResponse } from '$lib/schema';
import { setBookOperationsState } from '$lib/state/bookOperations.svelte';
@@ -28,8 +26,8 @@
// init. `untrack` says that explicitly, instead of silently capturing the
// initial value and warning about it.
const libraryState = setLibraryState(untrack(() => data.libraries.items));
const bookshelfState = setBookshelfState();
const bookOps = setBookOperationsState(libraryState.activeLibrary!.id);
setBookshelfState();
setBookOperationsState(libraryState.activeLibrary!.id);
const theme = setThemeState(untrack(() => data.theme));
// Set here rather than beside the upload dialog so a running import survives
@@ -41,7 +41,7 @@
of libraries; the row above it is overflow-hidden, so without this a
long list is clipped rather than reachable. -->
<nav class="flex w-48 shrink-0 flex-col gap-1 overflow-y-auto">
{#each items as item}
{#each items as item (item.routeId)}
<a
href={resolve(item.routeId)}
class="rounded-md px-3 py-2 text-sm font-medium transition-colors hover:bg-muted {page
+1 -3
View File
@@ -1,8 +1,6 @@
import { redirect } from '@sveltejs/kit';
export async function load({ parent }) {
const { libraries } = await parent();
export async function load() {
// Immediately redirect to the account settings
redirect(303, `/settings/account`);
}
@@ -130,7 +130,7 @@
</Table.Row>
</Table.Header>
<Table.Body>
{#each data.devices as device}
{#each data.devices as device (device.id)}
{@const isVisible = visibleApiKeys.has(String(device.id))}
<Table.Row class="h-14">
<Table.Cell class="pl-4 font-medium">
@@ -31,7 +31,7 @@
</Table.Row>
</Table.Header>
<Table.Body>
{#each libraryState.libraries as library}
{#each libraryState.libraries as library (library.id)}
<Table.Row class="h-14">
<Table.Cell class="w-16 pl-4 text-center text-lg font-semibold"
>{library.name[0]}</Table.Cell
+1 -1
View File
@@ -137,7 +137,7 @@ export const DELETE: RequestHandler = async ({ params, locals, fetch, request, u
const headers = prepareRequest(locals, request);
// DELETE may or may not have a body
let options: RequestInit = {
const options: RequestInit = {
method: 'DELETE',
headers
};
-2
View File
@@ -1,9 +1,7 @@
<script lang="ts">
import { replaceState } from '$app/navigation';
import LoginForm from '$lib/components/forms/login-form.svelte';
import SignupForm from '$lib/components/forms/signup-form.svelte';
import * as Tabs from '$lib/components/ui/tabs/index.js';
import { redirect } from '@sveltejs/kit';
let tabValue = $state('login');
</script>