chore: extend biome to all supported files and enforce formatting in CI - #32
Merged
Conversation
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.
Collaborator
Author
|
Removed The other This does mean the PR is no longer strictly formatting-only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #31, which added Prettier for this. Biome 2.1.2 formats JSON and CSS natively, so broadening its
includescovers 121 of the files a second formatter would have — leaving onlyREADME.mdand two YAML files uncovered. Not worth a second config to keep in lockstep.Problem
Two gaps:
biome.jsonhad"includes": ["./**/*.ts", "./**/*.tsx"], sonext.config.js,tailwind.config.js,knip.config.js,tsconfig.jsonandstyles/globals.csswere formatted by nothing.Lintworkflow ranbiome 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.jsononprintWidth(80 vs 100),trailingComma(allvses5) and embedded-CSS reformatting insidestyled.*templates. Onpages/pro.tsxthat was a 345-line diff on every save.Changes
biome.json—includesbroadened to**, withvcs.useIgnoreFileenabled so build outputs come from.gitignorerather than a hand-maintained exclusion list.ignoreUnknown: trueskips 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.jsonis a generated CLI dump.css.formatter.quoteStyleis set tosingle— Biome defaults CSS to double quotes, which would have churned everyurl()andfont-familyinglobals.cssagainst the existing convention..vscode/settings.json(committed, with a.gitignorenegation) pinsbiomejs.biomeas 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.jsonrecommends 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
lintstep will show redbiome lintalready fails onmainwith 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 (
noExplicitAnyacrossservices/,noNonNullAssertion,noDangerouslySetInnerHtml,noExcessiveCognitiveComplexity, unreachable code inlib/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 formattingpasses while the lint step stays red for the pre-existing reasons.Broadening
includesdoes not make that worse — error count is still exactly 12, unchanged frommain. It adds 4 warnings onnext.config.js(unused vars/params), which don't fail the build.Verification
pnpm run format:checkpassesbiome lintreports 12 errors, identical tomainnext.config.js,tailwind.config.js,postcss.config.jsstillrequire()to the same shape;tsc --showConfigstill resolves 109 filespages/[slug].tsxis a missing semicolon (there's also a strayconsole.log(forbiddenWords)on line 46 that predates this and is left alone).