From 903308ce3f16b39311b9e60b20dc0ab14dda0a8b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 05:41:12 +0000 Subject: [PATCH] lint: fix misc errors (no-case-declarations, empty interfaces, empty catch blocks) (12 fixes) Co-Authored-By: Justin Edmund --- src/lib/admin/api.ts | 4 +++- src/lib/admin/draftStore.ts | 4 +++- .../extensions/geolocation/geolocation-extended.svelte | 2 +- src/lib/components/edra/extensions/url-embed/UrlEmbed.ts | 2 +- .../edra/headless/components/ContentInsertionPane.svelte | 7 ++++--- .../edra/headless/components/GeolocationExtended.svelte | 2 +- src/lib/posts.ts | 2 +- src/lib/types/editor.ts | 2 +- src/lib/utils/content.ts | 3 ++- 9 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/lib/admin/api.ts b/src/lib/admin/api.ts index f41b7fa..f383779 100644 --- a/src/lib/admin/api.ts +++ b/src/lib/admin/api.ts @@ -23,7 +23,9 @@ async function handleResponse(res: Response) { // Redirect to login for unauthorized requests try { goto('/admin/login') - } catch {} + } catch { + // Ignore navigation errors (e.g., if already on login page) + } } const contentType = res.headers.get('content-type') || '' diff --git a/src/lib/admin/draftStore.ts b/src/lib/admin/draftStore.ts index 08fc1ed..1c946ba 100644 --- a/src/lib/admin/draftStore.ts +++ b/src/lib/admin/draftStore.ts @@ -26,7 +26,9 @@ export function loadDraft(key: string): Draft | null { export function clearDraft(key: string) { try { localStorage.removeItem(key) - } catch {} + } catch { + // Ignore storage errors + } } export function timeAgo(ts: number): string { diff --git a/src/lib/components/edra/extensions/geolocation/geolocation-extended.svelte b/src/lib/components/edra/extensions/geolocation/geolocation-extended.svelte index 0521720..a8fd67a 100644 --- a/src/lib/components/edra/extensions/geolocation/geolocation-extended.svelte +++ b/src/lib/components/edra/extensions/geolocation/geolocation-extended.svelte @@ -3,7 +3,7 @@ import type { NodeViewProps } from '@tiptap/core' import type * as L from 'leaflet' - interface Props extends NodeViewProps {} + type Props = NodeViewProps let { node }: Props = $props() diff --git a/src/lib/components/edra/extensions/url-embed/UrlEmbed.ts b/src/lib/components/edra/extensions/url-embed/UrlEmbed.ts index 9272d95..a37572e 100644 --- a/src/lib/components/edra/extensions/url-embed/UrlEmbed.ts +++ b/src/lib/components/edra/extensions/url-embed/UrlEmbed.ts @@ -188,7 +188,7 @@ export const UrlEmbed = Node.create({ if (text && !html) { // Simple URL regex check const urlRegex = - /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/ + /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/ if (urlRegex.test(text.trim())) { // It's a URL, let it paste as a link naturally (don't prevent default) diff --git a/src/lib/components/edra/headless/components/ContentInsertionPane.svelte b/src/lib/components/edra/headless/components/ContentInsertionPane.svelte index 580a04c..6026fe9 100644 --- a/src/lib/components/edra/headless/components/ContentInsertionPane.svelte +++ b/src/lib/components/edra/headless/components/ContentInsertionPane.svelte @@ -155,7 +155,7 @@ case 'audio': editor.chain().focus().setAudio(embedUrl).run() break - case 'location': + case 'location': { // For location, try to extract coordinates from Google Maps URL const coords = extractCoordinatesFromUrl(embedUrl) if (coords) { @@ -212,7 +212,7 @@ function insertContent(media: Media) { switch (contentType) { - case 'image': + case 'image': { const displayWidth = media.width && media.width > 600 ? 600 : media.width editor .chain() @@ -235,7 +235,8 @@ } ]) .run() - break + break + } case 'video': editor.chain().focus().setVideo(media.url).run() break diff --git a/src/lib/components/edra/headless/components/GeolocationExtended.svelte b/src/lib/components/edra/headless/components/GeolocationExtended.svelte index 1e57ede..81222a9 100644 --- a/src/lib/components/edra/headless/components/GeolocationExtended.svelte +++ b/src/lib/components/edra/headless/components/GeolocationExtended.svelte @@ -4,7 +4,7 @@ import { onMount } from 'svelte' import type L from 'leaflet' - interface Props extends NodeViewProps {} + type Props = NodeViewProps let { node, selected }: Props = $props() let mapContainer: HTMLDivElement diff --git a/src/lib/posts.ts b/src/lib/posts.ts index 9cb9fdf..b263725 100644 --- a/src/lib/posts.ts +++ b/src/lib/posts.ts @@ -64,7 +64,7 @@ export async function getPostBySlug(slug: string): Promise { } function getExcerpt(content: string, type: 'note' | 'article'): string { - const plainText = content.replace(/[#*`\[\]]/g, '').trim() + const plainText = content.replace(/[#*`[\]]/g, '').trim() const maxLength = type === 'note' ? 280 : 160 if (plainText.length <= maxLength) return plainText diff --git a/src/lib/types/editor.ts b/src/lib/types/editor.ts index a931c89..11e9cb4 100644 --- a/src/lib/types/editor.ts +++ b/src/lib/types/editor.ts @@ -1,6 +1,6 @@ import type { JSONContent } from '@tiptap/core' -export interface EditorData extends JSONContent {} +export type EditorData = JSONContent export interface EditorProps { data?: EditorData diff --git a/src/lib/utils/content.ts b/src/lib/utils/content.ts index ec35d45..b3043cf 100644 --- a/src/lib/utils/content.ts +++ b/src/lib/utils/content.ts @@ -315,11 +315,12 @@ function renderTiptapContent(doc: Record): string { case 'code': text = `${text}` break - case 'link': + case 'link': { const href = mark.attrs?.href || '#' const target = mark.attrs?.target || '_blank' text = `${text}` break + } case 'highlight': text = `${text}` break