ESLint 升级到 recommended-type-checked + stylistic-type-checked, 引入 perfectionist 导入排序和 import 插件导入验证。 Prettier 显式声明全部格式化参数,消除跨环境差异。 TypeScript 启用 noUnusedLocals 和 noPropertyAccessFromIndexSignature。 完善 ignore 列表,排除 .agents/、bun.lock、data/ 等。 引入 husky + lint-staged(pre-commit)+ commitlint(commit-msg)。 更新 DEVELOPMENT.md 代码质量章节。 修复所有新增规则检测到的类型和风格违规。
20 lines
645 B
TypeScript
20 lines
645 B
TypeScript
import { rm } from "node:fs/promises";
|
|
import { resolve } from "node:path";
|
|
|
|
const root = resolve(import.meta.dir, "..");
|
|
|
|
const patterns: Array<{ desc: string; glob: string }> = [
|
|
{ desc: "Bun 构建缓存", glob: ".build/" },
|
|
{ desc: "Bun 构建临时文件", glob: ".*.bun-build" },
|
|
];
|
|
|
|
for (const { desc, glob } of patterns) {
|
|
const entries = await Array.fromAsync(new Bun.Glob(glob).scan({ cwd: root, dot: true }));
|
|
if (entries.length === 0) continue;
|
|
for (const entry of entries) {
|
|
const full = resolve(root, entry);
|
|
await rm(full, { force: true, recursive: true });
|
|
console.log(`已清理 ${desc}: ${entry}`);
|
|
}
|
|
}
|