lint: remove unused imports and variables in admin components (15 fixes)

Co-Authored-By: Justin Edmund <justin@jedmund.com>
This commit is contained in:
Devin AI 2025-11-24 05:29:32 +00:00
parent 0bdbd26deb
commit 2df4819fef
3 changed files with 6 additions and 17 deletions

View file

@ -10,7 +10,7 @@
import { makeDraftKey, saveDraft, loadDraft, clearDraft, timeAgo } from '$lib/admin/draftStore' import { makeDraftKey, saveDraft, loadDraft, clearDraft, timeAgo } from '$lib/admin/draftStore'
import { createAutoSaveStore } from '$lib/admin/autoSave.svelte' import { createAutoSaveStore } from '$lib/admin/autoSave.svelte'
import AutoSaveStatus from './AutoSaveStatus.svelte' import AutoSaveStatus from './AutoSaveStatus.svelte'
import type { JSONContent, Editor as TipTapEditor } from '@tiptap/core' import type { JSONContent } from '@tiptap/core'
import type { Post } from '@prisma/client' import type { Post } from '@prisma/client'
interface Props { interface Props {
@ -29,9 +29,7 @@
let { postId, initialData, mode }: Props = $props() let { postId, initialData, mode }: Props = $props()
// State // State
let isLoading = $state(false)
let hasLoaded = $state(mode === 'create') // Create mode loads immediately let hasLoaded = $state(mode === 'create') // Create mode loads immediately
let isSaving = $state(false)
let activeTab = $state('metadata') let activeTab = $state('metadata')
let updatedAt = $state<string | undefined>(initialData?.updatedAt) let updatedAt = $state<string | undefined>(initialData?.updatedAt)
@ -179,7 +177,7 @@ $effect(() => {
}) })
// Navigation guard: flush autosave before navigating away (only if unsaved) // Navigation guard: flush autosave before navigating away (only if unsaved)
beforeNavigate(async (navigation) => { beforeNavigate(async () => {
if (hasLoaded && autoSave) { if (hasLoaded && autoSave) {
if (autoSave.status === 'saved') { if (autoSave.status === 'saved') {
return return

View file

@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { Media } from '@prisma/client' import type { Media } from '@prisma/client'
import Button from './Button.svelte' import Button from './Button.svelte'
import Input from './Input.svelte'
import SmartImage from '../SmartImage.svelte' import SmartImage from '../SmartImage.svelte'
import UnifiedMediaModal from './UnifiedMediaModal.svelte' import UnifiedMediaModal from './UnifiedMediaModal.svelte'
import MediaDetailsModal from './MediaDetailsModal.svelte' import MediaDetailsModal from './MediaDetailsModal.svelte'
@ -27,17 +26,13 @@
} }
let { let {
label,
value = $bindable([]), value = $bindable([]),
onUpload, onUpload,
onReorder, onReorder,
onRemove, onRemove,
maxItems = 20, maxItems = 20,
allowAltText = true,
required = false,
error, error,
placeholder = 'Drag and drop images here, or click to browse', placeholder = 'Drag and drop images here, or click to browse',
helpText,
showBrowseLibrary = false, showBrowseLibrary = false,
maxFileSize = 10, maxFileSize = 10,
disabled = false disabled = false
@ -78,7 +73,7 @@
// Upload multiple files to server // Upload multiple files to server
async function uploadFiles(files: File[]): Promise<Media[]> { async function uploadFiles(files: File[]): Promise<Media[]> {
const uploadPromises = files.map(async (file, index) => { const uploadPromises = files.map(async (file) => {
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', file)

View file

@ -1,6 +1,5 @@
import { Node, mergeAttributes } from '@tiptap/core' import { Node, mergeAttributes } from '@tiptap/core'
import { Plugin, PluginKey } from '@tiptap/pm/state' import { Plugin, PluginKey } from '@tiptap/pm/state'
import { Decoration, DecorationSet } from '@tiptap/pm/view'
export interface UrlEmbedOptions { export interface UrlEmbedOptions {
HTMLAttributes: Record<string, unknown> HTMLAttributes: Record<string, unknown>
@ -103,7 +102,7 @@ export const UrlEmbed = Node.create<UrlEmbedOptions>({
}, },
convertLinkToEmbed: convertLinkToEmbed:
(pos) => (pos) =>
({ state, commands, chain }) => { ({ state, chain }) => {
const { doc } = state const { doc } = state
// Find the link mark at the given position // Find the link mark at the given position
@ -206,7 +205,6 @@ export const UrlEmbed = Node.create<UrlEmbedOptions>({
// Find the link that was just inserted // Find the link that was just inserted
// Start from where we were before paste // Start from where we were before paste
let linkStart = -1 let linkStart = -1
let linkEnd = -1
// Search for the link in a reasonable range // Search for the link in a reasonable range
for ( for (
@ -235,15 +233,13 @@ export const UrlEmbed = Node.create<UrlEmbedOptions>({
const hasLink = $endPos const hasLink = $endPos
.marks() .marks()
.some((m) => m.type.name === 'link' && m.attrs.href === pastedUrl) .some((m) => m.type.name === 'link' && m.attrs.href === pastedUrl)
if (hasLink) { if (!hasLink) {
linkEnd = endPos + 1
} else {
break break
} }
} }
break break
} }
} catch (e) { } catch (_e) {
// Position might be invalid, continue // Position might be invalid, continue
} }
} }