You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement automatic Git hooks with Lefthook for code quality
- Replace manual hook installation with modular Lefthook configuration
- Check all changed files (staged + unstaged + untracked) for comprehensive coverage
- Add separate scripts in bin/lefthook/ for testability and maintainability
- Automatic installation via script/bootstrap and package.json postinstall
- Provide helpful error messages with fix commands and skip options
- Parallel execution of linting checks for performance
Prevents CI failures by catching linting issues locally before commits.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Copy file name to clipboardExpand all lines: CLAUDE.md
+2-8Lines changed: 2 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
12
12
13
13
These requirements are non-negotiable. CI will fail if not followed.
14
14
15
-
**🚀 RECOMMENDED: Install Git hooks to automate these checks:**
15
+
**🚀 AUTOMATIC: Git hooks are installed automatically during setup**
16
16
17
-
```bash
18
-
# Install Lefthook hooks (already included in Gemfile)
19
-
bundle install
20
-
bundle exec lefthook install
21
-
```
22
-
23
-
This will automatically run linting on **only the files you changed** before each commit - making it fast!
17
+
Git hooks will automatically run linting on **all changed files (staged + unstaged + untracked)** before each commit - making it fast while preventing CI failures!
24
18
25
19
**Note:** Git hooks are for React on Rails gem developers only, not for users who install the gem.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+4-10Lines changed: 4 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,9 @@
7
7
## Prerequisites
8
8
9
9
-[Yalc](https://github.com/whitecolor/yalc) must be installed globally for most local development.
10
-
-**Git hooks setup** (REQUIRED for all contributors):
10
+
-**Git hooks setup** (automatic during normal setup):
11
11
12
-
```sh
13
-
cd react_on_rails/
14
-
bundle install
15
-
bundle exec lefthook install
16
-
```
17
-
18
-
This sets up automatic linting that runs **only on files you changed** - making commits fast while preventing CI failures.
12
+
Git hooks are installed automatically when you run the standard setup commands. They will run automatic linting on **all changed files (staged + unstaged + untracked)** - making commits fast while preventing CI failures.
19
13
20
14
- After updating code via Git, to prepare all examples:
21
15
@@ -492,10 +486,10 @@ rake lint
492
486
493
487
- Format JavaScript/TypeScript files with Prettier (on changed files only)
494
488
- Check and fix linting issues with ESLint
495
-
- Check and fix Ruby style issues with RuboCop (on changed files only)
489
+
- Check and fix Ruby style issues with RuboCop (on all changed files)
496
490
- Ensure trailing newlines on all files
497
491
498
-
**Setup once**: `bundle exec lefthook install` (see Prerequisites above)
492
+
**Setup**: Automatic during normal development setup
0 commit comments