/** * 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', 'aria-label', 'title', 'rel', 'target', ], // 忽略特定函數調用 (翻譯函數 + console) ignoreCallee: [ 'console.log', 'console.error', 'console.warn', 'console.info', 't', 'tRisk', 'tBlast', 'tBrand', 'tApproval', 'tMock', 'tDryRun', 'useTranslations', ], // 忽略技術字串模式 (版本號、程式碼標識符) ignore: [ // 版本號 /^v\d+\.\d+\.\d+$/, /^v\d+\.\d+$/, // 技術標籤 (全大寫英文 2-20 字元) /^[A-Z][A-Z0-9_\s\-]{1,19}$/, // 單一字元 (x, n, y, $, |) /^.$/, // CSS 類別 /^[a-z][a-z0-9\-_]*$/, ], }], // 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', ], }