rmi-frontend/.pre-commit-config.yaml
cryptorugmunch 19a7b29e33 feat: add TypeScript strict mode, vitest, zod env validation, playwright, Makefile, .editorconfig
10 improvements to the frontend dev experience:

1. TypeScript strict mode enabled (tsconfig.app.json)
   - strict: true, noImplicitAny: true, noUnusedLocals: true
   - noUnusedParameters: true, noImplicitReturns: true
   - noUncheckedIndexedAccess: true
   - Passes with 0 errors

2. Vitest configured with jsdom + @testing-library/react
   - vitest.config.ts with coverage provider
   - src/test/setup.ts stubs all env vars
   - src/App.test.tsx: smoke test (renders without crash)
   - 1 test passing

3. .editorconfig added (matches biome: 2-space, lf, 120 cols)

4. Makefile added with standard targets:
   make install/dev/build/lint/format/check/typecheck/test/ci/clean

5. Zod env validation (src/lib/env.ts)
   - All import.meta.env calls validated via zod schema
   - Fails fast with clear error if env vars are invalid
   - src/lib/config.ts re-exports from validated env

6. Playwright E2E config + smoke tests
   - playwright.config.ts with chromium
   - e2e/smoke.spec.ts: homepage + navigation tests

7. CI workflow now blocking on lint + typecheck + test + build
   - Removed continue-on-error from lint step
   - Added vitest run step
   - Added tsc --noEmit step

8. rollup-plugin-visualizer added to vite.config.ts
   - Generates dist/stats.html on build

9. Pre-commit hook updated with --staged flag
   - Only lints staged files, not entire repo

10. Removed broken .clinerules symlink

Build: 18s, 0 TS errors, 1 test passing, 0 format errors
2026-07-02 12:28:06 +02:00

55 lines
1.5 KiB
YAML

# RMI Pre-commit Config — drop into any rmi project
# Copy to project root as .pre-commit-config.yaml
# Install: pre-commit install
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: ["--maxkb=500"]
- id: check-merge-conflict
- id: detect-private-keys
- id: mixed-line-ending
args: ["--fix=lf"]
- id: no-commit-to-branch
args: ["--branch", "main", "--branch", "staging"]
- repo: https://github.com/biomejs/pre-commit
rev: "2.5.1"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome@2.5.1"]
files: '^src/.*\.(ts|tsx|js|jsx)$'
args: ["--staged"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.16
hooks:
- id: ruff
args: ["check", "--fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.1.0
hooks:
- id: mypy
args: ["--strict", "--ignore-missing-imports"]
language: system
types: [python]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.24.0
hooks:
- id: gitleaks
args: ["detect", "--source", ".", "--verbose"]
- repo: https://github.com/ejcx/git-hound
rev: v1.2.0
hooks:
- id: git-hound
args: ["--config", ".githound.yml"]