Skip to content

pnpm lint fails on every file in a Windows clone because of line endings #62

Open

Description

@Ahmar004

In simple words

In a normal Windows clone of this repo, pnpm lint reports an error in all 11 files it checks, so a Windows contributor can't get a clean lint run before opening a PR. The code is fine. Git gave the files Windows line endings, and Biome, the formatter, expects Linux ones.

Why it happens

  1. A line ending is the invisible character at the end of each line: LF on Linux and macOS, CRLF ("carriage return + line feed") on Windows.
  2. The repo has no .gitattributes file, the file that tells Git how to treat line endings.
  3. Git for Windows is installed with core.autocrlf=true by default. That setting stores LF in the repository but checks files out with CRLF. Every file in this repo is stored with LF (git ls-files --eol shows i/lf for all 27), so on Windows every one arrives as w/crlf.
  4. biome.json doesn't set lineEnding, so Biome uses its default, LF. It sees a CRLF file as misformatted, and biome check (= pnpm lint, package.json) reports each one. Every diff it prints is only a ␍ at the end of each line.
  5. CI (ci.yml) runs on Ubuntu, where the checkout is LF, so CI never sees this.

Who is affected

Anyone who clones the repo on Windows with Git's default settings (no WSL). The other steps work there: pnpm generate && git diff --exit-code, pnpm typecheck and node check-claims.mjs all pass in the same clone. Only lint fails.

How to see it (Windows 11, Node 24, Git for Windows defaults)

git clone https://github.com/prooflinedev/sdk-typescript; cd sdk-typescript
pnpm install --frozen-lockfile
git ls-files --eol src/index.ts
# i/lf    w/crlf  attr/                 src/index.ts
pnpm lint
# Checked 11 files in 41ms. No fixes applied.
# Found 11 errors.

Suggested fix

Add a .gitattributes with * text=auto eol=lf, so Git checks text files out with LF on every OS, like CI. No file is stored with CRLF, so this changes nothing in the repository itself. text=auto still lets Git detect binary files and leave them alone. The Python SDK got the same line in prooflinedev/sdk-python#88.

I have a fix with a test ready and will open a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions