Adopt Biome with @repobuddy/biome
Add Biome to a project, extend a preset, and fix the first run’s findings.
-
Install both packages.
Terminal window # pnpm (use npm install -D or yarn add -D for the others)pnpm add -D @biomejs/biome @repobuddy/biomeThe package needs
@biomejs/biome >= 2. -
Create
biome.jsonand extend a preset. See Choose a config.biome.json {"$schema": "./node_modules/@biomejs/biome/configuration_schema.json","extends": ["@repobuddy/biome"],"vcs": {"enabled": true,"clientKind": "git","useIgnoreFile": true}}vcsmakes Biome skip files that.gitignoreignores. It is optional. -
Add scripts to
package.json.{"scripts": {"check": "biome check","check:fix": "biome check --write","format": "biome format --write"}} -
Run the check.
Terminal window pnpm checkBiome lints, checks formatting, and checks import order in one pass. It exits
1when any error remains. -
Apply the safe fixes.
Terminal window pnpm check:fix -
Fix what remains by hand, or suppress one case with a comment.
// biome-ignore lint/suspicious/noConsole: CLI outputconsole.log('done')
What to expect on the first run
Section titled “What to expect on the first run”With recommended:
- Formatting differences in many files: tabs, single quotes, no semicolons, line width 120.
--writefixes them. - Unsorted imports, from the
organizeImportsassist.--writefixes them. - Unused imports, which the config marks
errorwith a safe fix.--writeremoves them. import 'fs'rewritten toimport 'node:fs'(useNodejsImportProtocol).console.logcalls (noConsole). Replace them withconsole.infoor another allowed method.- Unused variables and parameters.
noUnusedVariablesis anerror; Biome’s unsafe fix prefixes the name with an underscore, so review the change.
With performant, expect the same formatting differences (with trailing commas removed), but no import sorting, no
console.log findings, and unused imports as warnings.
To fail on warnings too (for CI), add --error-on-warnings:
biome check --error-on-warningsFinished config
Section titled “Finished config”{ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "extends": ["@repobuddy/biome"], "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }}Verify
Section titled “Verify”Run pnpm check. It reports Checked N files and exits 0 once the findings are fixed.