بنقرة واحدة
biome
Biome 2.x linting and formatting patterns. Use when configuring code quality tools, setting up linting rules, formatting code, or integrating with CI/CD. Covers migration from ESLint/Prettier.
القائمة
Biome 2.x linting and formatting patterns. Use when configuring code quality tools, setting up linting rules, formatting code, or integrating with CI/CD. Covers migration from ESLint/Prettier.
استنادا إلى تصنيف SOC المهني
Hono 4.x web framework patterns. Use when building APIs, middleware, routing, or server-side applications. Covers multi-runtime support (Node, Bun, Cloudflare Workers), validation, CORS, and error handling.
Radix UI primitive patterns. Use when building accessible, unstyled UI components like dialogs, dropdowns, tooltips, tabs, and selects. Covers Tailwind styling, keyboard navigation, animations, and portal management.
React development patterns. Use when building React components, managing state, creating custom hooks, or optimizing React applications. Covers React 19 features, TypeScript integration, and composition patterns.
Tailwind CSS 4.x utility-first styling patterns. Use when building UI components, creating responsive layouts, implementing design systems, or customizing themes. Covers CSS-first configuration, @theme directive, and component patterns.
Vite 7.x build tool patterns. Use when configuring build setup, development server, environment variables, asset handling, or optimizing production builds for React applications.
Plan infrastructure capacity for expected load. Use when sizing systems, planning for growth, or analyzing resource requirements. Covers load estimation and resource sizing.
| name | biome |
| description | Biome 2.x linting and formatting patterns. Use when configuring code quality tools, setting up linting rules, formatting code, or integrating with CI/CD. Covers migration from ESLint/Prettier. |
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
API Reference: Use Context7 MCP for full rule reference and CLI flags (
mcp__context7__resolve-library-id→@biomejs/biome).
Initial setup:
pnpm add -D @biomejs/biomepnpm biome initbiomejs.biomepnpm biome check .Migrating from ESLint/Prettier:
pnpm biome migrate eslint --writepnpm biome check --write .Daily usage:
pnpm biome check . before commitspnpm biome check --write .{
"$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"]
}
}
{
"linter": {
"rules": {
"recommended": true,
"a11y": { "noBlankTarget": "error", "useAltText": "error", "useButtonType": "error" },
"complexity": { "noExcessiveCognitiveComplexity": "warn", "noUselessFragments": "error" },
"correctness": { "noUnusedVariables": "error", "useExhaustiveDependencies": "warn", "useHookAtTopLevel": "error" },
"performance": { "noAccumulatingSpread": "warn" },
"security": { "noDangerouslySetInnerHtml": "warn" },
"style": { "noNonNullAssertion": "warn", "useConst": "error", "useImportType": "error" },
"suspicious": { "noExplicitAny": "error", "noDebugger": "error", "noConsoleLog": "warn" }
}
},
"javascript": {
"formatter": { "jsxQuoteStyle": "double", "quoteStyle": "single" }
}
}
{
"overrides": [
{
"include": ["tests/**/*.ts"],
"linter": { "rules": { "suspicious": { "noExplicitAny": "off" } } }
},
{
"include": ["scripts/**/*.js"],
"formatter": { "lineWidth": 120 }
}
]
}
# Check (lint + format) — use this for most tasks
pnpm biome check .
pnpm biome check --write . # auto-fix
pnpm biome check --write --dry-run . # preview changes
# Lint or format only
pnpm biome lint --write .
pnpm biome format --write .
# Diagnostics
pnpm biome rage # effective config + diagnostics
pnpm biome explain src/App.tsx # explain failures for a file
pnpm biome migrate eslint --write # migrate from ESLint
pnpm biome migrate prettier --write # migrate from Prettier
{
"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"
}
}
{
"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" },
"[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
"[json]": { "editor.defaultFormatter": "biomejs.biome" },
"biome.lspBin": "./node_modules/@biomejs/biome/bin/biome"
}
// biome-ignore lint/suspicious/noExplicitAny: legacy code
function legacy(param: any) { return param; }
// biome-ignore format: preserve matrix formatting
const matrix = [
1, 0, 0,
0, 1, 0,
0, 0, 1,
];
Prefer files.ignore in biome.json for ignoring entire directories over inline comments.
Using lint-staged + Husky:
// package.json
{
"lint-staged": {
"*.{js,jsx,ts,tsx,json}": ["biome check --write --no-errors-on-unmatched"]
}
}
Using Lefthook (lefthook.yml):
pre-commit:
parallel: true
commands:
biome:
glob: "*.{js,ts,jsx,tsx,json}"
run: biome check --write --no-errors-on-unmatched {staged_files}
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' }
- run: pnpm install --frozen-lockfile
- run: pnpm biome check .
- run: pnpm typecheck
| ESLint Rule | Biome 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 |
jsx-a11y/alt-text | a11y/useAltText |
check instead)# Preview formatting changes without writing
pnpm biome format --write --dry-run .
# Diagnose config issues
pnpm biome rage
# CI test locally (exit code 0 = success)
pnpm biome check . --error-on-warnings && echo "OK"
Verify VS Code integration: Command Palette → "Biome: Show Output Channel" → should show LSP server logs.