Skip to content

Commit 5a30fe4

Browse files
Fix claude imports. (tldraw#7161)
Our claude config has a hook set to run prettier on `Edit|MultiEdit|Write`. This causes issues with imports as it always does the import first, then writes (which runs prettier and removes the unused import), only then it adds the usage. This PR uses an alternative. What if we only trigger prettier on `Stop` event, which triggers when claude is done. Think it wont trigger if claude gets interrupted by the user. Worth a try, can always revert. ### Change type - [x] `other` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Switches the Claude hook to run Prettier on Stop, formatting only changed files detected by git diff. > > - **Config (`.claude/settings.json`)**: > - Switch hook from `PostToolUse` to `Stop`. > - Update Prettier command to format only changed files (`git diff --name-only --diff-filter=ACMR | grep -E '\.(ts|tsx|js|jsx|json|md)$' | xargs -r yarn run -T prettier --write`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2ff3d46. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 6230dc7 commit 5a30fe4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

.claude/settings.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"hooks": {
3-
"PostToolUse": [
3+
"Stop": [
44
{
5-
"matcher": "Edit|MultiEdit|Write",
65
"hooks": [
76
{
87
"type": "command",
9-
"command": "jq -r '.tool_input.file_path' | { read file_path; yarn run -T prettier --write \"$file_path\"; }"
8+
"command": "git diff --name-only --diff-filter=ACMR | grep -E '\\.(ts|tsx|js|jsx|json|md)$' | xargs -r yarn run -T prettier --write"
109
}
1110
]
1211
}

0 commit comments

Comments
 (0)