Biome is a blazing-fast formatter and linter written in Rust. It replaces both ESLint and Prettier — and runs 35x faster.
Setup: Zero Config
npx @biomejs/biome init
This creates biome.json:
{
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": { "recommended": true }
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
}
}
Format: 35x Faster Than Prettier
# Format files
biome format --write src/
# Check without writing
biome format src/
# Format specific files
biome format --write src/index.ts src/utils.ts
Biome formats JavaScript, TypeScript, JSX, TSX, JSON, CSS, and GraphQL.
Lint: 300+ Rules
# Lint with auto-fix
biome lint --write src/
# Check only
biome check src/
# Both format + lint
biome check --write src/
Configuration: Fine-Grained Control
{
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "error",
"noDoubleEquals": "error"
},
"complexity": {
"noForEach": "warn",
"useFlatMap": "error"
},
"style": {
"useConst": "error",
"noNonNullAssertion": "warn"
},
"correctness": {
"noUnusedVariables": "error",
"noUnusedImports": "error"
},
"nursery": {
"useSortedClasses": "warn"
}
}
},
"formatter": {
"lineWidth": 100,
"indentStyle": "tab"
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "all"
}
},
"json": {
"formatter": {
"trailingCommas": "none"
}
}
}
Import Sorting: Built-In
// Before
import { useState } from "react";
import axios from "axios";
import { Button } from "./components";
import type { User } from "./types";
import path from "node:path";
// After biome check --write
import path from "node:path";
import { useState } from "react";
import axios from "axios";
import { Button } from "./components";
import type { User } from "./types";
VS Code Integration
// .vscode/settings.json
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
}
}
Per-File Overrides
{
"overrides": [
{
"include": ["*.test.ts", "*.spec.ts"],
"linter": {
"rules": {
"suspicious": { "noExplicitAny": "off" }
}
}
},
{
"include": ["scripts/**"],
"formatter": { "lineWidth": 120 }
}
]
}
Benchmarks
| Tool | Format 1000 files |
|---|---|
| Biome | 0.3s |
| Prettier | 11s |
| ESLint + Prettier | 15s |
Clean code for scraping projects? My Apify tools follow strict code quality standards.
Custom tooling setup? Email spinov001@gmail.com
Top comments (0)