Registry / devops / lint-staged.sh

lint-staged.sh

JSON →
library0.6.9jsnpmunverified

A minimal shell script to run linters/formatters against files staged in Git. Version 0.6.9 is the latest stable release, with no scheduled cadence. Unlike the npm lint-staged package, this script has no dependencies, no configuration file, and no automatic backup or reset on failure. It simply evaluates a command with the list of staged files filtered by glob patterns. Designed for users who want a lightweight, transparent alternative to lint-staged. No runtime, no Node.js required; works in any Bourne-compatible shell.

npm install lint-staged.sh
INSTALL
IMPORT
SIG · LINT-STAGED.SH
L
lint-staged.sh
devopsjavascriptv0.6.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lint-staged.sh
✓ npx skills install https://github.com/lint-staged/lint-staged.sh
✗ npm install lint-staged.sh
Installing via npm is optional; the primary method is via skills.sh or copying the script directly.
pre-commit hook
✓ #!/bin/sh lint-staged.sh "command" "*.js" "*.json" git update-index --again
✗ #!/bin/sh lint-staged.sh "command" "*.js" *.json
Glob patterns should be quoted to prevent shell expansion before the script sees them.
usage
✓ lint-staged.sh "eslint --fix" "*.js"
✗ lint-staged.sh eslint --fix *.js
The command and globs must be separate arguments. Run as a shell script, not an npm package.

Shows how to install and use lint-staged.sh with npx prettier to format staged files, then update git index.

#!/bin/sh # Install lint-staged.sh via skills.sh npx skills install https://github.com/lint-staged/lint-staged.sh # Example: format staged JavaScript and Markdown files with prettier # Run this in a pre-commit hook lint-staged.sh "npx prettier --write" "*.js" "*.md" git update-index --again
Debug
Known issues
gotchaGlob patterns are not automatically escaped; shell expansion may cause unexpected behavior.
fix
Always quote glob patterns: "*.js" instead of *.js
affects: >=0.0.0
gotchaNo automatic staging of changes after linter fixes; you must manually run 'git update-index --again'.
fix
Add 'git update-index --again' after the lint-staged.sh command in your hook.
affects: >=0.0.0
gotchaThe script does not revert changes on failure; files may be partially modified if the linter fails.
fix
Consider wrapping in a backup mechanism or use lint-staged npm package if rollback is needed.
affects: >=0.0.0
Errors
Common errors & fixes
lint-staged.sh: not found
The script is not installed or not in PATH.
fix
Install via 'npx skills install https://github.com/lint-staged/lint-staged.sh' or copy the script to a directory in PATH.
Unexpected file list: the command received too many/too few files
Glob patterns were expanded by the shell before being passed to the script.
fix
Quote glob patterns: lint-staged.sh "command" "*.js"
Upgrade
Version history
0.6.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lint-staged.sh — npm install lint-staged.sh · libregistry