biome

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Biome 2.x

Biome 2.x

Overview

概述

Fast, all-in-one toolchain for linting and formatting JavaScript, TypeScript, JSX, and JSON. Biome 2.x replaces ESLint and Prettier with a single, performant tool written in Rust.
Install:
pnpm add -D @biomejs/biome
Version: 2.x (use
biome --version
to verify)
Biome 2.x是一款快速的一站式工具链,用于JavaScript、TypeScript、JSX和JSON的代码检查与格式化。它是用Rust编写的高性能工具,可替代ESLint和Prettier。
安装
pnpm add -D @biomejs/biome
版本:2.x(使用
biome --version
验证)

Workflows

工作流程

Initial setup:
  1. Install Biome:
    pnpm add -D @biomejs/biome
  2. Initialize config:
    pnpm biome init
  3. Configure biome.json with project standards
  4. Install VS Code extension:
    biomejs.biome
  5. Add npm scripts to package.json
  6. Test:
    pnpm biome check .
Migrating from ESLint/Prettier:
  1. Run migration helper:
    pnpm biome migrate eslint --write
  2. Review generated biome.json
  3. Remove ESLint/Prettier configs and dependencies
  4. Update pre-commit hooks and CI scripts
  5. Run full check:
    pnpm biome check --write .
Daily usage:
  1. Format on save (VS Code integration)
  2. Run
    pnpm biome check .
    before commits
  3. Fix auto-fixable issues:
    pnpm biome check --write .
  4. Review manual fixes for remaining issues
初始设置:
  1. 安装Biome:
    pnpm add -D @biomejs/biome
  2. 初始化配置:
    pnpm biome init
  3. 根据项目规范配置biome.json
  4. 安装VS Code扩展:
    biomejs.biome
  5. 在package.json中添加npm脚本
  6. 测试:
    pnpm biome check .
从ESLint/Prettier迁移:
  1. 运行迁移助手:
    pnpm biome migrate eslint --write
  2. 检查生成的biome.json
  3. 删除ESLint/Prettier配置文件和依赖
  4. 更新提交前钩子和CI脚本
  5. 运行完整检查:
    pnpm biome check --write .
日常使用:
  1. 在VS Code中开启保存时自动格式化
  2. 提交代码前运行
    pnpm biome check .
  3. 自动修复可修复问题:
    pnpm biome check --write .
  4. 手动修复剩余问题

Configuration

配置

biome.json Structure

biome.json 结构

json
{
  "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 100
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "single",
      "semicolons": "always",
      "trailingCommas": "es5",
      "arrowParentheses": "asNeeded"
    }
  },
  "files": {
    "ignore": [
      "dist",
      "build",
      "node_modules",
      "*.min.js",
      "coverage"
    ]
  }
}
json
{
  "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 100
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "single",
      "semicolons": "always",
      "trailingCommas": "es5",
      "arrowParentheses": "asNeeded"
    }
  },
  "files": {
    "ignore": [
      "dist",
      "build",
      "node_modules",
      "*.min.js",
      "coverage"
    ]
  }
}

Common Configurations

常见配置

json
// Strict TypeScript project
{
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "suspicious": {
        "noExplicitAny": "error",
        "noImplicitAnyLet": "error"
      },
      "complexity": {
        "noExcessiveCognitiveComplexity": "warn",
        "noUselessFragments": "error"
      },
      "style": {
        "noNonNullAssertion": "warn",
        "useConst": "error",
        "useImportType": "error"
      }
    }
  }
}

// React project
{
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "a11y": {
        "noBlankTarget": "error",
        "useAltText": "error",
        "useButtonType": "error"
      },
      "correctness": {
        "useExhaustiveDependencies": "warn",
        "useHookAtTopLevel": "error"
      }
    }
  },
  "javascript": {
    "formatter": {
      "jsxQuoteStyle": "double",
      "quoteStyle": "single"
    }
  }
}

// Relaxed formatting (Prettier-like)
{
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 80
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "double",
      "semicolons": "always",
      "trailingCommas": "all",
      "arrowParentheses": "always"
    }
  }
}
json
// 严格TypeScript项目
{
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "suspicious": {
        "noExplicitAny": "error",
        "noImplicitAnyLet": "error"
      },
      "complexity": {
        "noExcessiveCognitiveComplexity": "warn",
        "noUselessFragments": "error"
      },
      "style": {
        "noNonNullAssertion": "warn",
        "useConst": "error",
        "useImportType": "error"
      }
    }
  }
}

