diff --git a/PERFORMANCE_AUDIT.md b/PERFORMANCE_AUDIT.md index f8114fd..539eeab 100644 --- a/PERFORMANCE_AUDIT.md +++ b/PERFORMANCE_AUDIT.md @@ -57,7 +57,7 @@ This critical area for a background desktop app is fully resolved. **Status: 🟢 Excellent** **Linting:** -* `npm run lint` yields 0 errors and only 13 minimal warnings (`no-empty`, `no-console`, and some remaining `any` types that are safe or intentional). The majority of the codebase is now strongly typed. +* `npm run lint` yields 0 errors and only 8 minimal warnings (`no-empty`, `no-console`, and some remaining `any` types that are safe or intentional). The majority of the codebase is now strongly typed. **Electron-Builder:** * `asar` packaging is efficiently enabled. diff --git a/README.md b/README.md index aa452f6..c050159 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,15 @@ PaperCache brings AI right into your note — no subscription, no middleman. You --- +## Support + +If you find PaperCache useful, consider buying me a coffee to support its ongoing development! + +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/thevariable) + +--- + ## License MIT License. + diff --git a/src/Settings.test.tsx b/src/Settings.test.tsx index 8d85536..ba72ca1 100644 --- a/src/Settings.test.tsx +++ b/src/Settings.test.tsx @@ -30,7 +30,9 @@ describe('Settings Component', () => { }) it('loads API key status from IPC', async () => { - ;(window.electronAPI.getApiKeyStatus as any).mockResolvedValue(true) + ;( + window.electronAPI.getApiKeyStatus as unknown as { mockResolvedValue: (v: boolean) => void } + ).mockResolvedValue(true) await act(async () => { render() }) diff --git a/src/components/Editor.tsx b/src/components/Editor.tsx index 1f34657..506cc9c 100644 --- a/src/components/Editor.tsx +++ b/src/components/Editor.tsx @@ -3,7 +3,7 @@ import CodeMirror from '@uiw/react-codemirror' import { ViewUpdate } from '@codemirror/view' import { useAppStore } from '../store/useAppStore' import { useSettingsStore } from '../store/useSettingsStore' -import { MathEvaluator } from '../lib/editor/MathEvaluator' + import { useEditorExtensions } from '../lib/editor/extensions' import { type TransactionSpec } from '@codemirror/state' @@ -54,14 +54,17 @@ export const Editor = forwardRef((_props, ref) => { if (viewUpdate?.transactions?.some((tr) => tr.docChanged)) { if (editorRef.current?.view) { - MathEvaluator.triggerMathEvaluation(editorRef.current.view) + const view = editorRef.current.view + import('../lib/editor/MathEvaluator').then((m) => { + m.MathEvaluator.triggerMathEvaluation(view) + }) } } }, [currentNoteIndex, setNotes] ) - const extensions = useEditorExtensions(handleEditorChange) + const extensions = useEditorExtensions() useEffect(() => { const handleWindowFocus = () => { diff --git a/src/components/NoteTitleBar.tsx b/src/components/NoteTitleBar.tsx index 92bb0d5..d4c58f5 100644 --- a/src/components/NoteTitleBar.tsx +++ b/src/components/NoteTitleBar.tsx @@ -35,6 +35,7 @@ export function NoteTitleBar() { prev.map((n) => (n.id === activeNote.id ? { ...n, content: newContent } : n)) ) } catch (e) { + // eslint-disable-next-line no-console console.error('Failed to save note', e) } } else { @@ -50,6 +51,7 @@ export function NoteTitleBar() { setNotes((prev) => prev.map((n) => (n.id === activeNote.id ? { ...n, id: newId } : n))) } } catch (e) { + // eslint-disable-next-line no-console console.error('Failed to rename note', e) } } diff --git a/src/hooks/useReminders.test.ts b/src/hooks/useReminders.test.ts index 8f2bfc5..08717f5 100644 --- a/src/hooks/useReminders.test.ts +++ b/src/hooks/useReminders.test.ts @@ -19,7 +19,7 @@ describe('useReminders', () => { window.electronAPI = { onPowerSuspend: vi.fn().mockReturnValue(vi.fn()), onPowerResume: vi.fn().mockReturnValue(vi.fn()), - } as Partial as any + } as unknown as Window['electronAPI'] } // Clear localStorage diff --git a/src/hooks/useReminders.ts b/src/hooks/useReminders.ts index 3b95fe1..c9ff1d1 100644 --- a/src/hooks/useReminders.ts +++ b/src/hooks/useReminders.ts @@ -37,6 +37,7 @@ function handleDueReminders(notes: Note[]) { for (const r of allReminders) { if (now >= r.dueAt.getTime()) { if (!notified.has(r.key)) { + // eslint-disable-next-line no-console console.log('Triggering OS notification for:', r.label) new Notification('PaperCache Reminder', { body: r.label, diff --git a/src/lib/editor/extensions.ts b/src/lib/editor/extensions.ts index b173e5b..e1493cb 100644 --- a/src/lib/editor/extensions.ts +++ b/src/lib/editor/extensions.ts @@ -30,7 +30,7 @@ const handleDeleteNote = () => { return true } -export function useEditorExtensions(handleEditorChange: (val: string) => void) { +export function useEditorExtensions() { const { apiBaseUrl, apiModel, aiSystemPrompt } = useAIStore() return useMemo( @@ -236,6 +236,6 @@ export function useEditorExtensions(handleEditorChange: (val: string) => void) { }, }), ], - [apiBaseUrl, apiModel, aiSystemPrompt, handleEditorChange] + [apiBaseUrl, apiModel, aiSystemPrompt] ) } diff --git a/src/utils.ts b/src/utils.ts index 5758e31..057646d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -3,7 +3,9 @@ export const getFolderColor = (str: string): string => { let colors: Record = {} try { colors = JSON.parse(localStorage.getItem('papercache-folder-colors') || '{}') - } catch {} + } catch { + /* ignore */ + } if (colors[str]) return colors[str]