iamshaunjp / iamshaunjp/Claude-Code-Masterclass

Using jq and Prettier in a Hook for Windows users - lessons 19 | 20

Open
#4 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
165
Forks
161
PR merge metrics
No merged PRs in 30d

Description

There is an error in the course videos for windows users in the PowerShell terminal in VScode.

THE FIX CODE IS:

`
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | tr -d '\\r' | { read -r fp; [[ \"$fp\" =~ \\.tsx?$ ]] && npx prettier --write \"$fp\"; } 2>/dev/null || true"
}
]
}
]
}
`

What changed from the original version:

- tr -d '\\r' → -replace '\\r','' — strips carriage return characters natively in PowerShell
- read -r fp → direct variable assignment
- 2>/dev/null || true → PowerShell silently ignores errors by default; you can add -ErrorAction SilentlyContinue if needed

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.