Skip to main content
Ganesh Joshi
Back to Blogs

Biome: fast linting and formatting for JavaScript and TypeScript

February 14, 20264 min read
Tips
Code editor or IDE, linting and formatting

Biome is a toolchain that does both linting and formatting for web projects. One config, one CLI, one dependency. It is written in Rust and is very fast. The formatter aims for high compatibility with Prettier, so migration is straightforward.

What is Biome?

Biome combines several tools into one:

Feature What it does
Formatter Formats JS, TS, JSX, JSON, CSS, HTML, GraphQL
Linter Catches bugs and style issues with hundreds of rules
Import organizer Sorts and groups imports
CLI Single command for all operations

One config file, one dependency. No more coordinating ESLint, Prettier, and import sorters.

Why Biome over ESLint + Prettier?

Aspect ESLint + Prettier Biome
Speed Slow (JavaScript) Fast (Rust, 10-100x faster)
Config Two config files One config file
Dependencies Multiple packages Single package
Format + lint Separate commands One check command
Plugin ecosystem Extensive Growing

Biome is best for teams that want speed and simplicity. If you rely heavily on specific ESLint plugins, check if Biome has equivalent rules.

Installation

npm install -D @biomejs/biome

Or with other package managers:

pnpm add -D @biomejs/biome
yarn add -D @biomejs/biome
bun add -D @biomejs/biome

Configuration

Initialize a config file:

npx @biomejs/biome init

This creates biome.json:

{
  "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  }
}

Formatter options

{
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 100,
    "lineEnding": "lf"
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "single",
      "semicolons": "always",
      "trailingCommas": "all"
    }
  }
}

Linter rules

{
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "complexity": {
        "noExcessiveCognitiveComplexity": "warn"
      },
      "suspicious": {
        "noExplicitAny": "error"
      },
      "style": {
        "useConst": "error"
      }
    }
  }
}

Ignore files

{
  "files": {
    "ignore": [
      "node_modules",
      "dist",
      ".next",
      "coverage"
    ]
  }
}

Running Biome

Check formatting (no changes)

npx @biomejs/biome format ./src

Apply formatting

npx @biomejs/biome format --write ./src

Run linter

npx @biomejs/biome lint ./src

Apply safe lint fixes

npx @biomejs/biome lint --write ./src

Check everything (recommended)

# Check only (for CI)
npx @biomejs/biome check ./src

# Check and fix (for local development)
npx @biomejs/biome check --write ./src

The check command runs formatting, linting, and import organization.

Package.json scripts

{
  "scripts": {
    "lint": "biome check .",
    "lint:fix": "biome check --write .",
    "format": "biome format --write ."
  }
}

Editor integration

VS Code

Install the Biome VS Code extension.

Add to .vscode/settings.json:

{
  "editor.defaultFormatter": "biomejs.biome",
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "quickfix.biome": "explicit",
    "source.organizeImports.biome": "explicit"
  }
}

Other editors

Biome has plugins for JetBrains IDEs, Neovim, Helix, and others. Check the Biome editor integrations.

Migrating from Prettier

Biome's formatter is designed to be Prettier-compatible:

  1. Run both in parallel on a test branch
  2. Compare output and fix any differences
  3. Update config to match your Prettier settings
  4. Remove Prettier once formatting matches

Most projects can migrate with minimal changes. Some edge cases (like very specific formatting preferences) may differ.

Migrating from ESLint

Biome covers many common ESLint rules:

ESLint rule Biome equivalent
no-unused-vars correctness/noUnusedVariables
no-console suspicious/noConsoleLog
prefer-const style/useConst
eqeqeq suspicious/noDoubleEquals
no-explicit-any suspicious/noExplicitAny

Check the Biome rules documentation for the full list and equivalents.

Migration steps

  1. List your current ESLint rules
  2. Find Biome equivalents (many are built-in)
  3. Identify unsupported rules (some plugin rules)
  4. Run both tools during transition
  5. Gradually remove ESLint as coverage is confirmed

CI integration

# GitHub Actions
- name: Lint and format check
  run: npx @biomejs/biome check .

Biome exits with error code 1 if issues are found, failing the CI check.

Biome vs alternatives

Tool Speed Format Lint Single config
Biome Very fast Yes Yes Yes
ESLint + Prettier Slow Yes Yes No
dprint Very fast Yes No Yes
Rome (deprecated) Fast Yes Yes Yes

Biome is the successor to Rome, with active development and growing adoption.

When to use Biome

Good fit:

  • New projects wanting fast, unified tooling
  • Teams tired of ESLint + Prettier configuration
  • CI pipelines where speed matters
  • Projects using standard rules

Consider alternatives if:

  • You rely on specific ESLint plugins not yet in Biome
  • You need rules Biome does not support
  • Your team has heavy ESLint customization

Summary

Biome provides fast, unified linting and formatting:

  1. Install with npm install -D @biomejs/biome
  2. Initialize with biome init
  3. Configure formatter and linter in biome.json
  4. Run with biome check --write for local, biome check for CI
  5. Integrate with your editor for format-on-save

The Biome documentation has the full rule list and configuration options.

Frequently Asked Questions

Biome is a fast toolchain for JavaScript and TypeScript that combines linting and formatting in one tool. It is written in Rust and aims to replace both ESLint and Prettier with a single, faster alternative.

Biome is significantly faster (10-100x) because it is written in Rust. It combines linting and formatting in one tool with one config. The formatter is compatible with Prettier, and the linter covers many common ESLint rules.

Yes. Biome's formatter is largely Prettier-compatible. For ESLint, Biome covers common rules but not all plugins. You can migrate incrementally by running both tools in parallel during transition.

Biome supports JavaScript, TypeScript, JSX, TSX, JSON, JSONC, CSS, GraphQL, and HTML. Support for additional languages is being added.

Run 'biome check' in CI to verify both formatting and linting. It exits with an error if any issues are found. Use 'biome check --write' locally to fix issues automatically.

Related Posts