统一 pnpm 10 + Node 24.15.0 + Turborepo 单仓,落地 ESLint 9 flat、Prettier、commitlint、husky 与 Gitea CI,作为后续批次的一致门禁。
19 lines
671 B
JavaScript
19 lines
671 B
JavaScript
const quote = (file) => JSON.stringify(file);
|
|
|
|
// 生成的声明文件(如 openapi.d.ts)被 ESLint 忽略,跳过 lint 只做格式化,
|
|
// 避免 lint-staged 因 "File ignored" 警告而阻断提交。
|
|
const lintScripts = (filenames) => {
|
|
const lintable = filenames.filter((file) => !file.endsWith('.d.ts'));
|
|
const commands = [];
|
|
if (lintable.length > 0) {
|
|
commands.push(`eslint --fix --max-warnings=0 ${lintable.map(quote).join(' ')}`);
|
|
}
|
|
commands.push(`prettier --write ${filenames.map(quote).join(' ')}`);
|
|
return commands;
|
|
};
|
|
|
|
export default {
|
|
'*.{ts,tsx,js,mjs,cjs}': lintScripts,
|
|
'*.{json,md,css,scss,yml,yaml}': ['prettier --write'],
|
|
};
|