// React项目
{
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "a11y": {
        "noBlankTarget": "error",
        "useAltText": "error",
        "useButtonType": "error"
      },
      "correctness": {
        "useExhaustiveDependencies": "warn",
        "useHookAtTopLevel": "error"
      }
    }
  },
  "javascript": {
    "formatter": {
      "jsxQuoteStyle": "double",
      "quoteStyle": "single"
    }
  }
}

// 宽松格式化(类Prettier)
{
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 80
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "double",
      "semicolons": "always",
      "trailingCommas": "all",
      "arrowParentheses": "always"
    }
  }
}

Rule Categories

规则分类

json
{
  "linter": {
    "rules": {
      // Enable all recommended rules
      "recommended": true,

      // Accessibility
      "a11y": {
        "noBlankTarget": "error",
        "useAltText": "error"
      },

      // Code complexity
      "complexity": {
        "noExcessiveCognitiveComplexity": "warn",
        "noBannedTypes": "error"
      },

      // Correctness
      "correctness": {
        "noUnusedVariables": "error",
        "useExhaustiveDependencies": "warn"
      },

      // Performance
      "performance": {
        "noAccumulatingSpread": "warn",
        "noDelete": "error"
      },

      // Security
      "security": {
        "noDangerouslySetInnerHtml": "warn"
      },

      // Style
      "style": {
        "noNonNullAssertion": "warn",
        "useConst": "error",
        "useSingleVarDeclarator": "error"
      },

      // Suspicious patterns
      "suspicious": {
        "noExplicitAny": "error",
        "noDebugger": "error",
        "noConsoleLog": "warn"
      }
    }
  }
}
json
{
  "linter": {
    "rules": {
      // 启用所有推荐规则
      "recommended": true,

      // 可访问性
      "a11y": {
        "noBlankTarget": "error",
        "useAltText": "error"
      },

      // 代码复杂度
      "complexity": {
        "noExcessiveCognitiveComplexity": "warn",
        "noBannedTypes": "error"
      },

      // 代码正确性
      "correctness": {
        "noUnusedVariables": "error",
        "useExhaustiveDependencies": "warn"
      },

      // 性能
      "performance": {
        "noAccumulatingSpread": "warn",
        "noDelete": "error"
      },

      // 安全
      "security": {
        "noDangerouslySetInnerHtml": "warn"
      },

      // 代码风格
      "style": {
        "noNonNullAssertion": "warn",
        "useConst": "error",
        "useSingleVarDeclarator": "error"
      },

      // 可疑模式
      "suspicious": {
        "noExplicitAny": "error",
        "noDebugger": "error",
        "noConsoleLog": "warn"
      }
    }
  }
}

CLI Commands

CLI命令

Check (Lint + Format)

检查(代码检查+格式化)

bash
undefined
bash
undefined

Check all files

检查所有文件

pnpm biome check .
pnpm biome check .

Check and auto-fix

检查并自动修复

pnpm biome check --write .
pnpm biome check --write .

Check specific files

检查指定文件

