From cbe3ecd25d2942f21c9bada35a5997fbd9437841 Mon Sep 17 00:00:00 2001 From: Auto Date: Sat, 10 Jan 2026 10:07:33 +0200 Subject: [PATCH] fix: resolve CI linting errors for Python and ESLint Python (ruff F401 - unused imports): - Remove unused DEFAULT_YOLO_MODE import from server/routers/settings.py - Remove unused AVAILABLE_MODELS import from server/schemas.py ESLint (missing config for v9): - Add ui/eslint.config.js with flat config format for ESLint v9 - Configure TypeScript, React Hooks, and React Refresh plugins - Fix unnecessary regex escapes in AgentThought.tsx - Remove unused onComplete from useSpecChat.ts dependency array Additional: - Add .claude/commands/check-code.md for local CI verification Co-Authored-By: Claude Opus 4.5 --- .claude/commands/check-code.md | 32 ++++++++++++++++++++++++++++++ server/routers/settings.py | 1 - server/schemas.py | 2 +- ui/eslint.config.js | 28 ++++++++++++++++++++++++++ ui/src/components/AgentThought.tsx | 2 +- ui/src/hooks/useSpecChat.ts | 4 ++-- 6 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 .claude/commands/check-code.md create mode 100644 ui/eslint.config.js diff --git a/.claude/commands/check-code.md b/.claude/commands/check-code.md new file mode 100644 index 0000000..5549261 --- /dev/null +++ b/.claude/commands/check-code.md @@ -0,0 +1,32 @@ +--- +description: +--- + +Run the following commands and ensure the code is clean. + +From project root: + +# Python linting + +ruff check . + +# Security tests + +python test_security.py + +From ui/ directory: +cd ui + +# ESLint (will fail until we add the config) + +npm run lint + +# TypeScript check + build + +npm run build + +One-liner to run everything: +ruff check . && python test_security.py && cd ui && npm run lint && npm run build + +Or if you want to see all failures at once (doesn't stop on first error): +ruff check .; python test_security.py; cd ui && npm run lint; npm run build diff --git a/server/routers/settings.py b/server/routers/settings.py index 10b0fa3..18362ee 100644 --- a/server/routers/settings.py +++ b/server/routers/settings.py @@ -21,7 +21,6 @@ if str(ROOT_DIR) not in sys.path: from registry import ( AVAILABLE_MODELS, DEFAULT_MODEL, - DEFAULT_YOLO_MODE, get_all_settings, set_setting, ) diff --git a/server/schemas.py b/server/schemas.py index 842906a..1f67c5d 100644 --- a/server/schemas.py +++ b/server/schemas.py @@ -18,7 +18,7 @@ _root = Path(__file__).parent.parent if str(_root) not in sys.path: sys.path.insert(0, str(_root)) -from registry import AVAILABLE_MODELS, DEFAULT_MODEL, VALID_MODELS +from registry import DEFAULT_MODEL, VALID_MODELS # ============================================================================ # Project Schemas diff --git a/ui/eslint.config.js b/ui/eslint.config.js new file mode 100644 index 0000000..092408a --- /dev/null +++ b/ui/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +) diff --git a/ui/src/components/AgentThought.tsx b/ui/src/components/AgentThought.tsx index 8cc8508..65a50a1 100644 --- a/ui/src/components/AgentThought.tsx +++ b/ui/src/components/AgentThought.tsx @@ -24,7 +24,7 @@ function isAgentThought(line: string): boolean { if (/^Output:/.test(trimmed)) return false // Skip JSON and very short lines - if (/^[\[\{]/.test(trimmed)) return false + if (/^[[{]/.test(trimmed)) return false if (trimmed.length < 15) return false // Skip lines that are just paths or technical output diff --git a/ui/src/hooks/useSpecChat.ts b/ui/src/hooks/useSpecChat.ts index 7d9fd4b..b2bac62 100644 --- a/ui/src/hooks/useSpecChat.ts +++ b/ui/src/hooks/useSpecChat.ts @@ -33,7 +33,7 @@ function generateId(): string { export function useSpecChat({ projectName, - onComplete, + // onComplete intentionally not used - user clicks "Continue to Project" button instead onError, }: UseSpecChatOptions): UseSpecChatReturn { const [messages, setMessages] = useState([]) @@ -346,7 +346,7 @@ export function useSpecChat({ console.error('Failed to parse WebSocket message:', e) } } - }, [projectName, onComplete, onError]) + }, [projectName, onError]) const start = useCallback(() => { connect()