10404dbb36
同步工作区剩余变更,主要包括: - 营销页面组件与布局持续优化(about/news/services/solutions/team 等) - 详情页四层叙事组件、布局组件、UI 组件调整 - CMS 数据模型、API 路由、权限、工作流、站内通知、媒体管理扩展 - 新增/补充单元测试与 E2E 测试(cms-workflow.spec.ts 等) - ESLint 9 迁移、jest/tsconfig 配置更新、依赖调整 - 新增 ADR、CMS 评估文档、Release Review / Acceptance 报告 - 移除水墨装饰组件与大体积未使用字体文件
124 lines
3.1 KiB
JavaScript
124 lines
3.1 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/**',
|
|
'out/**',
|
|
'build/**',
|
|
'dist/**',
|
|
'node_modules/**',
|
|
'coverage/**',
|
|
'scripts/**',
|
|
'config/test/**',
|
|
'**/_archive/**',
|
|
'.agents/**',
|
|
'test-framework/**',
|
|
'tests/styles/**',
|
|
'next-env.d.ts',
|
|
'playwright-report/**',
|
|
'.lighthouseci/**',
|
|
'test-results/**',
|
|
'release-acceptance-reports/**',
|
|
'.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;
|