pnpm biome check src/components/*.tsx
pnpm biome check src/components/*.tsx

Check with specific configurations

使用指定配置检查

pnpm biome check --formatter-enabled=false . pnpm biome check --linter-enabled=false .
pnpm biome check --formatter-enabled=false . pnpm biome check --linter-enabled=false .

Dry run (show what would change)

试运行(显示将更改的内容)

pnpm biome check --write --dry-run .
undefined
pnpm biome check --write --dry-run .
undefined

Lint Only

仅代码检查

bash
undefined
bash
undefined

Lint all files

检查所有文件

pnpm biome lint .
pnpm biome lint .

Lint and auto-fix

检查并自动修复

pnpm biome lint --write .
pnpm biome lint --write .

Show applied fixes

显示应用的修复

pnpm biome lint --write --verbose .
pnpm biome lint --write --verbose .

Lint with specific rules

使用指定规则检查

pnpm biome lint --only=suspicious/noExplicitAny .
undefined
pnpm biome lint --only=suspicious/noExplicitAny .
undefined

Format Only

仅格式化

bash
undefined
bash
undefined

Format all files

格式化所有文件

pnpm biome format .
pnpm biome format .

Format and write changes

格式化并保存更改

pnpm biome format --write .
pnpm biome format --write .

Format with custom line width

使用自定义行宽格式化

pnpm biome format --line-width=120 .
pnpm biome format --line-width=120 .

Format specific file types

格式化指定文件类型

pnpm biome format --json-formatter-enabled=true .
undefined
pnpm biome format --json-formatter-enabled=true .
undefined

Other Commands

其他命令

bash
undefined
bash
undefined

Initialize configuration

初始化配置

pnpm biome init
pnpm biome init

Migrate from ESLint

从ESLint迁移

pnpm biome migrate eslint --write
pnpm biome migrate eslint --write

Migrate from Prettier

从Prettier迁移

pnpm biome migrate prettier --write
pnpm biome migrate prettier --write

Print configuration

打印配置信息

pnpm biome rage
pnpm biome rage

Print effective configuration for a file

打印指定文件的有效配置

pnpm biome explain src/App.tsx
pnpm biome explain src/App.tsx

Check configuration validity

检查配置有效性

pnpm biome check --config-path=./biome.json
undefined
pnpm biome check --config-path=./biome.json
undefined

Package.json Scripts

Package.json脚本

json
{
  "scripts": {
    "lint": "biome lint .",
    "format": "biome format --write .",
    "check": "biome check .",
    "fix": "biome check --write .",
    "typecheck": "tsc --noEmit",
    "quality": "pnpm lint && pnpm typecheck && pnpm build"
  }
}
json
{
  "scripts": {
    "lint": "biome lint .",
    "format": "biome format --write .",
    "check": "biome check .",
    "fix": "biome check --write .",
    "typecheck": "tsc --noEmit",
    "quality": "pnpm lint && pnpm typecheck && pnpm build"
  }
}

VS Code Integration

VS Code集成

settings.json

settings.json

json
{
  // Enable Biome as default formatter
  "editor.defaultFormatter": "biomejs.biome",

  // Format on save
  "editor.formatOnSave": true,

  // Organize imports on save
  "editor.codeActionsOnSave": {
    "quickfix.biome": "explicit",
    "source.organizeImports.biome": "explicit"
  },

  // Disable conflicting extensions
  "eslint.enable": false,
  "prettier.enable": false,

  // File associations
  "[javascript]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[typescript]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[json]": {
    "editor.defaultFormatter": "biomejs.biome"
  }
}
json
{
  // 启用Biome作为默认格式化工具
  "editor.defaultFormatter": "biomejs.biome",

  // 保存时格式化
  "editor.formatOnSave": true,

  // 保存时整理导入
  "editor.codeActionsOnSave": {
    "quickfix.biome": "explicit",
    "source.organizeImports.biome": "explicit"
  },

  // 禁用冲突扩展
  "eslint.enable": false,
  "prettier.enable": false,

  // 文件关联
  "[javascript]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[typescript]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "biomejs.biome"
  },
  "[json]": {
    "editor.defaultFormatter": "biomejs.biome"
  }
}

Workspace Settings

工作区设置

json
{
  "biome.lspBin": "./node_modules/@biomejs/biome/bin/biome",
  "biome.enabled": true,
  "biome.rename": true
}
json
{
  "biome.lspBin": "./node_modules/@biomejs/biome/bin/biome",
  "biome.enabled": true,
  "biome.rename": true
}

Ignoring Files

忽略文件

Via biome.json

通过biome.json

json
{
  "files": {
    "ignore": [
      // Build outputs
      "dist",
      "build",
      "out",
      ".next",

      // Dependencies
      "node_modules",
      "vendor",

      // Generated files
      "*.generated.ts",
      "**/*.min.js",

      // Coverage
      "coverage",
      ".nyc_output",

      // Temp files
      "tmp",
      "temp"
    ],
    "include": [
      "src/**/*.ts",
      "src/**/*.tsx"
    ]
  }
}
json
{
  "files": {
    "ignore": [
      // 构建输出
      "dist",
      "build",
      "out",
      ".next",

      // 依赖
      "node_modules",
      "vendor",

      // 生成文件
      "*.generated.ts",
      "**/*.min.js",

      // 覆盖率报告
      "coverage",
      ".nyc_output",

      // 临时文件
      "tmp",
      "temp"
    ],
    "include": [
      "src/**/*.ts",
      "src/**/*.tsx"
    ]
  }
}

