eb81a57ebc
审查修复(Plan 4 Task 3 review): - 载荷类型单一事实来源:ContentEntry/TaxonomyEntry/TaxonomyTerm/RouteEntry/ AssetEntry/RenderManifestMeta/SiteConfigPayload/BrandConfigPayload 上提 @sf/contracts/render-snapshot(纯新增、不动既有导出——冻结面加法无需升版); 物化端(apps/api build/render-snapshot.ts)与主题 load-render-data 同源引用, 双份手写镜像漂移即编译期破裂;主题侧 re-export 保持既有 import 面 - loader 空路由表前置明错(正常发布站点至少含首页路由——静默渲染会产零页站点) - ui.routeHrefFor:targetContentId → 纯路径 html 落点(redirect/查询行不参与, 无落点 undefined 不虚构——Task 4 分派器入口)+ 测试 - 具夹 assets.json copyPath 去机器相关绝对路径(改仓库相对) - eslint ignores 增 **/.astro/**(astro build 再生目录) 354 根测试 + 18 主题测试全绿;五段 typecheck;lint(.astro 存在态验证后清理)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
48 lines
1.8 KiB
JavaScript
48 lines
1.8 KiB
JavaScript
// eslint 9 flat config(Task 14):最小保守集——JS/TS recommended + 少量明显增益规则。
|
||
// 原则:不做风格警察;现有代码若对某规则大面积误报则降级该规则,而非批量改代码。
|
||
import eslint from '@eslint/js'
|
||
import tseslint from 'typescript-eslint'
|
||
|
||
export default tseslint.config(
|
||
// 依赖与构建产物不参与 lint
|
||
{ ignores: ['**/node_modules/**', '**/dist/**', 'coverage/**', '.artifacts/**', '**/.astro/**'] },
|
||
eslint.configs.recommended,
|
||
...tseslint.configs.recommended,
|
||
{
|
||
rules: {
|
||
// 未用变量报错,但允许下划线前缀显式豁免(测试/签名对齐常见)
|
||
'@typescript-eslint/no-unused-vars': [
|
||
'error',
|
||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
||
],
|
||
},
|
||
},
|
||
{
|
||
// 测试代码放宽 no-explicit-any:夹具行插入用 `as any` 表达"部分列 + 任意宽松形状"、
|
||
// catch (e: any) 取 postgres.js 错误细节,均为有意为之(49 处违例集中于此)。
|
||
// 生产代码(src/)保持该规则严格。
|
||
files: ['tests/**/*.ts', '**/test/**/*.ts'],
|
||
rules: {
|
||
'@typescript-eslint/no-explicit-any': 'off',
|
||
},
|
||
},
|
||
{
|
||
// Node 直跑的 .mjs 工具脚本(如 scripts/smoke-real-wxr.mjs):no-undef 对 TS 文件
|
||
// 由 TS 接管而关闭,但 .mjs 仍生效且无 node 全局——此处显式声明 node 全局,
|
||
// 否则 process/setInterval 等误报 no-undef。
|
||
files: ['scripts/**/*.mjs'],
|
||
languageOptions: {
|
||
globals: {
|
||
process: 'readonly',
|
||
setInterval: 'readonly',
|
||
clearInterval: 'readonly',
|
||
setTimeout: 'readonly',
|
||
clearTimeout: 'readonly',
|
||
console: 'readonly',
|
||
performance: 'readonly',
|
||
Buffer: 'readonly',
|
||
},
|
||
},
|
||
},
|
||
)
|