diff --git a/src/components/Editor.tsx b/src/components/Editor.tsx index 088c40cd..0e8c7eb6 100644 --- a/src/components/Editor.tsx +++ b/src/components/Editor.tsx @@ -238,7 +238,8 @@ export const Editor = memo(function Editor({ }, }) // Cache parsed blocks per tab path for instant switching - const tabCacheRef = useRef>(new Map()) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- BlockNote block arrays + const tabCacheRef = useRef>(new Map()) const prevActivePathRef = useRef(null) const editorMountedRef = useRef(false) const pendingSwapRef = useRef<(() => void) | null>(null) @@ -281,7 +282,8 @@ export const Editor = memo(function Editor({ const tab = tabs.find(t => t.entry.path === activeTabPath) if (!tab) return - const applyBlocks = (blocks: unknown[]) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- BlockNote's PartialBlock generic is extremely complex + const applyBlocks = (blocks: any[]) => { try { const current = editor.document if (current.length > 0 && blocks.length > 0) { @@ -317,7 +319,8 @@ export const Editor = memo(function Editor({ try { const result = editor.tryParseMarkdownToBlocks(preprocessed) - const handleBlocks = (blocks: unknown[]) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- BlockNote block arrays + const handleBlocks = (blocks: any[]) => { if (prevActivePathRef.current !== targetPath) return const withWikilinks = injectWikilinks(blocks) // Only cache non-empty results to avoid poisoning the cache @@ -326,13 +329,15 @@ export const Editor = memo(function Editor({ } applyBlocks(withWikilinks) } - if (result && typeof (result as Promise).then === 'function') { - (result as Promise).then(handleBlocks).catch((err) => { + /* eslint-disable @typescript-eslint/no-explicit-any -- tryParseMarkdownToBlocks returns sync or async BlockNote blocks */ + if (result && typeof (result as any).then === 'function') { + (result as unknown as Promise).then(handleBlocks).catch((err: unknown) => { console.error('Async markdown parse failed:', err) }) } else { - handleBlocks(result as unknown[]) + handleBlocks(result as any[]) } + /* eslint-enable @typescript-eslint/no-explicit-any */ } catch (err) { console.error('Failed to parse/swap editor content:', err) } diff --git a/src/hooks/useMcpBridge.ts b/src/hooks/useMcpBridge.ts index 4a28ab31..e82890e2 100644 --- a/src/hooks/useMcpBridge.ts +++ b/src/hooks/useMcpBridge.ts @@ -73,7 +73,7 @@ export function useMcpBridge(wsUrl = DEFAULT_WS_URL) { const id = `mcp-${++idCounterRef.current}` return new Promise((resolve, reject) => { - pendingRef.current.set(id, { resolve, reject }) + pendingRef.current.set(id, { resolve: resolve as (value: unknown) => void, reject }) ws.send(JSON.stringify({ id, tool, args })) // Timeout after 30 seconds diff --git a/src/mock-tauri.ts b/src/mock-tauri.ts index 268fea60..12996a31 100644 --- a/src/mock-tauri.ts +++ b/src/mock-tauri.ts @@ -1749,18 +1749,18 @@ export async function mockInvoke(cmd: string, args?: Record) if (apiAvailable) { try { if (cmd === 'list_vault' && args?.path) { - const res = await fetch(`/api/vault/list?path=${encodeURIComponent(args.path)}`) + const res = await fetch(`/api/vault/list?path=${encodeURIComponent(args.path as string)}`) if (res.ok) return (await res.json()) as T } if (cmd === 'get_note_content' && args?.path) { - const res = await fetch(`/api/vault/content?path=${encodeURIComponent(args.path)}`) + const res = await fetch(`/api/vault/content?path=${encodeURIComponent(args.path as string)}`) if (res.ok) { const { content } = await res.json() return content as T } } if (cmd === 'get_all_content' && args?.path) { - const res = await fetch(`/api/vault/all-content?path=${encodeURIComponent(args.path)}`) + const res = await fetch(`/api/vault/all-content?path=${encodeURIComponent(args.path as string)}`) if (res.ok) return (await res.json()) as T } } catch (err) {