react_on_rails 16.0.1.rc.0 → 16.0.1.rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6df96f164d23050adbea7f31bb61ab36a092fbad393d2d1d0e8a307f5c6a41d0
4
- data.tar.gz: e6e4b7e5c65175310edc4e1c7a01df8ffdfc8cdb9ca7fc1b5012988db174d360
3
+ metadata.gz: 447fa3382ac19a61525d8e17f67534ed0d6243cb8352512bae81b002165aef9b
4
+ data.tar.gz: 26b1a80ba765de1cf379e7fddc7adda75de353c39fea0a8c8965d314099d1b91
5
5
  SHA512:
6
- metadata.gz: bf0ae04e65fe1225e159154df70a1043a447e15c058fe62a743e99fd4e8ef489b61b64766da0516d93faec781ed4d968e5b3bce85228e560f5c2c3a3646518ee
7
- data.tar.gz: e604837b4b5182504ca2c2c38acbcdb8cf2dbea6f8fd94310fcedc28e4e8f4fe072048fdce21bed26317b0147d5712fb4a530a4c1fb3ae9bf52f47c05fa63a00
6
+ metadata.gz: ee112925a900c99b9b060e4eccf6fa18b5e249d2993b66d1a5b9ead17e989693d3dd512049a2276663616f9edb792b940f23334a600f56a4888deab47ea57ca2
7
+ data.tar.gz: dc7ba94789cfda1fcfce115d6db988b523810ed146d1db71d72d5942e920c7abf798317f8644ddc2e18dead08c4eacce62fb4b1a8c7ea751caaf63c85f40d35c
data/CHANGELOG.md CHANGED
@@ -23,6 +23,12 @@ After a release, please make sure to run `bundle exec rake update_changelog`. Th
23
23
 
24
24
  Changes since the last non-beta release.
25
25
 
