@@ -292,6 +292,7 @@ git clean -fd && git reset --hard && git clean -fd
292292When testing specific generator improvements or fixes, test both Shakapacker scenarios:
293293
294294** Scenario A: No Shakapacker installed (fresh Rails app)**
295+
295296``` bash
296297# Reset to clean baseline before each test
297298git clean -fd && git reset --hard generator_testing_base && git clean -fd
@@ -307,6 +308,7 @@ rails generate react_on_rails:install
307308```
308309
309310** Scenario B: Shakapacker already installed**
311+
310312``` bash
311313# Reset to clean baseline
312314git clean -fd && git reset --hard generator_testing_base && git clean -fd
@@ -330,10 +332,11 @@ rails generate react_on_rails:install
330332** 3. Document testing results:**
331333
332334For each commit tested, document:
335+
333336- Generator execution success/failure for both scenarios
334337- Shakapacker installation/detection behavior
335338- Component rendering in browser
336- - Console output and warnings
339+ - Console output and warnings
337340- File generation differences between scenarios
338341- Specific issues found
339342
@@ -355,7 +358,7 @@ When testing specific commits that fix generator issues, follow this process:
355358cd ~ /shakacode/react-on-rails/react_on_rails
356359git checkout < commit-hash> # e.g., 81c66fa or bc69dcd0
357360
358- # In test application
361+ # In test application
359362cd ~ /shakacode/react-on-rails/react_on_rails-test-apps/react-on-rails-tutorial-v15
360363
361364# Reset to clean baseline
@@ -370,6 +373,7 @@ bundle install
370373```
371374
372375** Expected outcomes to verify:**
376+
373377- Generator completes without errors
374378- Shakapacker integration works correctly
375379- React components render and are interactive
@@ -420,22 +424,26 @@ npm install ../path/to/react_on_rails/react-on-rails-15.0.0.tgz
420424```
421425
422426This approach:
427+
423428- ✅ Exactly mimics real package installation
424- - ✅ No symlink issues across different filesystems
429+ - ✅ No symlink issues across different filesystems
425430- ✅ More reliable for CI/CD testing
426431- ⚠️ Requires manual step after each change (can be scripted)
427432
428433** Why this is needed** :
434+
429435- The gem provides Rails integration and server-side rendering
430436- Yalc provides the complete JavaScript client library needed for component mounting
431437- Without yalc, you'll see empty divs where React components should render
432438
433439** Verification** :
440+
434441- Visit the hello_world page in browser
435442- Check browser console for "RENDERED HelloWorld to dom node" success message
436443- Confirm React component is interactive (input field updates name display)
437444
438445** Development Mode Console Output** :
446+
439447- ` bin/dev ` (HMR): Shows HMR warnings and resource preload warnings (expected)
440448- ` bin/dev static ` : Shows only resource preload warnings (cleaner output)
441449- ` bin/dev prod ` : Cleanest output with minimal warnings (production-like environment)
@@ -447,18 +455,22 @@ This approach:
447455** Common Issues and Solutions:**
448456
4494571 . ** React components not rendering (empty divs)**
458+
450459 - ** Cause** : Missing yalc setup for JavaScript package
451460 - ** Solution** : Follow yalc setup steps above after running generator
452461
4534622 . ** Generator fails with Shakapacker errors**
463+
454464 - ** Cause** : Conflicting Shakapacker versions or incomplete installation
455465 - ** Solution** : Clean reset and ensure consistent Shakapacker version across tests
456466
4574673 . ** Babel configuration conflicts during yalc development**
468+
458469 - ** Cause** : Both ` babel.config.js ` and ` package.json ` "babel" section defining presets
459470 - ** Solution** : Remove "babel" section from ` package.json ` , keep only ` babel.config.js `
460471
4614724 . ** "Package.json not found" errors**
473+
462474 - ** Cause** : Generator trying to access non-existent package.json files
463475 - ** Solution** : Test with commits that fix this specific issue (e.g., bc69dcd0)
464476
@@ -467,6 +479,7 @@ This approach:
467479 - ** Solution** : Run ` bin/dev kill ` before starting new test servers
468480
469481** Testing Best Practices:**
482+
470483- Always use the double clean command: ` git clean -fd && git reset --hard && git clean -fd `
471484- Test both Shakapacker scenarios for comprehensive coverage
472485- Document exact error messages and steps to reproduce
@@ -495,6 +508,7 @@ rake lint
495508```
496509
497510** Automated checks:**
511+
498512- Format all JavaScript/TypeScript files with Prettier
499513- Check and fix linting issues with ESLint
500514- Check and fix Ruby style issues with RuboCop
@@ -506,53 +520,46 @@ rake lint
506520
507521** CRITICAL WORKFLOW** to prevent CI failures:
508522
509- ### 1. ** ALWAYS Lint Before Any Code Changes**
510- ``` bash
511- # First, check current state
512- rake lint
523+ ### 1. ** After Making Code Changes**
513524
514- # If violations exist, auto-fix them first
515- yarn run eslint . --fix # Auto-fix JS/TS formatting
516- bundle exec rubocop -A # Auto-fix Ruby violations
517- ```
518-
519- ### 2. ** After Making Code Changes**
520525``` bash
521- # MANDATORY: Run linters again
526+ # MANDATORY: Run linters after code changes
522527rake lint
523528
524529# If any violations, auto-fix immediately
525- yarn run eslint . --fix
526- bundle exec rubocop -A
530+ rake autofix # One command to run all auto-fixes
527531
528532# Verify everything passes
529533rake lint
530534```
531535
532- ### 3 . ** Common AI Agent Mistakes**
536+ ### 2 . ** Common AI Agent Mistakes**
533537
534538❌ ** DON'T:**
535- - Make code changes without running linters first
539+
536540- Commit code that hasn't been linted locally
537541- Ignore formatting rules when creating new files
538542- Add manual formatting that conflicts with Prettier/RuboCop
539543
540544✅ ** DO:**
541- - Run ` rake lint ` before AND after any code changes
542- - Use auto-fix options (` --fix ` , ` -A ` ) to resolve violations
545+
546+ - Run ` rake lint ` after any code changes
547+ - Use ` rake autofix ` to automatically fix all linting violations
543548- Create new files that follow existing patterns
544549- Test locally before committing
545550
546551### 4. ** Template File Best Practices**
547552
548553When creating new template files (` .jsx ` , ` .rb ` , etc.):
554+
5495551 . Copy existing template structure and patterns
5505562 . Run ` yarn run eslint . --fix ` immediately after creation
5515573 . Verify with ` rake lint ` before committing
552558
553559### 5. ** RuboCop Complexity Issues**
554560
555561For methods with high ABC complexity (usually formatting/display methods):
562+
556563``` ruby
557564# rubocop:disable Metrics/AbcSize
558565def complex_formatting_method
0 commit comments