Lint — Lint, Format & Type Check
You are a code quality engineer. Auto-detect the linting stack, run it, fix all errors. Zero errors before done.
Do NOT ask for permission — just fix everything.
Step 1 — Detect lint stack
PROJECT_ROOT=$(git rev-parse --show-toplevel)
cd "$PROJECT_ROOT"
ls pyproject.toml ruff.toml eslint.config.* .eslintrc* tsconfig.json 2>/dev/null
ls api/eslint.config.* api/.eslintrc* api/tsconfig.json 2>/dev/null
Determine which apply:
- ruff (Python):
pyproject.tomlwith[tool.ruff]section - ESLint (frontend):
eslint.config.*or.eslintrc*in root - ESLint (backend JS):
eslint.config.*or.eslintrc*inapi/ - TypeScript (frontend):
tsconfig.jsonin root - TypeScript (backend):
tsconfig.jsoninapi/
Step 2 — Auto-fix
ruff (Python):
./venv/bin/ruff check . --fix
./venv/bin/ruff format .
ESLint (frontend):
npm run lint -- --fix 2>/dev/null || npx eslint . --fix
ESLint (backend JS):
cd api && npm run lint -- --fix 2>/dev/null || npx eslint src --ext .ts --fix
Step 3 — Type check
TypeScript (frontend) — blocking:
npm run typecheck 2>&1 || npx tsc --noEmit 2>&1
TypeScript (backend JS) — blocking:
cd api && npm run typecheck 2>&1 || npx tsc --noEmit 2>&1
Python mypy — non-blocking:
./venv/bin/mypy . --ignore-missing-imports 2>&1 || true
Step 4 — Fix remaining errors manually
For each error auto-fix could not handle, read the file and fix it.
ESLint:
no-unused-vars/@typescript-eslint/no-unused-vars→ remove or prefix with_@typescript-eslint/no-explicit-any→ replace with proper type orunknownno-console→ replace with project loggerreact-hooks/exhaustive-deps→ add missing deps or wrap withuseCallback/useMemo@typescript-eslint/no-non-null-assertion→ add null check instead of!
TypeScript:
TS2339(property does not exist) → add to type or use optional chainingTS2345(type mismatch) → fix type or cast with justificationTS2304(cannot find name) → add importTS7006(implicit any) → add explicit type annotation
ruff:
E501(line too long) → break the lineB904(raise from) → addfrom errorfrom NoneF841(unused variable) → remove itC408(unnecessary dict call) → use dict literal
Step 5 — Re-run until clean
Run each applicable command again. Repeat Steps 4-5 until zero errors.
# ruff
./venv/bin/ruff check .
./venv/bin/ruff format --check .
# ESLint + TypeScript
npm run lint && npm run typecheck
cd api && npm run lint
Output
=== Lint Summary ===
Frontend ESLint: X errors → 0 remaining
Frontend TypeCheck: X errors → 0 remaining
Backend ESLint: X errors → 0 remaining
Backend TypeCheck: X errors → 0 remaining
ruff: X errors → 0 remaining
Status: PASSED