Setup lint-staged
Set up lint-staged for optimized pre-commit validation in a target repository.
When to Use
- Setting up a new repo for Ralph builds
- Optimizing an existing repo's pre-commit hooks
- User asks to "setup lint-staged" or "optimize pre-commit"
Execution
Follow @context/blocks/scm/lint-staged-setup.md
Before each step:
- Check if already configured (package.json has
lint-stagedkey) - Confirm package manager (npm/pnpm/bun)
- Verify husky is installed if using husky hooks
Prerequisites
- Node.js project with
package.json - ESLint and Prettier configured
- Git hooks setup (husky recommended)
Steps Overview
- Install lint-staged
- Configure lint-staged in package.json
- Add helper scripts
- Update pre-commit hook with smart file detection
- Verify with test commits