Skip to content

Commit e7c4e05

Browse files
committed
feat: implement auto-fixing pre-commit hooks
- Add stage_fixed: true to format and lint commands in lefthook.yml - Pre-commit hooks now automatically fix formatting and linting issues - Fixed files are automatically re-staged for commit - Eliminates the need for manual fix-restage-retry cycles - Typecheck and test remain as validation-only hooks
1 parent bd6d396 commit e7c4e05

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lefthook.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@ pre-commit:
22
parallel: true
33
commands:
44
format:
5-
run: npm run format:check
6-
fail_text: "Code formatting issues found. Run 'npm run format' to fix."
5+
run: npm run format
6+
stage_fixed: true
7+
fail_text: 'Formatting fixes applied and staged'
78

89
lint:
9-
run: npm run lint
10-
fail_text: "Linting errors found. Run 'npm run lint:fix' to fix auto-fixable issues."
10+
run: npm run lint:fix
11+
stage_fixed: true
12+
fail_text: 'Linting fixes applied and staged'
1113

1214
typecheck:
1315
run: npm run typecheck
14-
fail_text: 'TypeScript type errors found. Fix the errors before committing.'
16+
fail_text: 'TypeScript type errors found. Fix manually.'
1517

1618
test:
1719
run: npm run test:unit
18-
fail_text: 'Unit tests failed. Fix the tests before committing.'
20+
fail_text: 'Unit tests failed. Fix manually.'
1921

2022
pre-push:
2123
commands:

0 commit comments

Comments
 (0)