- eslint.config.js (NEU): Flat-Config fuer ESLint 9 - Globals explizit definiert (console, process, Buffer, etc.) - TypeScript-Parser + Plugin - Rules: no-unused-vars, no-explicit-any (warn) - Tests haben relaxed rules (no-explicit-any off, fuer Mocks) - .eslintrc.cjs -> .eslintrc.cjs.bak (Deprecation-Warnung weg) - package.json scripts.lint: USE_FLAT_CONFIG-Flag entfernt (default flat) - Tests: 2 tote Variablen entfernt - tests/tfidf.test.ts: jaccardSim (ungenutzt, nur Kommentar-Vergleich noetig) - tests/webapp/manifest.test.ts: indexHtmlPath (ungenutzt) Verifiziert: - 117/117 Tests gruen - ESLint exit 0 (ohne Deprecation-Warnung) - Tool-Build OK, Webapp-Build OK
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
// ESLint 9 Flat Config
|
|
// Phase Bonus: Migration von .eslintrc.cjs zu eslint.config.js (flat config)
|
|
// Entfernt die Deprecation-Warnung, die bei v9 mit .eslintrc kam.
|
|
|
|
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
import tsParser from '@typescript-eslint/parser';
|
|
|
|
export default [
|
|
{
|
|
ignores: [
|
|
'dist/**',
|
|
'node_modules/**',
|
|
'webapp/dist/**',
|
|
'webapp/node_modules/**',
|
|
'eslint.config.js.bak',
|
|
],
|
|
},
|
|
{
|
|
files: ['src/**/*.ts', 'tests/**/*.ts'],
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
parserOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
},
|
|
globals: {
|
|
console: 'readonly',
|
|
process: 'readonly',
|
|
Buffer: 'readonly',
|
|
setTimeout: 'readonly',
|
|
clearTimeout: 'readonly',
|
|
fetch: 'readonly',
|
|
Response: 'readonly',
|
|
localStorage: 'readonly',
|
|
globalThis: 'readonly',
|
|
navigator: 'readonly',
|
|
window: 'readonly',
|
|
document: 'readonly',
|
|
URL: 'readonly',
|
|
NodeJS: 'readonly',
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
},
|
|
rules: {
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'no-console': 'off',
|
|
},
|
|
},
|
|
{
|
|
// Tests duerfen globalThis-Mocking und andere Tricks nutzen
|
|
files: ['tests/**/*.ts', 'src/cli/ingest.ts'],
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
},
|
|
},
|
|
];
|