stringifyLockFile writes varar.lock.json with two-space indentation, deliberately and byte-stably ("so a clean re-run produces no git diff"). That guarantee holds only if nothing else formats the file — and in a project where prettier formats JSON with tabs, the two tools overwrite each other indefinitely.
Every vitest run rewrites it two-space. Every prettier --write . rewrites it tabbed. In my repo that is a 924-line diff each way, on a file nobody reads, appearing in every review.
I found it because main had a commit titled "Formatting" containing exactly one file — varar.lock.json, 924 insertions, 924 deletions — someone mopping up the churn by hand without realising it would come straight back.
The fix is trivial, finding it is not
# .prettierignore
varar.lock.json
It just needs to occur to you that the lock file is generated, which is easy to miss because it is committed and JSON and sitting in the repo root looking editable.
Suggestions
- Have
varar init add it to .prettierignore (and .editorconfig / .gitattributes where relevant) when it finds one. This is the kind of thing a scaffolder should just do.
- Say so in
reference/configuration — one line: "varar.lock.json is generated on every run; add it to your formatter's ignore file." Cheap, and sufficient on its own.
- Possibly match the file's existing indentation on write. Tempting, but it trades a stable canonical format for a format that depends on what happened to be there, and the ports would all have to agree. I'd take (1)+(2) over this.
Somewhat related to #61, which was also about a markdown/JSON formatter and Varar disagreeing over the same bytes — there may be a general "Varar and your formatter" section worth writing.
stringifyLockFilewritesvarar.lock.jsonwith two-space indentation, deliberately and byte-stably ("so a clean re-run produces no git diff"). That guarantee holds only if nothing else formats the file — and in a project where prettier formats JSON with tabs, the two tools overwrite each other indefinitely.Every
vitest runrewrites it two-space. Everyprettier --write .rewrites it tabbed. In my repo that is a 924-line diff each way, on a file nobody reads, appearing in every review.I found it because
mainhad a commit titled "Formatting" containing exactly one file —varar.lock.json, 924 insertions, 924 deletions — someone mopping up the churn by hand without realising it would come straight back.The fix is trivial, finding it is not
It just needs to occur to you that the lock file is generated, which is easy to miss because it is committed and JSON and sitting in the repo root looking editable.
Suggestions
varar initadd it to.prettierignore(and.editorconfig/.gitattributeswhere relevant) when it finds one. This is the kind of thing a scaffolder should just do.reference/configuration— one line: "varar.lock.json is generated on every run; add it to your formatter's ignore file." Cheap, and sufficient on its own.Somewhat related to #61, which was also about a markdown/JSON formatter and Varar disagreeing over the same bytes — there may be a general "Varar and your formatter" section worth writing.