Skip to content

chore: extend biome to all supported files and enforce formatting in CI - #32

Merged
Bilb merged 2 commits into
mainfrom
chore/enforce-formatting
Sep 1, 2026
Merged

chore: extend biome to all supported files and enforce formatting in CI#32
Bilb merged 2 commits into
mainfrom
chore/enforce-formatting

Conversation

@Bilb

@Bilb Bilb commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Replaces #31, which added Prettier for this. Biome 2.1.2 formats JSON and CSS natively, so broadening its includes covers 121 of the files a second formatter would have — leaving only README.md and two YAML files uncovered. Not worth a second config to keep in lockstep.

Problem

Two gaps:

  1. biome.json had "includes": ["./**/*.ts", "./**/*.tsx"], so next.config.js, tailwind.config.js, knip.config.js, tsconfig.json and styles/globals.css were formatted by nothing.
  2. The Lint workflow ran biome lint, which checks lint rules but not formatting. Nothing enforced format anywhere.

There was also an editor symptom: with no repo-level formatter pinned, a contributor whose global VSCode settings point at the Prettier extension gets Prettier's defaults on save, which disagree with biome.json on printWidth (80 vs 100), trailingComma (all vs es5) and embedded-CSS reformatting inside styled.* templates. On pages/pro.tsx that was a 345-line diff on every save.

Changes

biome.jsonincludes broadened to **, with vcs.useIgnoreFile enabled so build outputs come from .gitignore rather than a hand-maintained exclusion list. ignoreUnknown: true skips the types Biome has no formatter for (md, yaml, images, fonts).

locales/ stays excluded: they're Crowdin exports and differ only by a missing trailing newline, so formatting them would fail CI on every sync. contentful/export.json is a generated CLI dump.

css.formatter.quoteStyle is set to single — Biome defaults CSS to double quotes, which would have churned every url() and font-family in globals.css against the existing convention.

.vscode/settings.json (committed, with a .gitignore negation) pins biomejs.biome as the formatter for js/ts/json/css. Workspace settings beat user settings, so this fixes format-on-save without anyone editing their global config. .vscode/extensions.json recommends the extension.

Workflow — formatting is checked in a separate step with if: always(), not chained onto the lint step. See below.

package.json — one new script, "format:check": "biome format". No new dependency.

Note: the lint step will show red

biome lint already fails on main with 12 errors and has since the workflow was added — run 33366786839 failed on the merge of #30, and the PR that introduced it failed too. The gate has never passed.

Those are pre-existing and unrelated to formatting (noExplicitAny across services/, noNonNullAssertion, noDangerouslySetInnerHtml, noExcessiveCognitiveComplexity, unreachable code in lib/proBackend.ts). They involve real code decisions, so they belong in a separate PR.

This is why the format check is a separate step: chained as biome lint && biome format, the always-failing lint would short-circuit and the format check would silently never run. Split, Check formatting passes while the lint step stays red for the pre-existing reasons.

Broadening includes does not make that worse — error count is still exactly 12, unchanged from main. It adds 4 warnings on next.config.js (unused vars/params), which don't fail the build.

Verification

  • pnpm run format:check passes
  • biome lint reports 12 errors, identical to main
  • next.config.js, tailwind.config.js, postcss.config.js still require() to the same shape; tsc --showConfig still resolves 109 files
  • Diff is formatting-only. pages/[slug].tsx is a missing semicolon (there's also a stray console.log(forbiddenWords) on line 46 that predates this and is left alone).

Bilb added 2 commits September 1, 2026 09:00
biome.json only included ts/tsx, so the js configs, css and json in the repo
were formatted by nothing, and the Lint workflow ran `biome lint`, which
checks lint rules but not formatting.

Broaden `includes` to `**` and let biome respect .gitignore instead of
hand-maintaining build-output exclusions. `ignoreUnknown` skips the file
types biome has no formatter for. locales/ stays excluded: they are crowdin
exports and differ only by a missing trailing newline, which would fail CI
on every sync.

CSS quoteStyle is set to single to match the existing stylesheet and the
javascript config; biome otherwise defaults css to double quotes.

The workflow checks formatting in a separate step so that the pre-existing
lint failures on main do not mask it.

A committed .vscode/settings.json pins biome as the formatter for this
workspace, so format-on-save agrees with CI regardless of a contributor's
global editor settings.
@Bilb

Bilb commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

Removed console.log(forbiddenWords) entirely in 6be470f rather than keeping it formatted — it was a debug leftover.

The other console.log calls in that file are deliberate build-progress output, so I left them.

This does mean the PR is no longer strictly formatting-only. pages/[slug].tsx now shows a two-line deletion instead of a semicolon fix.

@Bilb
Bilb merged commit 8ae5c6b into main Sep 1, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant