-
-
Couldn't load subscription status.
- Fork 638
Fix CI/local Node version differences causing Prettier inconsistencies #1809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CI/local Node version differences causing Prettier inconsistencies #1809
Conversation
- Update CI workflow to use Node 22 instead of Node 20 to match local development environment - Add .nvmrc file to pin Node version for consistent development across team This resolves the issue where CI Prettier checks fail while local checks pass, caused by different Node versions processing files differently. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughUpdates Node.js version references: GitHub Actions workflow now uses Node 22, and a new .nvmrc pins Node.js to 22.12.0. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code ReviewThank you for this PR addressing the Node version inconsistencies. Here's my review: Strengths
Potential Issues
Recommendations
Testing and Security
SummaryGood fix addressing a real problem. With suggested update to examples workflow, this ensures uniform Node versions across non-matrix CI jobs. The .nvmrc addition is valuable for team development. Verdict: Approve with minor suggestions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
.github/workflows/lint-js-and-ruby.yml (3)
26-26: Pin CI to .nvmrc for exact version parity.Using
node-version: 22may drift from.nvmrc(22.12.0) as new 22.x are released, reintroducing inconsistencies. Prefernode-version-file: .nvmrcor pinnode-version: 22.12.0.Apply one of these diffs:
Option A (preferred):
- node-version: 22 + node-version-file: .nvmrcOption B (explicit pin):
- node-version: 22 + node-version: 22.12.0
90-124: Optional: align Node pinning to 22 across workflowsFound remaining Node 20 usages/matrix entries; .nvmrc is 22.12.0 and lint-js-and-ruby.yml already uses 22. Update if you want consistent pinning:
- .github/workflows/examples.yml:59 — node-version: 20
- .github/workflows/package-js-tests.yml:13 — node-version: ['20', '22']
- .github/workflows/main.yml — matrix includes both '20' and '22' (multiple entries)
- .github/workflows/lint-js-and-ruby.yml:26 — node-version: 22
- .nvmrc — 22.12.0
Remove or adjust '20' in matrices/explicit node-version keys if you want all workflows pinned to 22.
24-36: Optional: enable Corepack so runners use the pinned Yarn versionpackage.json already declares "packageManager": "yarn@1.22.22+sha512.a6b2f79... " (package.json: line 126). Add a workflow step immediately after actions/setup-node to run
corepack enable; explicitcorepack prepare yarn@1.22.22 --activateis optional because Corepack will honor the packageManager declaration..nvmrc (1)
1-1: Good pin.
.nvmrcset to 22.12.0 aligns with the objective. Pair this withnode-version-file: .nvmrcin CI for exact parity.Optionally add an engines field to package.json to enforce Node at install time:
"engines": { "node": "22.12.x" }If you want strict enforcement with Yarn:
- Yarn v1: set
--engine-strictin .yarnrc- Yarn Berry: set
enableStrictPackageManager: trueand rely on engines
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/lint-js-and-ruby.yml(1 hunks).nvmrc(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: dummy-app-integration-tests (3.4, 22)
- GitHub Check: dummy-app-integration-tests (3.2, 20)
- GitHub Check: claude-review
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: build
- GitHub Check: rspec-package-tests (3.2, latest)
- GitHub Check: rspec-package-tests (3.4, minimum)
- GitHub Check: rspec-package-tests (3.2, minimum)
🔇 Additional comments (1)
.github/workflows/lint-js-and-ruby.yml (1)
29-37: Nice: printing versions will quickly surface drift.The version printouts help validate the CI environment after the Node bump.
If you switch to
node-version-file: .nvmrc, confirm these lines showv22.12.0for Node and an expected Yarn version.
Summary
Problem
CI Prettier checks were failing while local checks passed due to Node version differences:
Different Node versions can cause Prettier to process files differently, leading to inconsistent formatting checks.
Solution
node-version: 20tonode-version: 22in.github/workflows/lint-js-and-ruby.yml22.12.0for consistent local developmentBenefits
Testing
🤖 Generated with Claude Code
This change is
Summary by CodeRabbit