Biome Cheat Sheet

Quick reference for Biome: configuration, linting rules, formatting, import sorting, and migration from ESLint/Prettier. One tool for JavaScript/TypeScript code quality.

CLI Commands Configuration (biome.json) Linting Rules Formatting Options Migration from ESLint/Prettier

CLI Commands

npx @biomejs/biome init Create a default biome.json config file
npx @biomejs/biome check . Run linter + formatter check on all files
npx @biomejs/biome format --write . Format all files in place
npx @biomejs/biome lint --write . Lint and auto-fix all files
npx @biomejs/biome check --write --unsafe . Apply all fixes including unsafe suggestions

Configuration (biome.json)

{ "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json" } Add JSON schema for editor autocompletion
{ "files": { "include": ["src/**"], "ignore": ["dist/**"] } } Include/exclude files globally
{ "formatter": { "indentStyle": "space", "indentWidth": 2, "lineWidth": 100 } } Configure formatter indent style, width, and line width
{ "linter": { "enabled": true, "rules": { "recommended": true } } } Enable linter with recommended rules
{ "organizeImports": { "enabled": true } } Enable automatic import sorting

Linting Rules

{ "rules": { "suspicious": { "noExplicitAny": "error" } } } Disallow explicit any type in TypeScript
{ "rules": { "complexity": { "noForEach": "warn" } } } Warn on Array.forEach (prefer for...of)
{ "rules": { "style": { "useConst": "error", "noNonNullAssertion": "warn" } } } Enforce const and warn on non-null assertions
{ "rules": { "correctness": { "noUnusedVariables": "error", "noUnusedImports": "error" } } } Error on unused variables and imports
{ "rules": { "nursery": { "useSortedClasses": "warn" } } } Warn on unsorted Tailwind CSS classes (nursery rule)

Formatting Options

{ "javascript": { "formatter": { "quoteStyle": "single", "semicolons": "asNeeded" } } } Single quotes and semicolons only when needed for JS/TS
{ "javascript": { "formatter": { "trailingCommas": "all", "arrowParentheses": "asNeeded" } } } Trailing commas everywhere and optional arrow parens
{ "json": { "formatter": { "trailingCommas": "none" } } } Disable trailing commas in JSON files
{ "css": { "formatter": { "quoteStyle": "double" } } } Configure CSS-specific formatting options
{ "formatter": { "formatWithErrors": true } } Format files even if they contain syntax errors

Migration from ESLint/Prettier

npx @biomejs/biome migrate eslint --write Auto-migrate ESLint config to Biome rules
npx @biomejs/biome migrate prettier --write Auto-migrate Prettier config to Biome formatter
{ "overrides": [{ "include": ["*.test.ts"], "linter": { "rules": { "suspicious": { "noExplicitAny": "off" } } } }] } Override rules per file pattern (like ESLint overrides)
// biome-ignore lint/suspicious/noExplicitAny: reason Inline ignore a specific lint rule with reason
{ "linter": { "rules": { "recommended": true, "style": { "all": true } } } } Enable recommended + all rules in a category
Step-by-Step Guide

How to Format JSON Online

Read Guide →

More Cheat Sheets