BACK TO DIRECTORY
hookbeginner

Pre-Commit Linter

Automatically runs ESLint on all staged JavaScript and TypeScript files before allowing a commit to proceed. Blocks commits that contain linting errors while allowing warnings through. Configurable to run on specific file patterns and integrates with the project's existing ESLint configuration. Dramatically reduces code review friction.

723 STARS
11.6k DOWNLOADS
claude-templates
linteslintpre-commitqualitygit

CONFIGURATION

json
1{
2 "hooks": {
3 "pre-commit": {
4 "command": "npx eslint --max-warnings=0 $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|tsx|js|jsx)$' | tr '\n' ' ')",
5 "description": "Run ESLint on staged files before committing",
6 "on_failure": "block",
7 "timeout": 30000,
8 "env": {
9 "ESLINT_USE_FLAT_CONFIG": "true"
10 }
11 }
12 },
13 "settings": {
14 "skip_on_empty": true,
15 "verbose": false,
16 "parallel": false
17 }
18}