All checks were successful
E2E Health Check / e2e-health (push) Successful in 18s
安裝 eslint-plugin-i18next: - 檢測 JSX 中硬編碼字串 - markupOnly: true (只檢查 JSX) - 忽略技術屬性: data-testid, className, href, src 階段一: warn 模式 (當前) 階段二: error 模式 (待統帥批准) 發現 10+ 遺留警告,待修復 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
/**
|
||
* AWOOOI Web ESLint Configuration
|
||
* ================================
|
||
* Extends @awoooi/eslint-config/react
|
||
* Wave 3: i18n enforcement via eslint-plugin-i18next
|
||
*/
|
||
|
||
module.exports = {
|
||
extends: ['@awoooi/eslint-config/react', 'next/core-web-vitals'],
|
||
plugins: ['i18next'],
|
||
parserOptions: {
|
||
project: './tsconfig.json',
|
||
tsconfigRootDir: __dirname,
|
||
},
|
||
rules: {
|
||
// Next.js specific
|
||
'@next/next/no-html-link-for-pages': 'off',
|
||
|
||
// Allow console for debugging (TODO: integrate unified logger)
|
||
'no-console': 'off',
|
||
|
||
// Wave 3: i18n enforcement - 禁止 JSX 中的硬編碼字串
|
||
// 階段一: warn 模式 (2026-03-31)
|
||
// 階段二: error 模式 (待統帥批准)
|
||
'i18next/no-literal-string': ['warn', {
|
||
// 允許技術識別符 (服務名/API 路徑)
|
||
markupOnly: true,
|
||
// 忽略特定屬性
|
||
ignoreAttribute: [
|
||
'data-testid',
|
||
'className',
|
||
'href',
|
||
'src',
|
||
'alt',
|
||
'name',
|
||
'type',
|
||
'placeholder', // 部分 placeholder 可能需要 i18n,視情況調整
|
||
],
|
||
// 忽略特定函數調用
|
||
ignoreCallee: ['console.log', 'console.error', 'console.warn', 't', 'tRisk', 'tBlast'],
|
||
}],
|
||
|
||
// TypeScript strict rules
|
||
'@typescript-eslint/no-explicit-any': 'warn',
|
||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
||
'@typescript-eslint/consistent-type-imports': 'warn',
|
||
'no-constant-condition': 'warn',
|
||
|
||
// ADR-013: JSDoc for exported functions (Phase 2 - warn only)
|
||
// 'jsdoc/require-jsdoc': ['warn', {
|
||
// require: { FunctionDeclaration: true, MethodDefinition: true },
|
||
// contexts: ['ExportNamedDeclaration > FunctionDeclaration'],
|
||
// }],
|
||
},
|
||
ignorePatterns: [
|
||
'node_modules',
|
||
'.next',
|
||
'out',
|
||
'dist',
|
||
'test-results',
|
||
'*.config.js',
|
||
'*.config.ts',
|
||
],
|
||
}
|