lint-staged-shellcheck
raw JSON → 0.1.2 verified Fri May 01 auth: no javascript
A shim to run shellcheck on staged shell files via lint-staged, supporting shebang detection and filename patterns. Version 0.1.2 (latest). Stable but low activity. Key differentiator: works around lint-staged's lack of shebang-based file matching, allowing shell scripts without .sh extension to be checked. Ignores via .shellcheckignore. Requires shellcheck binary and lint-staged as peer.
Common errors
error shellcheck: command not found ↓
cause shellcheck binary not installed on the system.
fix
Install shellcheck: brew install shellcheck (macOS) or apt install shellcheck (Linux).
error No staged files found ↓
cause lint-staged is not passing any files to the command, or the '*' glob is missing.
fix
Ensure lint-staged config has a '*' rule that includes 'lint-staged-shellcheck'.
Warnings
gotcha lint-staged-shellcheck does NOT auto-install shellcheck binary; you must install it separately via brew, apt, etc. ↓
fix Install shellcheck: brew install shellcheck (macOS) or apt install shellcheck (Linux).
gotcha This package only works as a lint-staged command; it cannot run standalone without lint-staged's staged file context. ↓
fix Ensure lint-staged is configured as the runner.
deprecated Node.js versions < 10 are not supported; package uses modern syntax. ↓
fix Upgrade Node.js to >= 10.
Install
npm install lint-staged-shellcheck yarn add lint-staged-shellcheck pnpm add lint-staged-shellcheck Imports
- lint-staged-shellcheck wrong
require('lint-staged-shellcheck')correctnpx lint-staged-shellcheck - default wrong
"lint-staged-shellcheck --some-flag"correct"lint-staged-shellcheck"
Quickstart
// package.json
{
"lint-staged": {
"*": [
"lint-staged-shellcheck"
]
}
}
// Then in terminal:
npx lint-staged