chore: added eslint-i18next to tighten down i18n expectations
This commit is contained in:
93
eslint.config.mjs
Normal file
93
eslint.config.mjs
Normal file
@@ -0,0 +1,93 @@
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
|
||||
import i18next from 'eslint-plugin-i18next';
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: [
|
||||
'dist/**',
|
||||
'coverage/**',
|
||||
'drizzle/**',
|
||||
'node_modules/**',
|
||||
],
|
||||
},
|
||||
{
|
||||
files: ['src/renderer/**/*.{ts,tsx}'],
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': tsEslintPlugin,
|
||||
i18next,
|
||||
},
|
||||
rules: {
|
||||
'i18next/no-literal-string': ['warn', {
|
||||
mode: 'jsx-only',
|
||||
'jsx-components': {
|
||||
exclude: ['Trans'],
|
||||
},
|
||||
'jsx-attributes': {
|
||||
exclude: [
|
||||
'className',
|
||||
'styleName',
|
||||
'style',
|
||||
'type',
|
||||
'key',
|
||||
'id',
|
||||
'width',
|
||||
'height',
|
||||
'viewBox',
|
||||
'd',
|
||||
'fill',
|
||||
'stroke',
|
||||
'xmlns',
|
||||
'data-testid',
|
||||
'role',
|
||||
'tabIndex',
|
||||
'aria-hidden',
|
||||
'mode',
|
||||
'theme',
|
||||
'lineNumbers',
|
||||
'cursorStyle',
|
||||
'cursorBlinking',
|
||||
'value',
|
||||
],
|
||||
},
|
||||
callees: {
|
||||
exclude: [
|
||||
'i18n(ext)?',
|
||||
't',
|
||||
'tr',
|
||||
'require',
|
||||
'addEventListener',
|
||||
'removeEventListener',
|
||||
'postMessage',
|
||||
'getElementById',
|
||||
'dispatch',
|
||||
'commit',
|
||||
'includes',
|
||||
'indexOf',
|
||||
'endsWith',
|
||||
'startsWith',
|
||||
],
|
||||
},
|
||||
words: {
|
||||
exclude: [
|
||||
'[0-9!-/:-@[-`{-~]+',
|
||||
'[A-Z_-]+',
|
||||
/^\p{Emoji}+$/u,
|
||||
'[✓✗▼▶◀▲]+'
|
||||
],
|
||||
},
|
||||
message: 'i18n literal string',
|
||||
}],
|
||||
},
|
||||
},
|
||||
];
|
||||
1124
package-lock.json
generated
1124
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,8 @@
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"test:ui": "vitest --ui",
|
||||
"lint": "eslint \"src/renderer/**/*.{ts,tsx}\"",
|
||||
"lint:i18n": "eslint \"src/renderer/**/*.{ts,tsx}\" --rule \"i18next/no-literal-string: warn\"",
|
||||
"db:generate": "node ./node_modules/drizzle-kit/bin.cjs generate",
|
||||
"db:migrate": "node ./node_modules/tsx/dist/cli.mjs src/main/database/migrate.ts",
|
||||
"db:studio": "node ./node_modules/drizzle-kit/bin.cjs studio"
|
||||
@@ -35,6 +37,8 @@
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/turndown": "^5.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
||||
"@typescript-eslint/parser": "^8.56.0",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"@vitest/ui": "^4.0.18",
|
||||
@@ -44,6 +48,8 @@
|
||||
"electron": "^40.4.0",
|
||||
"electron-builder": "^26.7.0",
|
||||
"electron-store": "^11.0.2",
|
||||
"eslint": "^9.39.3",
|
||||
"eslint-plugin-i18next": "^6.1.3",
|
||||
"jsdom": "^28.0.0",
|
||||
"memfs": "^4.6.0",
|
||||
"tsx": "^4.6.0",
|
||||
|
||||
Reference in New Issue
Block a user