Configs2026年4月12日·1 分钟阅读

Biome — Fast Formatter and Linter for Web Projects

Biome is a performant toolchain for web projects written in Rust. It provides a fast formatter (97% Prettier compatible), linter (290+ rules), and more — all in a single binary with zero dependencies and minimal configuration.

AI
AI Open Source · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

# Install Biome
npm install -D @biomejs/biome

# Initialize configuration
npx biome init

# Format files
npx biome format --write src/

# Lint files
npx biome lint src/

# Format + lint + organize imports in one command
npx biome check --write src/

Introduction

Biome is a high-performance, all-in-one toolchain for web development. It combines a code formatter, linter, and import organizer into a single Rust binary that runs 25-35x faster than the equivalent Prettier + ESLint setup. Originally forked from Rome (created by Sebastian McKenzie, also the creator of Babel), Biome has grown into an independent project with a vibrant community.

With 24,000+ GitHub stars and rapidly growing adoption, Biome represents the next generation of web development tooling — replacing multiple JavaScript-based tools with a single, blazing-fast native binary.

What Biome Does

Biome eliminates the need to install and configure Prettier, ESLint, and import-sorting plugins separately. A single "biome check --write" command formats your code, lints it for errors, and organizes your imports — all in milliseconds. It supports JavaScript, TypeScript, JSX, TSX, JSON, and CSS.

Architecture Overview

[Source Files (JS/TS/JSX/TSX/CSS/JSON)]
                |
        [Biome Core (Rust)]
        Single binary, zero deps
                |
    +-----------+-----------+
    |           |           |
[Formatter] [Linter]   [Import Sorter]
97% Prettier 290+ rules  Automatic
compatible   including   grouping and
             a11y, perf  alphabetizing
    |           |           |
    +-----------+-----------+
                |
        [Output: formatted,
         linted, organized]

Speed: 25-35x faster than
       Prettier + ESLint

Self-Hosting & Configuration

// biome.json — configuration
{
  "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 100
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "complexity": {
        "noExcessiveCognitiveComplexity": "warn"
      },
      "correctness": {
        "noUnusedVariables": "error",
        "useExhaustiveDependencies": "warn"
      },
      "suspicious": {
        "noExplicitAny": "warn"
      }
    }
  },
  "files": {
    "ignore": ["dist", "node_modules"]
  }
}

Key Features

  • All-in-One — formatter, linter, and import organizer in a single tool
  • Blazing Fast — 25-35x faster than Prettier + ESLint combined
  • Zero Dependencies — single Rust binary, no node_modules overhead
  • 290+ Lint Rules — includes accessibility, performance, and correctness rules
  • 97% Prettier Compatible — near-identical formatting output
  • First-Class IDE Support — VS Code and IntelliJ extensions with instant feedback
  • Error Recovery — continues processing even with syntax errors
  • CI Friendly — machine-readable output formats for CI integration

Comparison with Similar Tools

Feature Biome Prettier + ESLint dprint + oxlint StandardJS
Language Rust JavaScript Rust JavaScript
Speed 25-35x faster Baseline 10-20x faster Baseline
Tools Combined 3-in-1 2 separate tools 2 separate tools All-in-one
Dependencies 0 100+ packages Minimal Moderate
Config Files 1 (biome.json) 2+ (.prettierrc + eslint.config) 2+ 0
TypeScript Built-in Via plugins Built-in No
CSS Support Yes Via plugins Limited No
Prettier Compat 97% N/A 95% No

FAQ

Q: Can Biome fully replace Prettier and ESLint? A: For most projects, yes. Biome covers 97% of Prettier formatting and includes 290+ lint rules covering most ESLint core and popular plugin rules. If you rely on niche ESLint plugins (specific React Native rules, GraphQL, etc.), you may still need ESLint for those.

Q: How do I migrate from Prettier + ESLint to Biome? A: Run "npx biome migrate prettier" and "npx biome migrate eslint" to automatically convert your existing configurations. Then run "npx biome check --write ." to format everything with Biome.

Q: Is Biome production-ready? A: Yes. Biome 1.x is stable and used by companies like Discord, Vercel, and others. The team follows semantic versioning and provides clear migration paths between versions.

Q: What about Biome vs dprint + oxlint? A: Both are Rust-based alternatives. Biome offers a single unified tool with one config file. dprint + oxlint are separate tools with more flexibility but require separate configuration and setup.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产