Use lint-staged config as Claude Code hook
npm install lint-staged-claude-hookUse your lint-staged config as a Claude Code hook.
Requires lint-staged >=16.0.0 as peer dependency.
``bash`
npm install lint-staged lint-staged-claude-hook
`bashPrint commands for files
lint-staged-claude-hook src/index.js src/utils.js
$3
Add to
.claude/settings.json:`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 to lint-staged config
--cwd Working directory
-r, --run Execute commands (default: print only)
-v, --verbose Show output on success
-j, --json JSON output
-h, --help Show help
``MIT