We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eedcf9e commit c2a71fbCopy full SHA for c2a71fb
.claude/hooks/format-files.sh
@@ -0,0 +1,11 @@
1
+#!/bin/bash
2
+# Format files with Prettier after write/edit
3
+
4
+file_path=$(jq -r '.tool_input.file_path' 2>/dev/null)
5
6
+if [ -z "$file_path" ] || [ "$file_path" = "null" ]; then
7
+ exit 0
8
+fi
9
10
+# Run Prettier, suppress errors, always exit 0
11
+npx prettier --write "$file_path" 2>/dev/null || true
.claude/settings.json
@@ -0,0 +1,15 @@
+{
+ "hooks": {
+ "PostToolUse": [
+ {
+ "matcher": "Write|Edit",
+ "hooks": [
+ "type": "command",
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/format-files.sh"
+ }
+ ]
12
13
14
15
+}
0 commit comments