Via Comments

通过注释

typescript
// biome-ignore lint/suspicious/noExplicitAny: legacy code
function legacy(param: any) {
  return param;
}

// biome-ignore format: preserve formatting
const matrix = [
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
];

// Multiple ignores
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex business logic
// biome-ignore lint/suspicious/noConsoleLog: debugging required
function complexFunction() {
  console.log('Debug info');
  // ... complex logic
}
typescript
// biome-ignore lint/suspicious/noExplicitAny: 遗留代码
function legacy(param: any) {
  return param;
}

// biome-ignore format: 保留现有格式
const matrix = [
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
];

// 多个忽略规则
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: 复杂业务逻辑
// biome-ignore lint/suspicious/noConsoleLog: 需要调试
function complexFunction() {
  console.log('Debug info');
  // ... 复杂逻辑
}

Per-File Configuration

按文件配置

json
{
  "overrides": [
    {
      "include": ["tests/**/*.ts"],
      "linter": {
        "rules": {
          "suspicious": {
            "noExplicitAny": "off"
          }
        }
      }
    },
    {
      "include": ["scripts/**/*.js"],
      "formatter": {
        "lineWidth": 120
      }
    }
  ]
}
json
{
  "overrides": [
    {
      "include": ["tests/**/*.ts"],
      "linter": {
        "rules": {
          "suspicious": {
            "noExplicitAny": "off"
          }
        }
      }
    },
    {
      "include": ["scripts/**/*.js"],
      "formatter": {
        "lineWidth": 120
      }
    }
  ]
}

Git Hooks Integration

Git钩子集成

Using Husky + lint-staged

使用Husky + lint-staged

bash
undefined
bash
undefined

Install dependencies

安装依赖

pnpm add -D husky lint-staged
pnpm add -D husky lint-staged

Initialize Husky

初始化Husky

pnpm husky init

**.husky/pre-commit**
```bash
#!/usr/bin/env sh
pnpm lint-staged
package.json
json
{
  "lint-staged": {
    "*.{js,jsx,ts,tsx,json}": [
      "biome check --write --no-errors-on-unmatched"
    ]
  }
}
pnpm husky init

**.husky/pre-commit**
```bash
#!/usr/bin/env sh
pnpm lint-staged
package.json
json
{
  "lint-staged": {
    "*.{js,jsx,ts,tsx,json}": [
      "biome check --write --no-errors-on-unmatched"
    ]
  }
}

Using Lefthook

使用Lefthook

lefthook.yml
yaml
pre-commit:
  parallel: true
  commands:
    biome:
      glob: "*.{js,ts,jsx,tsx,json}"
      run: biome check --write --no-errors-on-unmatched {staged_files}
lefthook.yml
yaml
pre-commit:
  parallel: true
  commands:
    biome:
      glob: "*.{js,ts,jsx,tsx,json}"
      run: biome check --write --no-errors-on-unmatched {staged_files}

CI/CD Integration

CI/CD集成

GitHub Actions

GitHub Actions

yaml
name: Code Quality

on: [push, pull_request]

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: pnpm/action-setup@v4
        with:
          version: 10

      - uses: actions/setup-node@v4
        with:
          node-version: '24'
          cache: 'pnpm'

      - name: Install dependencies
        run: pnpm install --frozen-lockfile

      - name: Run Biome
        run: pnpm biome check .

      - name: Type check
        run: pnpm typecheck
yaml
name: Code Quality

on: [push, pull_request]

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: pnpm/action-setup@v4
        with:
          version: 10

      - uses: actions/setup-node@v4
        with:
          node-version: '24'
          cache: 'pnpm'

      - name: Install dependencies
        run: pnpm install --frozen-lockfile

      - name: Run Biome
        run: pnpm biome check .

      - name: Type check
        run: pnpm typecheck

