SuperAPI AI 工具集

code-quality

编程与开发

查看项目

更新于 11-13 08:07

技能介绍

用途:帮助维护 IsLeapYear 项目的代码质量,围绕 Biome 的 lint 与格式化能力,配合 Husky、lint-staged 和 commitlint,覆盖本地检查、提交前校验和提交信息规范。

主要能力:使用 Biome 2.3.7 进行代码检查与格式化,替代 ESLint 和 Prettier;提供检查全部文件、自动修复、格式化、仅 lint 等命令;通过 biome.json 配置缩进、引号、分号、推荐规则、import 整理等;禁用 noUnknownProperty 以兼容 Tailwind @plugin 语法,并启用 useSortedClasses 强制 Tailwind 类名排序;通过 Husky 配置 pre-commit 与 commit-msg 钩子,pre-commit 运行 lint-staged,commit-msg 使用 commitlint 校验提交信息;lint-staged 对暂存文件执行 biome check --write 并自动修复、整理 import、格式化。

使用方式:运行 pnpm biome check . 检查问题,pnpm biome check --write . 自动修复,pnpm biome format --write . 格式化,pnpm lint 仅执行 lint;可对单个文件或目录执行 npx biome format --write;提交信息需遵循 type(scope): subject 格式,类型包括 feat、fix、docs、style、refactor、perf、test、build、ci、chore、revert,header 最大长度 100;紧急情况下可用 git commit --no-verify 或 -n 跳过钩子,但资料建议谨慎使用;VS Code 可安装 Biome 扩展并配置保存时格式化与自动整理 import;GitHub Actions 在 PR 上运行 lint 和 build 检查。

适用场景:修复 lint 错误、格式化代码、配置 Biome 规则、整理 import、解决代码风格问题、理解或调整 git hooks、处理提交前质量检查、排查 Biome 检查失败、提交信息不符合规范或 lint-staged 失败等问题。

限制:资料说明该项目使用 pnpm,不使用 npm/yarn/bun;Biome 不包含部分自定义 ESLint 规则,插件生态较小;技能内容针对 IsLeapYear 项目,其他项目的配置与命令可能不同;紧急跳过钩子会绕过质量检查。