From 7f30a28be920967e3e217af375cd91591b77589d Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Mon, 19 Jan 2026 22:06:39 -0500 Subject: [PATCH] fix(frontend): eslint config for tests and minor hook fixes - Add eslint rules for test files with proper tsconfig and globals - Add no-empty rule exception for PromptInput - Remove unused renderTrigger dependency from useMemo in virtualized-text-view - Fix session status to properly set idle state when assistant message completes --- frontend/eslint.config.js | 21 ++++++++++++++++--- .../components/ui/virtualized-text-view.tsx | 2 +- frontend/src/hooks/useSSE.ts | 4 +--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index afc98dff..49f36c20 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -35,16 +35,31 @@ export default defineConfig([ 'react-refresh/only-export-components': 'off', }, }, + // Special rules for PromptInput + { + files: ['src/components/message/PromptInput.tsx'], + rules: { + 'no-empty': 'off', + } + }, // Special rules for test files { - files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx'], + files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx', 'vitest.config.ts'], + languageOptions: { + parserOptions: { + tsconfigRootDir: import.meta.dirname, + projectService: false + }, + globals: globals.node, + }, rules: { - '@typescript-eslint/no-explicit-any': 'off', // Often needed for mocks - '@typescript-eslint/no-empty-function': 'off', // Common in test setup + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], + 'no-empty': 'off', } }, ]) diff --git a/frontend/src/components/ui/virtualized-text-view.tsx b/frontend/src/components/ui/virtualized-text-view.tsx index 6368ba96..bc2f3dfa 100644 --- a/frontend/src/components/ui/virtualized-text-view.tsx +++ b/frontend/src/components/ui/virtualized-text-view.tsx @@ -322,7 +322,7 @@ export const VirtualizedTextView = forwardRef { const { start, end } = visibleRange diff --git a/frontend/src/hooks/useSSE.ts b/frontend/src/hooks/useSSE.ts index 67bfec3d..0a00b3dc 100644 --- a/frontend/src/hooks/useSSE.ts +++ b/frontend/src/hooks/useSSE.ts @@ -123,9 +123,7 @@ export const useSSE = (opcodeUrl: string | null | undefined, directory?: string, if (info.role === 'assistant') { const isComplete = 'completed' in info.time && info.time.completed - if (!isComplete) { - setSessionStatus(sessionID, { type: 'busy' }) - } + setSessionStatus(sessionID, isComplete ? { type: 'idle' } : { type: 'busy' }) } const currentData = queryClient.getQueryData(['opencode', 'messages', opcodeUrl, sessionID, directory])