退役(零视觉影响:NEXT_PUBLIC_HERO_SCENE 从未在任何 .env* 设置): - 删 hero-scene.tsx(694行)/caption/单测/文案真源/CC0 机柜/海报帧 - R26 删除、R22 登记归零、e2e heroSceneMask 移除(无命中的假安全网) - R22 自证改可注入(夹具不再依赖生产条目) 落库(flag NEXT_PUBLIC_HERO_FIELD 样期默认关 ⇒ 基线零影响): - hero-field.tsx 三拍:噪声→增长→判断;bloom 半分辨率;DPR≤1.5 - 降级统一看结论帧(reduced-motion 定格 T_HOLD=40500 非 0) - 文案真源含承诺词正则守卫(禁帮助/赋能/提升/%/倍) - 海报帧 capture 脚本与资产同批入库(1920x864/26.9KB,可复现) - eslint 忽略 demo/**/vendor/**(vendored three 不可被 lint-staged --fix 改写) 守卫重建:R26 指向 hero-field(43260ms/3 拍合规);R22 登记 HeroField 条目 验证:tsc 0 / eslint 0 error / jest 162 套件 1906 例 / check:grammar 26+26 / check:a11y 0 违规 / 默认构建首页 DOM 冒烟 E 案不变
134 lines
3.7 KiB
JavaScript
134 lines
3.7 KiB
JavaScript
import { dirname } from 'path';
|
||
import { fileURLToPath } from 'url';
|
||
import nextConfig from 'eslint-config-next';
|
||
import tsParser from '@typescript-eslint/parser';
|
||
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
||
import reactPlugin from 'eslint-plugin-react';
|
||
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||
|
||
const config = [
|
||
...nextConfig,
|
||
{
|
||
name: 'ruixin/custom',
|
||
files: ['**/*.{js,jsx,ts,tsx}'],
|
||
languageOptions: {
|
||
parser: tsParser,
|
||
parserOptions: {
|
||
ecmaVersion: 2020,
|
||
sourceType: 'module',
|
||
ecmaFeatures: {
|
||
jsx: true,
|
||
},
|
||
},
|
||
globals: {
|
||
jest: 'readonly',
|
||
},
|
||
},
|
||
plugins: {
|
||
'@typescript-eslint': tsPlugin,
|
||
react: reactPlugin,
|
||
'react-hooks': reactHooksPlugin,
|
||
},
|
||
settings: {
|
||
react: {
|
||
version: 'detect',
|
||
},
|
||
},
|
||
rules: {
|
||
'react/react-in-jsx-scope': 'off',
|
||
'react/no-unescaped-entities': 'error',
|
||
'react/jsx-no-target-blank': 'error',
|
||
'react/self-closing-comp': 'error',
|
||
'react/display-name': 'off',
|
||
'@typescript-eslint/no-unused-vars': [
|
||
'error',
|
||
{
|
||
argsIgnorePattern: '^_',
|
||
varsIgnorePattern: '^_',
|
||
},
|
||
],
|
||
'@typescript-eslint/no-explicit-any': 'warn',
|
||
'@typescript-eslint/no-empty-object-type': 'off',
|
||
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
||
'prefer-const': 'error',
|
||
'no-var': 'error',
|
||
eqeqeq: ['error', 'always'],
|
||
curly: ['error', 'multi-line'],
|
||
'no-throw-literal': 'error',
|
||
'prefer-promise-reject-errors': 'error',
|
||
'react-hooks/set-state-in-effect': 'warn',
|
||
},
|
||
},
|
||
{
|
||
name: 'ruixin/e2e-tests',
|
||
files: ['e2e/**/*.ts'],
|
||
rules: {
|
||
// E2E 测试使用 console.log 输出诊断信息,允许
|
||
'no-console': 'off',
|
||
},
|
||
},
|
||
{
|
||
name: 'ruixin/unit-tests',
|
||
files: ['**/*.test.{ts,tsx}', '**/__tests__/**/*.{ts,tsx}'],
|
||
rules: {
|
||
// 单测/集成测试在 mock 与断言中常使用 any,允许
|
||
'@typescript-eslint/no-explicit-any': 'off',
|
||
},
|
||
},
|
||
{
|
||
name: 'ruixin/performance-tests',
|
||
files: ['tests/performance/*.js'],
|
||
rules: {
|
||
// k6 性能测试脚本按惯例使用匿名默认导出
|
||
'import/no-anonymous-default-export': 'off',
|
||
},
|
||
},
|
||
{
|
||
name: 'ruixin/ignores',
|
||
ignores: [
|
||
'.next/**',
|
||
// 代理工作树(.qoder/worktrees/**)是同一仓库的第二份副本,
|
||
// 不忽略会让 lint 把整棵工作树再扫一遍(实测 149,969 problems),
|
||
// 本仓库自己的 0 error 口径被噪声淹没。
|
||
'.qoder/**',
|
||
'.stryker-tmp/**',
|
||
'out/**',
|
||
'build/**',
|
||
'dist/**',
|
||
'node_modules/**',
|
||
'coverage/**',
|
||
'src/generated/**',
|
||
'scripts/**',
|
||
'config/test/**',
|
||
'**/_archive/**',
|
||
'.agents/**',
|
||
'test-framework/**',
|
||
'tests/styles/**',
|
||
'next-env.d.ts',
|
||
'playwright-report/**',
|
||
'.lighthouseci/**',
|
||
'test-results/**',
|
||
'release-acceptance-reports/**',
|
||
// demo/**/vendor/** 是为让 demo 脱离 /node_modules 自包含而内置的 three 库本体与附件,
|
||
// 第三方 vendored 文件既不该被 lint(181 errors 全是 three 源码风格问题),
|
||
// 更不能被 lint-staged 的 `eslint --fix` 自动改写——那会损坏库文件。
|
||
'demo/**/vendor/**',
|
||
'.trae/**',
|
||
'*.log',
|
||
'*.txt',
|
||
'build-output.txt',
|
||
'e2e-output.txt',
|
||
'type-check-output.txt',
|
||
'lint-output.txt',
|
||
'npm-audit-output.txt',
|
||
'test-unit-output.txt',
|
||
'accessibility-report.json',
|
||
'heading-hierarchy-report.json',
|
||
],
|
||
},
|
||
];
|
||
|
||
export default config;
|