biome-tooling について
biome-toolingは、JavaScriptやTypeScriptなどのWeb言語プロジェクトでBiomeを使うためのスキルです。設定、フォーマット、Lint、インポート整理、ESLintやPrettierからの移行を扱います。
主な機能
- 01フォーマット、Lint、インポート整理
- 02JavaScript、TypeScript、JSX、TSX、JSON、CSSに対応
- 03ゼロコンフィグでの利用とプロジェクト設定
- 04CIと診断出力のコマンド
- 05ESLintとPrettierからの移行ガイド
活用シーン
- 01新しいJS/TSプロジェクトのチェック設定
- 02CIでのフォーマットとLint実行
- 03ESLintとPrettierの設定から移行
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ laurigates/ claude-plugins --skill biome-toolingインストール後、Claude Code で/biome-toolingを入力して読み込まれたか確認します。
同梱ファイルREFERENCE.md
詳細
Biome ツールチェーン
Biome は、JavaScript、TypeScript、および関連する Web 言語向けの、モダンで高性能なツールチェーンです。フォーマット、リンティング、インポートの整理を単一のツールに統合し、ESLint/Prettier より15〜20 倍高速です。
このスキルを使うタイミング
| このスキルを使う場合... | 別の方法を使う場合... |
|---|---|
| 新しい JS/TS プロジェクトを始める | 特定の ESLint プラグイン(React hooks、a11y)が必要 |
| 設定不要のフォーマット/リンティングを求めている | 複雑なカスタム ESLint ルールがある |
| 高速な CI/CD パイプラインが必要 | フレームワーク固有のルール(Next.js、Nuxt)が必要 |
| ESLint+Prettier から移行する | ESLint の大規模なカスタマイズが施されたレガシーコードベース |
ハイブリッド方式:フォーマットには Biome を、専門的なリンティングには ESLint を使います。
主な機能
Biome とは?
- オールインワンのツールチェーン:リンター+フォーマッター+インポートソーター
- 設定不要:適切なデフォルト設定ですぐに使えます
- 高速:Rust で記述され、ファイルを並列処理します
- 互換性:Prettier のフォーマットと 97% 以上一致します
- 対応言語:JavaScript、TypeScript、JSX、TSX、JSON、CSS
インストール
# Project-local (recommended)
bun add --dev @biomejs/biome
# Verify installation
bunx biome --version
# Initialize configuration
bunx biome init
基本的なコマンド
# Format files
bunx biome format --write src/
# Lint with fixes
bunx biome lint --write src/
# Check everything (format + lint + organize imports)
bunx biome check --write src/
# Check without changes (CI mode)
bunx biome check src/
# CI mode (exits with error on issues)
bunx biome ci src/
# Migrate from ESLint/Prettier
bunx biome migrate eslint --write
bunx biome migrate prettier --write
# Explain a rule
bunx biome explain noUnusedVariables
設定(biome.json)
最小限の設定(設定不要)
Biome は設定なしで動作します。基本的なカスタマイズを行う場合:
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": ["dist", "build", "node_modules", ".next", "coverage"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"organizeImports": {
"enabled": true
}
}
ルールのカテゴリー
| カテゴリー | 目的 | ルールの例 |
|---|---|---|
recommended | 誰もが有効にすべき基本的なルール | 「recommended」とマークされたほとんどのルール |
correctness | バグやロジックエラーを防ぐ | noUnusedVariables、noUnreachable |
suspicious | 誤りの可能性があるコードを検出する | noExplicitAny、noDoubleEquals |
style | 一貫したスタイルを適用する | useConst、noVar |
complexity | コードの複雑さを軽減する | noForEach、useFlatMap |
performance | パフォーマンスを最適化する | noAccumulatingSpread |
a11y | アクセシビリティのベストプラクティス | noSvgWithoutTitle、useAltText |
security | セキュリティの脆弱性 | noDangerouslySetInnerHtml |
よくあるパターン
ファイルとディレクトリを無視する
biome.json で指定:
{
"files": {
"ignore": [
"dist",
"build",
"node_modules",
"**/*.config.js",
"scripts/legacy/**"
]
}
}
.gitignore で指定(自動):
{
"vcs": {
"enabled": true,
"useIgnoreFile": true
}
}
パフォーマンスの比較
| ツール | 所要時間(1000 ファイル) | 備考 |
|---|---|---|
| Biome | 0.5s | Rust、並列処理 |
| ESLint | 8-10s | Node.js、シングルスレッド |
| Prettier | 3-5s | Node.js、フォーマットのみ |
| ESLint + Prettier | 11-15s | 順次実行 |
エージェント向けの最適化
| コンテキスト | コマンド |
|---|---|
| クイックチェック | bunx biome check src/ |
| すべて修正 | bunx biome check --write src/ |
| フォーマットのみ | bunx biome format --write src/ |
| リンティングのみ | bunx biome lint --write src/ |
| CI モード | bunx biome ci src/ |
| エラーのみ | bunx biome check --diagnostic-level=error src/ |
| 出力を制限 | bunx biome check --max-diagnostics=10 src/ |
| GitHub レポーター | bunx biome check --reporter=github src/ |
| JSON 出力 | bunx biome check --reporter=json src/ |
| ESLint から移行 | bunx biome migrate eslint --write |
| Prettier から移行 | bunx biome migrate prettier --write |
クイックリファレンス
| フラグ | 説明 |
|---|---|
--write | 修正/フォーマットを適用 |
--reporter=github | GitHub アノテーション形式 |
--reporter=json | JSON 出力 |
--diagnostic-level=error | エラーのみ |
--max-diagnostics=N | 出力数を制限 |
--verbose | 詳細な診断を表示 |
--no-errors-on-unmatched | 一致しないファイルを無視 |
ci | CI モード(チェック+終了コード) |
詳しい例、高度なパターン、ベストプラクティスについては、REFERENCE.md をご覧ください。
参考資料
コメント
Markdown 対応