mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
32
.claude/commands/check-code.md
Normal file
32
.claude/commands/check-code.md
Normal file
@@ -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
|
||||||
@@ -21,7 +21,6 @@ if str(ROOT_DIR) not in sys.path:
|
|||||||
from registry import (
|
from registry import (
|
||||||
AVAILABLE_MODELS,
|
AVAILABLE_MODELS,
|
||||||
DEFAULT_MODEL,
|
DEFAULT_MODEL,
|
||||||
DEFAULT_YOLO_MODE,
|
|
||||||
get_all_settings,
|
get_all_settings,
|
||||||
set_setting,
|
set_setting,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ _root = Path(__file__).parent.parent
|
|||||||
if str(_root) not in sys.path:
|
if str(_root) not in sys.path:
|
||||||
sys.path.insert(0, str(_root))
|
sys.path.insert(0, str(_root))
|
||||||
|
|
||||||
from registry import AVAILABLE_MODELS, DEFAULT_MODEL, VALID_MODELS
|
from registry import DEFAULT_MODEL, VALID_MODELS
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Project Schemas
|
# Project Schemas
|
||||||
|
|||||||
28
ui/eslint.config.js
Normal file
28
ui/eslint.config.js
Normal file
@@ -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 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -24,7 +24,7 @@ function isAgentThought(line: string): boolean {
|
|||||||
if (/^Output:/.test(trimmed)) return false
|
if (/^Output:/.test(trimmed)) return false
|
||||||
|
|
||||||
// Skip JSON and very short lines
|
// Skip JSON and very short lines
|
||||||
if (/^[\[\{]/.test(trimmed)) return false
|
if (/^[[{]/.test(trimmed)) return false
|
||||||
if (trimmed.length < 15) return false
|
if (trimmed.length < 15) return false
|
||||||
|
|
||||||
// Skip lines that are just paths or technical output
|
// Skip lines that are just paths or technical output
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function generateId(): string {
|
|||||||
|
|
||||||
export function useSpecChat({
|
export function useSpecChat({
|
||||||
projectName,
|
projectName,
|
||||||
onComplete,
|
// onComplete intentionally not used - user clicks "Continue to Project" button instead
|
||||||
onError,
|
onError,
|
||||||
}: UseSpecChatOptions): UseSpecChatReturn {
|
}: UseSpecChatOptions): UseSpecChatReturn {
|
||||||
const [messages, setMessages] = useState<ChatMessage[]>([])
|
const [messages, setMessages] = useState<ChatMessage[]>([])
|
||||||
@@ -346,7 +346,7 @@ export function useSpecChat({
|
|||||||
console.error('Failed to parse WebSocket message:', e)
|
console.error('Failed to parse WebSocket message:', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [projectName, onComplete, onError])
|
}, [projectName, onError])
|
||||||
|
|
||||||
const start = useCallback(() => {
|
const start = useCallback(() => {
|
||||||
connect()
|
connect()
|
||||||
|
|||||||
Reference in New Issue
Block a user