GitLab CI

GitLab CI

yaml
quality:
  image: node:24
  cache:
    paths:
      - node_modules/
  before_script:
    - npm install -g pnpm
    - pnpm install --frozen-lockfile
  script:
    - pnpm biome check .
    - pnpm typecheck
  only:
    - merge_requests
    - main
yaml
quality:
  image: node:24
  cache:
    paths:
      - node_modules/
  before_script:
    - npm install -g pnpm
    - pnpm install --frozen-lockfile
  script:
    - pnpm biome check .
    - pnpm typecheck
  only:
    - merge_requests
    - main

Docker

Docker

dockerfile
FROM node:24-alpine

WORKDIR /app
dockerfile
FROM node:24-alpine

WORKDIR /app

Install pnpm

安装pnpm

RUN npm install -g pnpm
RUN npm install -g pnpm

Copy package files

复制包文件

COPY package.json pnpm-lock.yaml ./
COPY package.json pnpm-lock.yaml ./

Install dependencies

安装依赖

RUN pnpm install --frozen-lockfile
RUN pnpm install --frozen-lockfile

Copy source

复制源码

COPY . .
COPY . .

Run checks

运行检查

RUN pnpm biome check . RUN pnpm typecheck RUN pnpm build
undefined
RUN pnpm biome check . RUN pnpm typecheck RUN pnpm build
undefined

Migration from ESLint/Prettier

从ESLint/Prettier迁移

Step-by-Step Migration

分步迁移指南

bash
undefined
bash
undefined

1. Install Biome

1. 安装Biome

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

2. Run migration (reads .eslintrc/.prettierrc)

2. 运行迁移(读取.eslintrc/.prettierrc)

pnpm biome migrate eslint --write pnpm biome migrate prettier --write
pnpm biome migrate eslint --write pnpm biome migrate prettier --write

3. Review generated biome.json

3. 检查生成的biome.json

cat biome.json
cat biome.json

4. Remove old configs

4. 删除旧配置文件

rm .eslintrc.json .prettierrc.json .eslintignore .prettierignore
rm .eslintrc.json .prettierrc.json .eslintignore .prettierignore

5. Remove old dependencies

5. 删除旧依赖

pnpm remove eslint prettier
@typescript-eslint/parser
@typescript-eslint/eslint-plugin
eslint-config-prettier
eslint-plugin-react
pnpm remove eslint prettier
@typescript-eslint/parser
@typescript-eslint/eslint-plugin
eslint-config-prettier
eslint-plugin-react

6. Update package.json scripts

6. 更新package.json脚本

Replace "eslint ." with "biome lint ."

将"eslint ."替换为"biome lint ."

Replace "prettier --write ." with "biome format --write ."

将"prettier --write ."替换为"biome format --write ."

7. Update pre-commit hooks

7. 更新提交前钩子

Replace eslint/prettier with biome check --write

将eslint/prettier替换为biome check --write

8. Update CI/CD

8. 更新CI/CD配置

Replace eslint/prettier commands with biome check

将eslint/prettier命令替换为biome check

9. Update VS Code settings

9. 更新VS Code设置

Disable ESLint/Prettier extensions

禁用ESLint/Prettier扩展

Enable Biome extension

启用Biome扩展

10. Run full check

10. 运行完整检查

pnpm biome check --write .
undefined
pnpm biome check --write .
undefined

ESLint Rule Equivalents

ESLint规则对应表

ESLint RuleBiome Rule
no-unused-vars
correctness/noUnusedVariables
@typescript-eslint/no-explicit-any
suspicious/noExplicitAny
react-hooks/exhaustive-deps
correctness/useExhaustiveDependencies
no-console
suspicious/noConsoleLog
prefer-const
style/useConst
no-var
style/noVar
jsx-a11y/alt-text
a11y/useAltText
react/jsx-no-target-blank
a11y/noBlankTarget
ESLint规则Biome规则
no-unused-vars
correctness/noUnusedVariables
@typescript-eslint/no-explicit-any
suspicious/noExplicitAny
react-hooks/exhaustive-deps
correctness/useExhaustiveDependencies
no-console
suspicious/noConsoleLog
prefer-const
style/useConst
no-var
style/noVar
jsx-a11y/alt-text
a11y/useAltText
react/jsx-no-target-blank
a11y/noBlankTarget

