feat: auto-detect formatter in post-edit hook (Biome/Prettier)

The post-edit-format hook was hardcoded to use Prettier. Projects using
Biome had their code reformatted with Prettier defaults (e.g. double
quotes overwriting single quotes).

Now the hook walks up from the edited file to find the project root,
then checks for config files:
- biome.json / biome.jsonc → runs Biome
- .prettierrc / prettier.config.* → runs Prettier
- Neither found → skips formatting silently
This commit is contained in:
Jonghyeok Park
2026-02-20 14:30:01 +09:00
parent 24047351c2
commit 4eb6fbdd3f
2 changed files with 64 additions and 11 deletions

View File

@@ -108,7 +108,7 @@
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/post-edit-format.js\""
}
],
"description": "Auto-format JS/TS files with Prettier after edits"
"description": "Auto-format JS/TS files after edits (auto-detects Biome or Prettier)"
},
{
"matcher": "Edit",