Skip to content

Commit 1680276

Browse files
justin808claude
andcommitted
Fix lefthook glob patterns to match files in subdirectories
- Update all glob patterns from "*.{...}" to "**/*.{...}" for recursive matching - Ensures pre-commit hooks run on files in all subdirectories (lib/, spec/, etc.) - Remove redundant git add from eslint-lint script (lefthook handles via stage_fixed) - Add missing stage_fixed to rubocop command for consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 9a227ba commit 1680276

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

.lefthook.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@ pre-commit:
66
parallel: true
77
commands:
88
autofix:
9-
glob: "*.{rb,rake,ru}"
9+
glob: "**/*.{rb,rake,ru}"
1010
run: bin/lefthook/ruby-autofix all-changed
1111
stage_fixed: true
1212

1313
rubocop:
14-
glob: "*.{rb,rake,ru}"
14+
glob: "**/*.{rb,rake,ru}"
1515
run: bin/lefthook/ruby-lint all-changed
16+
stage_fixed: true
1617

1718
eslint:
18-
glob: "*.{js,jsx,ts,tsx}"
19+
glob: "**/*.{js,jsx,ts,tsx}"
1920
run: bin/lefthook/eslint-lint all-changed
2021
stage_fixed: true
2122

2223
prettier:
23-
glob: "*.{js,jsx,ts,tsx,json,md,yml,yaml}"
24+
glob: "**/*.{js,jsx,ts,tsx,json,md,yml,yaml}"
2425
run: bin/lefthook/prettier-format all-changed
2526
stage_fixed: true
2627

bin/lefthook/eslint-lint

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ if [ -n "$root_and_packages_pro_files" ]; then
3434
if ! yarn run eslint $root_and_packages_pro_files --fix; then
3535
exit_code=1
3636
fi
37-
38-
# Re-stage files if running on staged or all-changed context
39-
if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
40-
echo $root_and_packages_pro_files | xargs -r git add
41-
fi
4237
fi
4338

4439
# Lint react_on_rails_pro files (using Pro gem's ESLint config)
@@ -56,11 +51,6 @@ if [ -n "$react_on_rails_pro_files" ]; then
5651
if ! (cd react_on_rails_pro && yarn run eslint $react_on_rails_pro_files_relative --fix); then
5752
exit_code=1
5853
fi
59-
60-
# Re-stage files if running on staged or all-changed context
61-
if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
62-
echo $react_on_rails_pro_files | xargs -r git add
63-
fi
6454
fi
6555

6656
if [ $exit_code -eq 0 ]; then

0 commit comments

Comments
 (0)