lint: remove unused imports, variables, and dead code (10 fixes)

Co-Authored-By: Justin Edmund <justin@jedmund.com>
This commit is contained in:
Devin AI 2025-11-23 14:30:57 +00:00
parent 3e2336bc5c
commit 018fc67b2c
6 changed files with 5 additions and 47 deletions

View file

@ -8,7 +8,7 @@ export interface AutoSaveStoreOptions<TPayload, TResponse = unknown> {
onSaved?: (res: TResponse, ctx: { prime: (payload: TPayload) => void }) => void
}
export interface AutoSaveStore<TPayload, TResponse = unknown> {
export interface AutoSaveStore<TPayload> {
readonly status: AutoSaveStatus
readonly lastError: string | null
schedule: () => void
@ -36,7 +36,7 @@ export interface AutoSaveStore<TPayload, TResponse = unknown> {
*/
export function createAutoSaveStore<TPayload, TResponse = unknown>(
opts: AutoSaveStoreOptions<TPayload, TResponse>
): AutoSaveStore<TPayload, TResponse> {
): AutoSaveStore<TPayload> {
const debounceMs = opts.debounceMs ?? 2000
const idleResetMs = opts.idleResetMs ?? 2000
let timer: ReturnType<typeof setTimeout> | null = null

View file

@ -187,7 +187,7 @@
})
if (response.ok) {
const result = await response.json()
await response.json()
toast.success(`Cleared cache for "${album.name}"`)
} else {
toast.error(`Failed to clear cache for "${album.name}"`)

View file

@ -1,5 +1,4 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { z } from 'zod'
import AdminPage from './AdminPage.svelte'
import AdminSegmentedControl from './AdminSegmentedControl.svelte'
@ -9,7 +8,6 @@
import UnifiedMediaModal from './UnifiedMediaModal.svelte'
import SmartImage from '../SmartImage.svelte'
import Composer from './composer'
import { toast } from '$lib/stores/toast'
import type { Album, Media } from '@prisma/client'
import type { JSONContent } from '@tiptap/core'
@ -33,8 +31,6 @@
// State
let isLoading = $state(mode === 'edit')
let isSaving = $state(false)
let validationErrors = $state<Record<string, string>>({})
let showBulkAlbumModal = $state(false)
let albumMedia = $state<Array<{ media: Media; displayOrder: number }>>([])
let editorInstance = $state<{ save: () => Promise<JSONContent>; clear: () => void } | undefined>()
@ -123,30 +119,6 @@
}
}
function validateForm() {
try {
albumSchema.parse({
title: formData.title,
slug: formData.slug,
location: formData.location || undefined,
year: formData.year || undefined
})
validationErrors = {}
return true
} catch (err) {
if (err instanceof z.ZodError) {
const errors: Record<string, string> = {}
err.errors.forEach((e) => {
if (e.path[0]) {
errors[e.path[0].toString()] = e.message
}
})
validationErrors = errors
}
return false
}
}
async function handleBulkAlbumSave() {
// Reload album to get updated photo count
if (album && mode === 'edit') {
@ -200,8 +172,6 @@
bind:value={formData.title}
placeholder="Album title"
required
error={validationErrors.title}
disabled={isSaving}
/>
<Input
@ -209,8 +179,7 @@
bind:value={formData.slug}
placeholder="url-friendly-name"
required
error={validationErrors.slug}
disabled={isSaving || mode === 'edit'}
disabled={mode === 'edit'}
/>
<div class="form-grid">
@ -218,16 +187,12 @@
label="Location"
bind:value={formData.location}
placeholder="e.g. Tokyo, Japan"
error={validationErrors.location}
disabled={isSaving}
/>
<Input
label="Year"
type="text"
bind:value={formData.year}
placeholder="e.g. 2023 or 2023-2025"
error={validationErrors.year}
disabled={isSaving}
/>
</div>
@ -235,7 +200,6 @@
label="Status"
bind:value={formData.status}
options={statusOptions}
disabled={isSaving}
/>
</div>
@ -245,7 +209,6 @@
<input
type="checkbox"
bind:checked={formData.showInUniverse}
disabled={isSaving}
class="toggle-input"
/>
<div class="toggle-content">
@ -302,7 +265,6 @@
bind:data={formData.content}
placeholder="Add album content..."
onChange={handleContentUpdate}
editable={!isSaving}
albumId={album?.id}
variant="full"
/>

View file

@ -2,7 +2,6 @@
import { onMount } from 'svelte'
import { clickOutside } from '$lib/actions/clickOutside'
import Input from './Input.svelte'
import FormField from './FormField.svelte'
import Button from './Button.svelte'
export interface MetadataField {

View file

@ -30,7 +30,6 @@
aspectRatio,
required = false,
error,
allowAltText = true,
maxFileSize = 10,
placeholder = 'Drag and drop an image here, or click to browse',
helpText,

View file

@ -3,12 +3,10 @@
import Modal from './Modal.svelte'
import Composer from './composer'
import AdminSegmentedControl from './AdminSegmentedControl.svelte'
import FormField from './FormField.svelte'
import Button from './Button.svelte'
import Input from './Input.svelte'
import UnifiedMediaModal from './UnifiedMediaModal.svelte'
import MediaDetailsModal from './MediaDetailsModal.svelte'
import SmartImage from '../SmartImage.svelte'
import type { JSONContent } from '@tiptap/core'
import type { Media } from '@prisma/client'