lint-staged-claude-hook
v2.0.3
Published
Use lint-staged config as Claude Code hook
Maintainers
Readme
lint-staged-claude-hook
Use your lint-staged config as a Claude Code hook.
Install
Requires lint-staged >=16.0.0 as peer dependency.
npm install lint-staged lint-staged-claude-hookUsage
CLI
# Print commands for files
lint-staged-claude-hook src/index.js src/utils.js
# Execute commands
lint-staged-claude-hook --run src/index.js
# JSON output
lint-staged-claude-hook --json src/index.jsAs Claude Hook
Add to .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": { "tool_name": "Edit|Write" },
"hooks": ["lint-staged-claude-hook --run"]
}
]
}
}The CLI reads Claude's hook JSON from stdin, extracts tool_input.file_path, and runs your lint-staged commands.
Options
-c, --config <path> Path to lint-staged config
--cwd <path> Working directory
-r, --run Execute commands (default: print only)
-v, --verbose Show output on success
-j, --json JSON output
-h, --help Show helpLicense
MIT