Best Practices

最佳实践

  • Use recommended ruleset as baseline, then customize specific rules
  • Enable format-on-save in VS Code for seamless workflow
  • Run check before commits using git hooks (Husky/Lefthook)
  • Use biome check (not lint + format separately) for unified workflow
  • Ignore generated files in biome.json, not inline comments
  • Use overrides for different rules in tests vs source
  • Commit biome.json to version control for team consistency
  • Document custom rules in comments explaining why they're needed
  • Leverage --write for auto-fixing in CI (with separate review step)
  • Use biome explain to understand why a file fails checks
  • 以推荐规则集为基础,再自定义特定规则
  • 在VS Code中启用保存时格式化,实现流畅工作流
  • 使用Git钩子(Husky/Lefthook)在提交前运行检查
  • 使用biome check命令,而非分开运行lint和format,实现统一工作流
  • 在biome.json中忽略生成文件,而非使用行内注释
  • 使用overrides配置,为测试文件和源码设置不同规则
  • 将biome.json提交到版本控制,确保团队规范一致
  • 为自定义规则添加注释说明,解释规则的必要性
  • 在CI中使用--write自动修复,但需单独设置审核步骤
  • 使用biome explain命令,了解文件检查不通过的原因

Anti-Patterns

反模式

  • ❌ Running lint and format separately (use
    check
    instead)
  • ❌ Disabling recommended rules without justification
  • ❌ Using biome-ignore excessively (fix the underlying issue)
  • ❌ Not committing biome.json to version control
  • ❌ Mixing ESLint and Biome in the same project
  • ❌ Ignoring files via comments instead of configuration
  • ❌ Not testing migration thoroughly before removing ESLint/Prettier
  • ❌ Skipping pre-commit hooks for "quick fixes"
  • ❌ Using outdated schema version in biome.json
  • ❌ Not organizing imports (disable organizeImports)
  • ❌ 分开运行lint和format(应使用
    check
    命令)
  • ❌ 无正当理由禁用推荐规则
  • ❌ 过度使用biome-ignore注释(应修复根本问题)
  • ❌ 不将biome.json提交到版本控制
  • ❌ 在同一项目中混合使用ESLint和Biome
  • ❌ 使用注释而非配置文件忽略文件
  • ❌ 在删除ESLint/Prettier前未充分测试迁移效果
  • ❌ 为了“快速修复”跳过提交前钩子
  • ❌ 在biome.json中使用过时的schema版本
  • ❌ 禁用organizeImports功能

Feedback Loops

反馈机制

Check formatting:
bash
undefined
检查格式化效果:
bash
undefined

See what would change without modifying files

查看将更改的内容但不修改文件

pnpm biome format --write --dry-run .

**Validate configuration:**
```bash
pnpm biome format --write --dry-run .

**验证配置:**
```bash

Print effective config and diagnostics

打印有效配置和诊断信息

pnpm biome rage
pnpm biome rage

Explain rules for specific file

解释指定文件的规则

pnpm biome explain src/App.tsx

**Performance benchmark:**
```bash
pnpm biome explain src/App.tsx

**性能基准测试:**
```bash

Compare Biome vs ESLint/Prettier speed

对比Biome与ESLint/Prettier的速度

time pnpm biome check . time pnpm eslint . && pnpm prettier --check .
time pnpm biome check . time pnpm eslint . && pnpm prettier --check .

Biome typically 10-100x faster

Biome通常比它们快10-100倍


**CI integration test:**
```bash

**CI集成测试:**
```bash

Test CI checks locally

本地测试CI检查

pnpm biome check . --error-on-warnings echo $? # Should be 0 for success

**Editor integration:**
pnpm biome check . --error-on-warnings echo $? # 成功时返回0

**编辑器集成验证:**

Verify VS Code extension is active

验证VS Code扩展是否激活

Open Command Palette → "Biome: Show Output Channel"

打开命令面板 → "Biome: Show Output Channel"

Should show Biome LSP server logs

应显示Biome LSP服务器日志

undefined
undefined