关于 biome-validator
biome-validator 是用于 JavaScript 和 TypeScript 项目中设置及审查 Biome 配置的技能。它检查配置模式是否符合要求、是否使用过时设置,以及是否适用于 CI/CD。
主要功能
- 01验证 Biome schema 和软件包版本
- 02检查 linter 与 assist 配置
- 03审查框架 domain 设置
- 04发现过时配置模式
- 05指导从 ESLint 迁移
适用场景
- 01检查新建的 Biome 配置
- 02审查现有 biome.json
- 03检查 AI 生成的 Biome 配置
- 04验证 CI/CD 前的 Biome 设置
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ shipshitdev/ skills --skill biome-validator安装后在 Claude Code 中输入/biome-validator确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
plugin.jsonreferences/full-guide.mdscripts/validate.py详细介绍
Biome 验证器
适用场景
- 为新项目设置代码检查
- 开展任何代码质量工作之前
- 审查现有 Biome 配置
- AI 生成 biome.json 后
- CI/CD 流水线验证
快速开始
python3 scripts/validate.py --root .
python3 scripts/validate.py --root . --strict
检查内容
| 检查项 | 正确(2.3+) | 错误(旧版) |
|---|---|---|
| Schema 版本 | "$schema": ".../2.3.12/schema.json" | .../1.9.0/schema.json 或更旧版本 |
| 软件包版本 | "@biomejs/biome": "^2.3.0" | "^1.9.0" 或 2.0-2.2 |
| Linter 配置 | linter.rules.recommended: true | 缺失或旧版 rules 结构 |
| Assist 操作 | assist.actions.source.organizeImports | 顶层 organizeImports.enabled |
| Domains | linter.domains.react / .next: "on" | 未配置 domains |
| 抑制注释 | // biome-ignore lint/<rule>: reason | // eslint-disable、// @ts-ignore |
Biome 2.0+ 还新增了类型感知代码检查(无需 TypeScript 编译器)和多文件代码检查分析。
完整的 GOOD/BAD 配置示例以及完整的推荐 biome.json,请参阅 references/full-guide.md(§ What Gets Checked、§ Biome 2.3+ Features、§ Recommended Configuration)。
已弃用模式
| 已弃用 | 替代方案(2.3+) |
|---|---|
organizeImports.enabled | assist.actions.source.organizeImports |
| Schema < 2.0 | Schema 2.3.11+ |
@biomejs/biome < 2.3 | @biomejs/biome@latest |
| 未配置 domains | 为框架使用 linter.domains |
验证报告示例请参阅 references/full-guide.md(§ Validation Output)。
从 ESLint 迁移
- 移除 ESLint/Prettier 软件包,添加
@biomejs/biome@latest - 生成配置:
bunx biome init - 迁移现有规则:
bunx biome migrate eslint --write - 更新
package.json中的 lint/format 脚本,使其调用biome - 删除旧的
.eslintrc*/.prettierrc*/.eslintignore/.prettierignore
每个步骤的准确命令,以及 VS Code 编辑器设置和 CI/CD 工作流片段,请参阅 references/full-guide.md(§ Migration from ESLint)。
集成
linter-formatter-init- 从头设置 Biomenextjs-validator- 验证 Next.js(启用 next domain)bun-validator- 验证 Bun 工作区
评论
支持 Markdown