ihm_client/eslint.config.js

124 lines
3.4 KiB
JavaScript

import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
export default [
js.configs.recommended,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json'
},
globals: {
'console': 'readonly',
'window': 'readonly',
'document': 'readonly',
'navigator': 'readonly',
'crypto': 'readonly',
'setTimeout': 'readonly',
'clearTimeout': 'readonly',
'setInterval': 'readonly',
'clearInterval': 'readonly',
'alert': 'readonly',
'confirm': 'readonly',
'prompt': 'readonly',
'fetch': 'readonly',
'localStorage': 'readonly',
'sessionStorage': 'readonly',
'indexedDB': 'readonly',
'IDBDatabase': 'readonly',
'IDBTransaction': 'readonly',
'IDBObjectStore': 'readonly',
'IDBRequest': 'readonly',
'customElements': 'readonly',
'requestAnimationFrame': 'readonly',
'cancelAnimationFrame': 'readonly',
'performance': 'readonly',
'WebAssembly': 'readonly',
'btoa': 'readonly',
'atob': 'readonly',
'self': 'readonly',
'SharedWorker': 'readonly',
'Worker': 'readonly',
'caches': 'readonly'
}
},
plugins: {
'@typescript-eslint': typescript
},
rules: {
// Qualité du code - Règles plus permissives pour commencer
'complexity': ['warn', 15],
'max-lines': ['warn', 500],
'max-lines-per-function': ['warn', 100],
'max-params': ['warn', 6],
'max-depth': ['warn', 6],
// TypeScript spécifique - Plus permissif
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'ignoreRestSiblings': true
}],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
// Bonnes pratiques - Plus permissif
'no-console': 'off', // Permettre console pour le debug
'no-debugger': 'error',
'no-alert': 'warn',
'prefer-const': 'warn',
'no-var': 'error',
'eqeqeq': 'warn',
'curly': 'warn',
// Sécurité
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
// Performance - Plus permissif
'no-loop-func': 'warn',
'no-await-in-loop': 'off' // Permettre await dans les boucles pour l'instant
}
},
{
files: ['**/*.worker.ts', '**/*.worker.js'],
languageOptions: {
globals: {
'self': 'readonly',
'postMessage': 'readonly',
'onmessage': 'readonly',
'importScripts': 'readonly',
'btoa': 'readonly',
'atob': 'readonly',
'crypto': 'readonly',
'console': 'readonly'
}
}
},
{
ignores: [
'dist/',
'node_modules/',
'*.js',
'!eslint.config.js',
'pkg/',
'vite.config.ts',
'test-browser/',
'logs/',
'coverage/',
'.nyc_output/',
'**/*.test.ts',
'**/*.spec.ts'
]
}
];