Files
awoooi/apps/web/.eslintrc.js
OG T 83a0845858
All checks were successful
E2E Health Check / e2e-health (push) Successful in 18s
feat(lint): Wave 3 ESLint i18n Plugin 啟用 (warn 模式)
安裝 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>
2026-03-31 18:54:47 +08:00

65 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 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',
],
}