Skip to content

chore(lint): make the root lint command non-mutating and site-aware - #18

Open
dchaudhari7177 wants to merge 1 commit into
crafter-station:mainfrom
dchaudhari7177:chore/15-nonmutating-lint
Open

chore(lint): make the root lint command non-mutating and site-aware#18
dchaudhari7177 wants to merge 1 commit into
crafter-station:mainfrom
dchaudhari7177:chore/15-nonmutating-lint

Conversation

@dchaudhari7177

Copy link
Copy Markdown

Closes #15.

What changed

"lint":      "bun run lint:cli && bun run lint:site",
"lint:cli":  "biome check src test bin package.json tsconfig.json biome.json",
"lint:site": "cd site && biome check .",
"lint:fix":  "bun run lint:cli -- --write && bun run lint:site -- --write"

Two notes on the approach:

Why explicit paths in lint:cli rather than . — the nested-root abort happens during Biome's config discovery, so it fires whether or not files.includes would have excluded site/. Passing the root config's own include list as explicit paths keeps Biome from ever descending into site/.

Why not biome migrate --write — that's what Biome's own error message suggests, but it would fold site/ into the CLI's root config. The issue asks for both to be checked "using their respective Biome configurations", so I kept them as two independent roots and invoked each.

Acceptance

Criterion Result
bun run lint is non-mutating ✅ no --write on either leg
checks CLI and site under their own configs ✅ 24 files + 6 files
exits zero on a clean checkout of main ✅ exit 0
leaves git status --short empty ✅ empty
auto-fix retained under an explicit name lint:fix

I also checked the command actually fails when it should, rather than just passing on a clean tree — dropped a badly formatted src/_tmp_lintcheck.ts in: bun run lint exits 1, bun run lint:fix exits 0 and rewrites the file. (Removed again; not in the diff.)

One thing to know about verifying this on Windows

On a default Windows checkout bun run lint fails on ~10 files, all format diffs — git converted LF to CRLF on checkout and Biome wants LF. It's a checkout artifact, not a repo problem, but it made the "exits zero on a clean checkout" criterion unverifiable in place.

I confirmed against a fresh git -c core.autocrlf=false clone instead, and all the numbers above come from that. A .gitattributes with * text=auto eol=lf would make the command usable on Windows checkouts too — happy to open a separate issue rather than widen this one.

"lint" was `biome check --write .`, so the one command contributors run
before opening a PR rewrote their working tree. It also could not check the
whole repo: `biome check .` from the root aborts with 'Found a nested root
configuration' because site/ carries its own root biome.json.

lint now runs the two packages under their own configs:

  lint      -> lint:cli && lint:site   (read-only)
  lint:cli  -> biome check <explicit paths>
  lint:site -> cd site && biome check .
  lint:fix  -> the same two with --write

lint:cli passes the root config's own include list as explicit paths rather
than '.', which is what keeps Biome from descending into site/ and finding
the nested root. Splitting the two also keeps them independent roots, so
site/ keeps its own rules instead of being folded into the CLI's.

Closes crafter-station#15
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

@dchaudhari7177 is attempting to deploy a commit to the Crafter Station Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

1 participant