feat(dx): pre-commit hooks for local CI (no remote needed)

Local quality gate that runs on every git commit:
- node --check syntax on staged .js files
- block on new emoji in staged .js/.html/.css (md files allowed)
- block on new console.log/debug/debugger statements
- backend route auth lint (existing npm run lint:routes)
- backend tests (baseline 3 fails, block if grew)

Install: npm run hooks:install (top-level)
Bypass: git commit --no-verify

Skips slow checks when irrelevant files changed (tests/lint only run
if backend touched).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Maxim Dolgolyov
2026-05-22 21:49:58 +03:00
parent 3135402dd7
commit 696049271f
5 changed files with 371 additions and 1 deletions
+2 -1
View File
@@ -13,7 +13,8 @@
"seed:permissions": "node src/db/seed-permissions.js",
"lint:routes": "node scripts/check-route-auth.js",
"import:content": "node scripts/import-content.js",
"test": "node --test tests/*.test.js"
"test": "node --test tests/*.test.js",
"hooks:install": "sh ../scripts/install-hooks.sh"
},
"dependencies": {
"bcryptjs": "^2.4.3",