[GH-ISSUE #5598] pnpm check always fails on Windows checkouts: prettier flags every file over CRLF line endings #3100

Closed
opened 2026-10-21 05:59:36 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Aug 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5598

Originally assigned to: @kolacheee on GitHub.

What happens

On a normal Windows checkout, pnpm check — the baseline validation command both CONTRIBUTING.md and CLAUDE.md tell every contributor to run — always fails at the format:check step. Prettier reports "code style issues" in every single .ts/.tsx file (currently ~1,300 files), even on a completely clean tree with zero real changes. The failure has nothing to do with formatting: it's line endings.

Why

Three defaults conflict:

  1. .gitattributes has * text=auto — files are stored LF in the repo, but Git converts them on checkout.
  2. Git for Windows installs with core.autocrlf=true by default — so the working tree gets CRLF.
  3. .prettierrc doesn't set endOfLine, and prettier's default is "lf" — so prettier --check flags every CRLF line as a violation.

CI never sees this because the only job that runs pnpm check (pnpm-validate in pull-request-checks.yml) runs on ubuntu-latest, where checkouts are LF. So the check is green in CI and red on every Windows contributor's machine, which trains Windows contributors to ignore pnpm check failures — the opposite of what a baseline gate is for.

Try it yourself (on Windows, core.autocrlf=true, clean clone)

git ls-files --eol packages/shared/src/utils/xml-wrapper.ts

prints i/lf w/crlf — LF in the repo, CRLF on disk. Then:

npx prettier --check --config .prettierrc packages/shared/src/utils/xml-wrapper.ts

fails, while the same file passes the moment line endings are taken out of the picture:

npx prettier --check --end-of-line auto --config .prettierrc packages/shared/src/utils/xml-wrapper.ts

(pnpm format:check is just the first command over packages/**/*.{ts,tsx}, hence ~1,300 warnings.)

Two possible fixes

  • Add "endOfLine": "auto" to .prettierrc (one line, no side effects). Prettier then accepts the checkout's own line endings everywhere. The repo still stays LF because * text=auto normalizes on commit, and CI still checks real formatting on its LF checkout. This is the low-risk option.
  • Or add * text=auto eol=lf to .gitattributes so Windows working trees are LF too (the existing *.bat text eol=crlf exception already covers batch files). This is the more thorough option — it also fixes the handful of regression lanes that compare file contents against LF-assuming patterns and fail on CRLF checkouts for the same underlying reason — but every existing Windows clone needs a re-checkout (git checkout . after deleting/renormalizing, or a fresh clone) before it takes effect.

Happy to PR either — the .prettierrc one-liner if you want the safe fix now, or the .gitattributes change if you'd rather solve the whole CRLF class at once.

Verified on Windows 11, Git for Windows with core.autocrlf=true, prettier 3.8.3 (the version pinned in the lockfile), current staging.

Originally created by @kolacheee on GitHub (Aug 28, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5598 Originally assigned to: @kolacheee on GitHub. **What happens** On a normal Windows checkout, `pnpm check` — the baseline validation command both `CONTRIBUTING.md` and `CLAUDE.md` tell every contributor to run — always fails at the `format:check` step. Prettier reports "code style issues" in every single `.ts`/`.tsx` file (currently ~1,300 files), even on a completely clean tree with zero real changes. The failure has nothing to do with formatting: it's line endings. **Why** Three defaults conflict: 1. `.gitattributes` has `* text=auto` — files are stored LF in the repo, but Git converts them on checkout. 2. Git for Windows installs with `core.autocrlf=true` by default — so the working tree gets CRLF. 3. `.prettierrc` doesn't set `endOfLine`, and prettier's default is `"lf"` — so `prettier --check` flags every CRLF line as a violation. CI never sees this because the only job that runs `pnpm check` (`pnpm-validate` in `pull-request-checks.yml`) runs on `ubuntu-latest`, where checkouts are LF. So the check is green in CI and red on every Windows contributor's machine, which trains Windows contributors to ignore `pnpm check` failures — the opposite of what a baseline gate is for. **Try it yourself** (on Windows, `core.autocrlf=true`, clean clone) ```bash git ls-files --eol packages/shared/src/utils/xml-wrapper.ts ``` prints `i/lf w/crlf` — LF in the repo, CRLF on disk. Then: ```bash npx prettier --check --config .prettierrc packages/shared/src/utils/xml-wrapper.ts ``` fails, while the same file passes the moment line endings are taken out of the picture: ```bash npx prettier --check --end-of-line auto --config .prettierrc packages/shared/src/utils/xml-wrapper.ts ``` (`pnpm format:check` is just the first command over `packages/**/*.{ts,tsx}`, hence ~1,300 warnings.) **Two possible fixes** - **Add `"endOfLine": "auto"` to `.prettierrc`** (one line, no side effects). Prettier then accepts the checkout's own line endings everywhere. The repo still stays LF because `* text=auto` normalizes on commit, and CI still checks real formatting on its LF checkout. This is the low-risk option. - **Or add `* text=auto eol=lf` to `.gitattributes`** so Windows working trees are LF too (the existing `*.bat text eol=crlf` exception already covers batch files). This is the more thorough option — it also fixes the handful of regression lanes that compare file contents against LF-assuming patterns and fail on CRLF checkouts for the same underlying reason — but every existing Windows clone needs a re-checkout (`git checkout . ` after deleting/renormalizing, or a fresh clone) before it takes effect. Happy to PR either — the `.prettierrc` one-liner if you want the safe fix now, or the `.gitattributes` change if you'd rather solve the whole CRLF class at once. Verified on Windows 11, Git for Windows with `core.autocrlf=true`, prettier 3.8.3 (the version pinned in the lockfile), current `staging`.
bsakaguchi 2026-10-21 05:59:36 +07:00
Author
Owner

@kolacheee commented on GitHub (Aug 29, 2026):

Going with the thorough option (kolacheee, agent-assisted): .gitattributes eol=lf plus an explicit endOfLine pin in .prettierrc — it fixes the regression lanes that fail over CRLF for the same underlying reason, not just prettier. PR incoming with an end-to-end verification on a fresh autocrlf=true clone.

<!-- gh-comment-id:5459316004 --> @kolacheee commented on GitHub (Aug 29, 2026): Going with the thorough option (kolacheee, agent-assisted): `.gitattributes` `eol=lf` plus an explicit `endOfLine` pin in `.prettierrc` — it fixes the regression lanes that fail over CRLF for the same underlying reason, not just prettier. PR incoming with an end-to-end verification on a fresh `autocrlf=true` clone.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3100
No description provided.