Files
awoooi/apps/web/.eslintrc.js
OG T 62327b6ca8 fix(i18n): 修復 placeholder 頁面硬編碼字串 + 擴展 ESLint ignore
Wave 3 i18n 合規修復:
- authorizations/knowledge-base/settings 頁面改用 t('placeholder.xxx')
- demo 頁面 brand tagline 改用 tBrand('aiTagline')
- 新增 placeholder i18n keys (zh-TW/en)
- ESLint 擴展 ignoreAttribute/ignoreCallee 覆蓋更多技術標籤

剩餘 83 個 warn 為技術組件中的英文標籤 (LIVE/SSE/Multi-Sig)
Phase 1 warn 模式可接受,待 Phase 2 升級 error 前處理

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-31 18:59:28 +08:00

85 lines
2.4 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',
'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',
],
}