77## Prerequisites
88
99- [ Yalc] ( https://github.com/whitecolor/yalc ) must be installed globally for most local development.
10+ - ** Git hooks setup** (REQUIRED for all contributors):
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.
19+
1020- After updating code via Git, to prepare all examples:
1121
1222``` sh
@@ -457,7 +467,9 @@ This approach:
457467
458468## Pre-Commit Requirements
459469
460- ** CRITICAL** : Before committing any changes, always run the following commands to ensure code quality:
470+ ** AUTOMATED** : If you've set up Lefthook (see Prerequisites), linting runs automatically on changed files before each commit.
471+
472+ ** MANUAL OPTION** : If you need to run linting manually:
461473
462474``` bash
463475# Navigate to the main react_on_rails directory
@@ -476,14 +488,14 @@ rake lint:rubocop
476488rake lint
477489```
478490
479- ** Automated checks :**
491+ ** Git hooks automatically run :**
480492
481- - Format all JavaScript/TypeScript files with Prettier
493+ - Format JavaScript/TypeScript files with Prettier (on changed files only)
482494- Check and fix linting issues with ESLint
483- - Check and fix Ruby style issues with RuboCop
484- - Ensure all tests pass before pushing
495+ - Check and fix Ruby style issues with RuboCop (on changed files only)
496+ - Ensure trailing newlines on all files
485497
486- ** Tip ** : Set up your IDE to run these automatically on save to catch issues early.
498+ ** Setup once ** : ` bundle exec lefthook install ` (see Prerequisites above)
487499
488500## 🤖 Best Practices for AI Coding Agents
489501
0 commit comments