biome-validator について
Biome 2.3+ の設定を検証するスキルで、コード品質ツールを導入または監査する開発者向けです。バージョンやスキーマ、現在の設定パターン、CI 検証方法を確認します。
主な機能
- 01Biome のバージョンとスキーマ確認
- 02Linter と assist の設定確認
- 03フレームワーク domain の検証
- 04非推奨パターンの検出
- 05厳格モードと CI 検証コマンド
活用シーン
- 01新しい biome.json の検証
- 02既存 Biome 設定の監査
- 03AI 生成設定の確認
- 04CI/CD への Biome 検査追加
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ gracefullight/ stock-checker --skill biome-validatorインストール後、Claude Code で/biome-validatorを入力して読み込まれたか確認します。
同梱ファイルplugin.jsonscripts/validate.py
詳細
Biome バリデーター
Biome 2.3 以降の設定を検証し、古いパターンを防ぎます。型を考慮したリンティング、ドメイン、最新の Biome 機能が適切に設定されていることを確認します。
このバリデーターが有効になるタイミング
- 新しいプロジェクトでリンティングを設定するとき
- コード品質に関する作業を始める前
- 既存の Biome 設定を監査するとき
- AI が biome.json を生成した後
- CI/CD パイプラインを検証するとき
クイックスタート
python3 ~/.claude/skills/biome-validator/scripts/validate.py --root .
python3 ~/.claude/skills/biome-validator/scripts/validate.py --root . --strict
チェック項目
1. Biome のバージョンとスキーマ
適切な例 — Biome 2.3 以降:
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json"
}
不適切な例 — 古いスキーマ:
{
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json"
}
2. パッケージのバージョン
// GOOD: v2.3+
"@biomejs/biome": "^2.3.0"
// BAD: v1.x or v2.0-2.2
"@biomejs/biome": "^1.9.0"
3. リンターの設定
適切な例 — Biome 2.x:
{
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "warn"
}
}
}
}
4. Biome Assist(2.0 以降)
適切な例 — assist を使用:
{
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
不適切な例 — 古い organizeImports の場所:
{
"organizeImports": {
"enabled": true
}
}
5. ドメイン(2.0 以降)
適切な例 — フレームワーク固有のルールにドメインを使用:
{
"linter": {
"domains": {
"react": "on",
"next": "on"
}
}
}
6. 抑制コメント
適切な例 — Biome 2.0 以降のコメント:
// biome-ignore lint/suspicious/noExplicitAny: legacy code
// biome-ignore-all lint/style/useConst
// biome-ignore-start lint/complexity
// biome-ignore-end
不適切な例 — 書式が誤っている場合:
// @ts-ignore // Not Biome
// eslint-disable // Wrong tool
Biome 2.3 以降の機能
型を考慮したリンティング
Biome 2.0 以降では、TypeScript コンパイラーを必要とせずに型推論を利用できます。
{
"linter": {
"rules": {
"correctness": {
"noUndeclaredVariables": "error",
"useAwaitThenable": "error"
}
}
}
}
Assist アクション
{
"assist": {
"actions": {
"source": {
"organizeImports": "on",
"useSortedKeys": "on"
}
}
}
}
複数ファイルの分析
リンタールールはほかのファイルの情報を参照して、より強力な分析を行えます。
フレームワークドメイン
{
"linter": {
"domains": {
"react": "on", // React-specific rules
"next": "on", // Next.js rules
"test": "on" // Testing framework rules
}
}
}
推奨設定
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noForEach": "off"
},
"style": {
"noNonNullAssertion": "off"
},
"suspicious": {
"noArrayIndexKey": "off",
"noExplicitAny": "warn"
},
"correctness": {
"useAwaitThenable": "error",
"noLeakedRender": "error"
}
},
"domains": {
"react": "on",
"next": "on"
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "es5",
"semicolons": "always"
}
},
"files": {
"ignore": [
"node_modules",
"dist",
"build",
".next",
"out",
".cache",
".turbo",
"coverage"
]
}
}
非推奨のパターン
| 非推奨 | 置き換え先(2.3 以降) |
|---|---|
organizeImports.enabled | assist.actions.source.organizeImports |
| スキーマ < 2.0 | スキーマ 2.3.11 以降 |
@biomejs/biome < 2.3 | @biomejs/biome@latest |
| ドメイン設定なし | フレームワークには linter.domains を使用 |
検証結果
=== Biome 2.3+ Validation Report ===
Package Version: @biomejs/[email protected] ✓
Configuration:
✓ Schema version: 2.3.11
✓ Linter enabled with recommended rules
✓ Using assist.actions for imports
✗ No domains configured (consider enabling react, next)
✓ Formatter configured
Rules:
✓ noExplicitAny: warn
✓ useAwaitThenable: error
✗ noLeakedRender not enabled (recommended)
Summary: 2 issues found
ESLint からの移行
ステップ 1:Biome をインストールする
bun remove eslint prettier eslint-config-* eslint-plugin-*
bun add -D @biomejs/biome@latest
ステップ 2:biome.json を作成する
bunx biome init
ステップ 3:ルールを移行する
bunx biome migrate eslint --write
ステップ 4:スクリプトを更新する
{
"scripts": {
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"format": "biome format --write .",
"check": "biome check .",
"check:fix": "biome check --write ."
}
}
ステップ 5:古い設定を削除する
rm .eslintrc* .prettierrc* .eslintignore .prettierignore
VS Code との連携
// .vscode/settings.json
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
}
}
CI/CD との連携
# .github/workflows/lint.yml
- name: Validate Biome Config
run: |
python3 ~/.claude/skills/biome-validator/scripts/validate.py \
--root . \
--strict \
--ci
- name: Lint
run: bunx biome check --error-on-warnings .
連携
linter-formatter-init- Biome を一からセットアップしますnextjs-validator- Next.js を検証します(next ドメインを有効にします)bun-validator- Bun ワークスペースを検証します
コメント
Markdown 対応