承接 ADR-0014 §4「第二等产品镜像起必须子目录化 + rewrites 前缀映射并回溯睿视」。
上一轮(2026-12-02)只搬了字节,源码落在 public/ 根命名空间;本轮把源码、门禁、
发布职责一并收进本仓,authority 侧退役对应产物。
源码与 URL 契约:
- public/novavis/{index.html,css,js,assets,images/logos} 一棵树自成一体
- index.html 引用保持站点级绝对路径(/css /js /assets /images/logos)不变。
因为同一份字节要服务两个落点:官网镜像 novalon.cn/novavis/,以及独立子域
novavis.p.novalon.cn/(页面在根路径)。改绝对路径会把子域首页变成 /novavis/
- 故用 4 条 prefix rewrite 把根命名空间映射进子目录,而非改写 HTML
四道门禁(从 authority 的四个 python 脚本移植为 Playwright,已并入 test:all):
- e2e/landing/{layout,motion,demo,a11y}.spec.ts + 独立 config(单引擎单 project 串行)
- layout:几何与焦点 / motion:js-grow 渐进生长与 reduced-motion 直达终态
- demo:首屏剧本四步 + 徽标一一对应 + 无 JS 降级四层真实可见性
- a11y:结构与全量对比度(同色无条件阻断)+ axe critical/serious=0
- 实测 13 passed / EXIT=0(1.4m)
补一个映射期暴露的真缺陷:landing 的 main.js 固定 POST /api/v1/contact 且只认
code===200,而本仓只有 /api/contact(formData + 必填 subject),镜像侧转化路径
一直 404。新增 src/app/api/v1/contact/route.ts 按 authority 契约响应(JSON +
{code:200}),而非改前端去适配本仓——改前端等于把适配成本转嫁给子域,且会让
两个落点的成功判据不一致。9 个单测覆盖校验、限流、上游失败不透传 5xx。
文档与配置同步:CLAUDE.md → AGENTS.md(单文档真源)、docs/landing.md、
docs/deployment.md §八、ADR-0014、qa-tracker §32、README 与 quality-gates 脚本表、
Jenkinsfile 落地「♿ 可访问性门禁」阶段的 landing 四道门禁、eslint 忽略
.next-dev-live 构建产物目录(未忽略时 eslint . 会扫出 21195 errors)。
门禁:tsc 0 / eslint 0 / jest app/api/v1 9/9 / test:landing 13 passed。
141 lines
4.2 KiB
JavaScript
141 lines
4.2 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/**',
|
||
// 本地 dev 构建目录(`NEXT_DIST_DIR=.next-dev-live` 的产物)。
|
||
// 2026-12-03 实测:未忽略时 `eslint .` 会扫出 **21195 errors**(全是构建产物里的
|
||
// 压缩代码风格问题),把「0 error」的口径整体淹没;而该目录本就未入库。
|
||
'.next-dev-live/**',
|
||
// 本地 agent 工具目录(已 gitignore)。未忽略时其下的临时脚本会贡献 8 条 error,
|
||
// 同样不属于本仓门禁面。
|
||
'.workbuddy/**',
|
||
'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;
|