SuperAPI AI 工具集

ts-lint-format

编程与开发

查看项目

更新于 10-15 21:49

技能介绍

用途:帮助为 TypeScript 项目选择并配置 lint/format 方案,覆盖 2026 年两者的取舍——新项目默认 Biome(一个二进制、零配置起步、快),既有且类型密集的代码库倾向 ESLint + typescript-eslint 类型感知规则;另含 Oxlint 作为挑战者的说明。不适用于运行时执行(属 ts-runtime-node/ts-runtime-bun)、框架自有样式规则,以及类型检查本身(tsc --noEmit、tsconfig 标志属 ts-config)。

主要能力:配置 Biome 2.x(biome.json、biome check、domains、类型感知规则);配置 ESLint 10 flat config + typescript-eslint 类型感知 lint;从 ESLint+Prettier 迁移,或添加 CI lint 门禁。

关键规则:只选一个 formatter,Biome 同时格式化与 lint,不要再对同一批文件跑 Prettier。类型感知 lint 需要类型检查器,typescript-eslint 类型规则与 Biome 类型感知规则都需一次构建,比语法规则慢。Biome 不做格式化 lint,从不通过 lint 规则报告格式,格式由 formatter 决定。ESLint 10 仅支持 flat config,使用 eslint.config.mjs 与 typescript-eslint 的 tseslint.configs.;.eslintrc. 与 .eslintignore 在 v10 被移除(ESLint 9 自 2026-08-06 起 EOL)。typescript-eslint 8.x 的 peer 依赖 typescript <6.1.0,在 TS 7.0 项目上需把 typescript 别名到 @typescript/typescript6。覆盖差距真实存在:Biome 类型感知规则约覆盖 75% 的类型化 lint 需求,完整跨文件收窄和 no-unsafe-* 仍需 typescript-eslint。

架构:项目使用 biome.json(Biome 路径)或 eslint.config.mjs(ESLint 路径,此路径下配 .prettierrc),类型化 lint 两者都需要 tsconfig.json。

工作流(强制):任何实现前并行发起 3 个 agent——fuse-ai-pilot:explore-codebase 检测现有 lint/format 配置、项目年龄与框架;fuse-ai-pilot:research-expert 经 Context7/Exa 核实最新 Biome 2.x 与 typescript-eslint;mcp__context7__query-docs 查阅 Biome 与 typescript-eslint 文档。实现后运行 fuse-ai-pilot:sniper 验证。

适用场景与限制:新建项目默认 Biome 2.x;既有或类型密集代码库用 ESLint 10 + typescript-eslint 类型感知。CI 中以 error 级别运行以把关合并。不要同时用 Biome 与 Prettier,不要开启类型感知 lint 又抱怨速度,不要假设 Biome 覆盖全部 typescript-eslint 规则。