Build: Fix ejslint execution path in lint-staged#33504
Conversation
📝 WalkthroughWalkthroughChanged lint-staged configuration in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (1)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @code/package.json:
- Around line 55-57: The lint-staged entry for "*.ejs" currently uses "yarn
--cwd ../scripts ejslint" which runs ejslint from the scripts/ directory causing
file path mismatches; update the "*.ejs" command so ejslint executes with the
same working directory that lint-staged provides (or make it accept absolute
paths) — e.g., run ejslint from code/ (so the incoming relative paths like
builders/... resolve), or invoke a small wrapper that changes to the repo
root/scripts directory while passing the original lint-staged file arguments
unchanged; modify the package.json lint-staged "*.ejs" entry accordingly to
ensure ejslint receives valid paths.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
code/package.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx,json,md,html,css,scss}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Format code using Prettier with
yarn prettier --write <file>
Files:
code/package.json
**/*.{js,jsx,json,html,ts,tsx,mjs}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Run ESLint checks using
yarn lint:js:cmd <file>or the full commandcross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directivesto fix linting errors before committing
Files:
code/package.json
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{js,jsx,json,html,ts,tsx,mjs} : Run ESLint checks using `yarn lint:js:cmd <file>` or the full command `cross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives` to fix linting errors before committing
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{js,jsx,ts,tsx,json,md,html,css,scss} : Format code using Prettier with `yarn prettier --write <file>`
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{js,jsx,json,html,ts,tsx,mjs} : Run ESLint checks using `yarn lint:js:cmd <file>` or the full command `cross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives` to fix linting errors before committing
Applied to files:
code/package.json
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{js,jsx,ts,tsx,json,md,html,css,scss} : Format code using Prettier with `yarn prettier --write <file>`
Applied to files:
code/package.json
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Use Node.js 22.21.1 (see `.nvmrc`) and Yarn 4.9.1 for development
Applied to files:
code/package.json
ejslint execution path in lint-staged
Related Issues #33433
What I did
Updated the
lint-stagedconfiguration for.ejsfiles.Previously, the configuration relied on a hardcoded physical path (
../scripts/node_modules/.bin/ejslint), which caused failures in the development environment depending on Yarn's dependency hoisting strategy (e.g., when dependencies are hoisted to the root or when using PnP).I replaced the hardcoded path with
yarn --cwd ../scripts ejslint. This leverages Yarn's resolution mechanism to reliably locate and execute theejslintbinary regardless of the underlying directory structure.Checklist for Contributors
Testing
This is an internal tooling fix, so no automated tests are applicable.
Manual testing
.ejsfiles (e.g.,code/lib/cli/src/automigrate/templates)..ejsfile (e.g., add a whitespace).git add <path-to-file>.yarn lint-stagedmanually in the root, or attempt to commit viagit commit.ejslintruns successfully without throwing a "No such file or directory" error regarding the executable path.Documentation
Internal build script change, no documentation update required.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.