26
+ #### Bug Fixes
27
+
28
+ - **Doctor rake task**: Fixed LoadError in `rake react_on_rails:doctor` when using packaged gem. The task was trying to require excluded `rakelib/task_helpers` file. [PR 1795](https://github.com/shakacode/react_on_rails/pull/1795)
29
+
30
+ ### [16.0.1-rc.0] - 2025-09-19
31
+
26
32
  #### Pro License Structure Implementation
27
33
 
28
34
  **🔐 License Architecture**
@@ -1646,7 +1652,8 @@ such as:
1646
1652
 
1647
1653
  - Fix several generator-related issues.
1648
1654
 
1649
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/16.0.0...master
1655
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/16.0.1-rc.0...master
1656
+ [16.0.1-rc.0]: https://github.com/shakacode/react_on_rails/compare/16.0.0...16.0.1-rc.0
1650
1657
  [16.0.0]: https://github.com/shakacode/react_on_rails/compare/14.2.0...16.0.0
1651
1658
  [14.2.0]: https://github.com/shakacode/react_on_rails/compare/14.1.1...14.2.0
1652
1659
  [14.1.1]: https://github.com/shakacode/react_on_rails/compare/14.1.0...14.1.1
data/CLAUDE.md CHANGED
@@ -9,9 +9,16 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
9
9
  1. **ALWAYS run `bundle exec rubocop` and fix ALL violations**
10
10
  2. **ALWAYS ensure files end with a newline character**
11
11
  3. **NEVER push without running full lint check first**
12
+ 4. **ALWAYS let Prettier handle ALL formatting - never manually format**
12
13
 
13
14
  These requirements are non-negotiable. CI will fail if not followed.
14
15
 
16
+ **🚀 AUTOMATIC: Git hooks are installed automatically during setup**
17
+
18
+ Git hooks will automatically run linting on **all changed files (staged + unstaged + untracked)** before each commit - making it fast while preventing CI failures!
19
+
20
+ **Note:** Git hooks are for React on Rails gem developers only, not for users who install the gem.
21
+
15
22
  ## Development Commands
16
23
 
17
24
  ### Essential Commands
@@ -33,6 +40,31 @@ These requirements are non-negotiable. CI will fail if not followed.
33
40
  - **Type checking**: `yarn run type-check`
34
41
  - **⚠️ MANDATORY BEFORE GIT PUSH**: `bundle exec rubocop` and fix ALL violations + ensure trailing newlines
35
42
 
43
+ ## ⚠️ FORMATTING RULES
44
+
45
+ **Prettier is the SOLE authority for formatting. NEVER manually format code.**
46
+
47
+ ### Standard Workflow
48
+ 1. Make code changes
49
+ 2. Run `rake autofix` or `yarn start format`
50
+ 3. Commit changes
51
+
52
+ ### Merge Conflict Resolution Workflow
53
+ **CRITICAL**: When resolving merge conflicts, follow this exact sequence:
54
+
55
+ 1. **Resolve logical conflicts only** - don't worry about formatting
56
+ 2. **Add resolved files**: `git add .` (or specific files)
57
+ 3. **Auto-fix everything**: `rake autofix`
58
+ 4. **Add any formatting changes**: `git add .`
59
+ 5. **Continue rebase/merge**: `git rebase --continue` or `git commit`
60
+
61
+ **❌ NEVER manually format during conflict resolution** - this causes formatting wars between tools.
62
+
63
+ ### Debugging Formatting Issues
64
+ - Check current formatting: `yarn start format.listDifferent`
65
+ - Fix all formatting: `rake autofix`
66
+ - If CI fails on formatting, always run automated fixes, never manual fixes
67
+
36
68
  ### Development Setup Commands
37
69
 
38
70
  - **Initial setup**: `bundle && yarn && rake shakapacker_examples:gen_all && rake node_package && rake`
data/CONTRIBUTING.md CHANGED
@@ -7,6 +7,10 @@
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** (automatic during normal setup):
11
+
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.
13
+
10
14
  - After updating code via Git, to prepare all examples:
11
15
 
12
16
  ```sh
@@ -457,7 +461,9 @@ This approach:
457
461
 
458
462
  ## Pre-Commit Requirements
459
463
 
460
- **CRITICAL**: Before committing any changes, always run the following commands to ensure code quality:
464
+ **AUTOMATED**: If you've set up Lefthook (see Prerequisites), linting runs automatically on changed files before each commit.
465
+
466
+ **MANUAL OPTION**: If you need to run linting manually:
461
467
 
462
468
  ```bash
463
469
  # Navigate to the main react_on_rails directory
@@ -476,14 +482,14 @@ rake lint:rubocop
476
482
  rake lint
477
483
  ```
478
484
 
479
- **Automated checks:**
485
+ **Git hooks automatically run:**
480
486
 
481
- - Format all JavaScript/TypeScript files with Prettier
487
+ - Format JavaScript/TypeScript files with Prettier (on changed files only)
482
488
  - Check and fix linting issues with ESLint
483
- - Check and fix Ruby style issues with RuboCop
484
- - Ensure all tests pass before pushing
489
+ - Check and fix Ruby style issues with RuboCop (on all changed files)
490
+ - Ensure trailing newlines on all files
485
491
 
486
- **Tip**: Set up your IDE to run these automatically on save to catch issues early.
492
+ **Setup**: Automatic during normal development setup
487
493
 
488
494
  ## 🤖 Best Practices for AI Coding Agents
489
495
 
@@ -38,6 +38,7 @@ group :development, :test do
38
38
  gem "rubocop-rspec", "~>2.26", require: false
39
39
  gem "scss_lint", require: false
40
40
  gem "spring", "~> 4.0"
41
+ gem "lefthook", require: false
41
42
  end
42
43
 
43
44
  group :test do
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- react_on_rails (16.0.0)
4
+ react_on_rails (16.0.1.rc.0)
5
5
  addressable
6
6
  connection_pool
7
7
  execjs (~> 2.5)
@@ -156,6 +156,7 @@ GEM
156
156
  launchy (3.0.1)
157
157
  addressable (~> 2.8)
158
158
  childprocess (~> 5.0)
159
+ lefthook (1.13.1)
159
160
  listen (3.9.0)
160
161
  rb-fsevent (~> 0.10, >= 0.10.3)
161
162
  rb-inotify (~> 0.9, >= 0.9.10)
@@ -412,6 +413,7 @@ DEPENDENCIES
412
413
  jbuilder
413
414
  jquery-rails
414
415
  launchy
416
+ lefthook
415
417
  listen
416
418
  package_json
417
419
  pry
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+ # Check for trailing newlines on all changed files
3
+ set -euo pipefail
4
+
5
+ CONTEXT="${1:-staged}"
6
+ files="$(bin/lefthook/get-changed-files "$CONTEXT" '.*')"
7
+
8
+ if [ -z "$files" ]; then
9
+ echo "✅ No files to check for trailing newlines"
10
+ exit 0
11
+ fi
12
+
13
+ if [ "$CONTEXT" = "all-changed" ]; then
14
+ echo "🔍 Checking trailing newlines on all changed files..."
15
+ else
16
+ echo "🔍 Checking trailing newlines on $CONTEXT files..."
17
+ fi
18
+
19
+ failed_files=""
20
+ for file in $files; do
21
+ if [ -f "$file" ] && [ -s "$file" ]; then
22
+ if ! tail -c 1 "$file" | grep -q '^$'; then
23
+ echo "❌ Missing trailing newline: $file"
24
+ failed_files="$failed_files $file"
25
+ fi
26
+ fi
27
+ done
28
+
29
+ if [ -n "$failed_files" ]; then
30
+ echo ""
31
+ echo "❌ Trailing newline check failed!"
32
+ echo "💡 Add trailing newlines to:$failed_files"
33
+ echo "🔧 Quick fix: for file in$failed_files; do echo >> \"\$file\"; done"
34
+ echo "🚫 Skip hook: git commit --no-verify"
35
+ exit 1
36
+ fi
37
+
38
+ echo "✅ All files have proper trailing newlines"
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ # Get changed files based on context (staged, branch, or all)
3
+ set -euo pipefail
4
+
5
+ CONTEXT="${1:-staged}"
6
+ PATTERN="${2:-.*}"
7
+
8
+ case "$CONTEXT" in
9
+ staged)
10
+ git diff --cached --name-only --diff-filter=ACM | grep -E "$PATTERN" || true
11
+ ;;
12
+ all-changed)
13
+ # Get all changed files (staged + unstaged + untracked) vs working directory
14
+ (git diff --cached --name-only --diff-filter=ACM; git diff --name-only --diff-filter=ACM; git ls-files --others --exclude-standard) | sort -u | grep -E "$PATTERN" || true
15
+ ;;
16
+ branch)
17
+ # Find base branch (prefer main over master)
18
+ base="origin/main"
19
+ git rev-parse --verify --quiet "$base" >/dev/null || base="origin/master"
20
+ git diff --name-only --diff-filter=ACM "$base"...HEAD | grep -E "$PATTERN" || true
21
+ ;;
22
+ *)
23
+ echo "Usage: $0 {staged|all-changed|branch} [pattern]" >&2
24
+ exit 1
25
+ ;;
26
+ esac
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ # Format JS/TS/JSON/MD files with Prettier
3
+ set -euo pipefail
4
+
5
+ CONTEXT="${1:-staged}"
6
+ files="$(bin/lefthook/get-changed-files "$CONTEXT" '\.(js|jsx|ts|tsx|json|md|yml|yaml)$')"
7
+
8
+ if [ -z "$files" ]; then
9
+ echo "✅ No files to format with Prettier"
10
+ exit 0
11
+ fi
12
+
13
+ if [ "$CONTEXT" = "all-changed" ]; then
14
+ echo "💅 Prettier on all changed files:"
15
+ else
16
+ echo "💅 Prettier on $CONTEXT files:"
17
+ fi
18
+ printf " %s\n" $files
19
+
20
+ yarn run prettier --write $files
21
+
22
+ # Re-stage files if running on staged or all-changed context
23
+ if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
24
+ echo $files | xargs -r git add
25
+ echo "✅ Re-staged formatted files"
26
+ fi
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ # Auto-fix Ruby files using rake autofix
3
+ set -euo pipefail
4
+
5
+ CONTEXT="${1:-staged}"
6
+ files="$(bin/lefthook/get-changed-files "$CONTEXT" '\.(rb|rake|ru)$')"
7
+
8
+ if [ -z "$files" ]; then
9
+ echo "✅ No Ruby files to autofix"
10
+ exit 0
11
+ fi
12
+
13
+ if [ "$CONTEXT" = "all-changed" ]; then
14
+ echo "🎨 Autofix on all changed Ruby files:"
15
+ else
16
+ echo "🎨 Autofix on $CONTEXT Ruby files:"
17
+ fi
18
+ printf " %s\n" $files
19
+
20
+ bundle exec rake autofix
21
+
22
+ # Re-stage files if running on staged or all-changed context
23
+ if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
24
+ echo $files | xargs -r git add
25
+ echo "✅ Re-staged formatted files"
26
+ fi
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+ # Lint Ruby files with RuboCop
3
+ set -euo pipefail
4
+
5
+ CONTEXT="${1:-staged}"
6
+ files="$(bin/lefthook/get-changed-files "$CONTEXT" '\.(rb|rake|ru)$')"
7
+
8
+ if [ -z "$files" ]; then
9
+ echo "✅ No Ruby files to lint"
10
+ exit 0
11
+ fi
12
+
13
+ if [ "$CONTEXT" = "all-changed" ]; then
14
+ echo "🔍 RuboCop on all changed Ruby files:"
15
+ else
16
+ echo "🔍 RuboCop on $CONTEXT Ruby files:"
17
+ fi
18
+ printf " %s\n" $files
19
+
20
+ if ! bundle exec rubocop --force-exclusion --display-cop-names -- $files; then
21
+ echo ""
22
+ echo "❌ RuboCop check failed!"
23
+ echo "💡 Auto-fix: bundle exec rubocop --auto-correct --force-exclusion -- $files"
24
+ echo "🚫 Skip hook: git commit --no-verify"
25
+ exit 1
26
+ fi
27
+ echo "✅ RuboCop checks passed for Ruby files"
data/eslint.config.ts CHANGED
@@ -159,6 +159,13 @@ const config = tsEslint.config([
159
159
  'react/prop-types': 'off',
160
160
  },
161
161
  },
162
+ {
163
+ files: ['spec/dummy/**/*'],
164
+ rules: {
165
+ // The dummy app dependencies are managed separately and may not be installed
166
+ 'import/no-unresolved': 'off',
167
+ },
168
+ },
162
169
  {
163
170
  files: ['**/*.ts{x,}', '**/*.[cm]ts'],
164
171
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "16.0.1.rc.0"
4
+ VERSION = "16.0.1.rc.2"
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../../rakelib/task_helpers"
4
3
  require_relative "../react_on_rails"
5
4
  require_relative "../react_on_rails/doctor"
6
5
 
@@ -38,8 +37,6 @@ rescue LoadError
38
37
  end
39
38
 
40
39
  namespace :react_on_rails do
41
- include ReactOnRails::TaskHelpers
42
-
43
40
  desc "Diagnose React on Rails setup and configuration"
44
41
  task :doctor do
45
42
  verbose = ENV["VERBOSE"] == "true"
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "16.0.1-rc.0",
3
+ "version": "16.0.1-rc.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "react-on-rails",
9
- "version": "16.0.1-rc.0",
9
+ "version": "16.0.1-rc.2",
10
10
  "license": "MIT",
11
11
  "devDependencies": {
12
12
  "@arethetypeswrong/cli": "^0.17.4",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.0.1.rc.0
4
+ version: 16.0.1.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
@@ -133,6 +133,11 @@ files:
133
133
  - SUMMARY.md
134
134
  - TODO.md
135
135
  - app/helpers/react_on_rails_helper.rb
136
+ - bin/lefthook/check-trailing-newlines
137
+ - bin/lefthook/get-changed-files
138
+ - bin/lefthook/prettier-format
139
+ - bin/lefthook/ruby-autofix
140
+ - bin/lefthook/ruby-lint
136
141
  - docker-compose.yml
137
142
  - eslint.config.ts
138
143
  - knip.ts