mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
a8fa1a3b11
The lint-fix pre-commit step runs `oxlint --fix` + `oxfmt --write` over staged files. When `package.json` is part of the staged set, oxfmt rewrites the file into JSON5 syntax (4-space indent, trailing commas after the last key in every object, compacted single-line objects). The result is invalid strict JSON that pnpm rejects with `ERR_PNPM_JSON_PARSE` at line 8 column 5, blocking every commit that touches any `package.json`. This was bypassed in PRs #5054 and #5055 via `LEFTHOOK_EXCLUDE=lint-fix`; this commit fixes it at the source by removing `json,jsonc,json5` from the lint-fix glob. Reproduction (with the buggy glob): - Apply PR #5055's edit to packages/voice/package.json - git add + run `lefthook run pre-commit --command lint-fix` - oxfmt logs "1 file reformatted" - JSON.parse / pnpm install now fail on the rewritten file After the fix: - JSON-only staged sets cause lefthook to skip lint-fix ("no files for inspection") rather than mangle the JSON - TS/JS/etc. continue to flow through oxlint --fix + oxfmt --write unchanged - JSON formatting is left to pnpm and manual editing, both of which produce strict 2-space JSON oxfmt 0.36.0 exposes no per-file-type knob (printWidth/proseWrap/ ignorePatterns only); excluding json/jsonc/json5 from the glob is the minimal correct fix. A future oxfmt upgrade that ships a json formatter configurable via `.oxfmtrc.json` can re-add these extensions. This commit itself is being landed with `LEFTHOOK_EXCLUDE=lint-fix` because the bug being fixed currently blocks any path that exercises the lint-fix hook. The change touches only `lefthook.yml`, which is not a JSON file and would not be mangled — the exclude is purely defensive.
3.4 KiB
3.4 KiB