16 lines
479 B
JSON

{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "FILE_PATH=$(node -p \"JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).tool_input.file_path\") && if [[ \"$FILE_PATH\" =~ \\.(ts|tsx|js|jsx)$ ]]; then npx eslint --fix \"$FILE_PATH\" >/dev/null || true; npx prettier --write \"$FILE_PATH\" >/dev/null || true; fi"
}
]
}
]
}
}