|
| 1 | +// ESLint flat config for GENERATED code (packages_generated/) |
| 2 | +// More permissive rules suitable for generated TypeScript files |
| 3 | + |
| 4 | +import typescriptParser from '@typescript-eslint/parser' |
| 5 | +import typescriptPlugin from '@typescript-eslint/eslint-plugin' |
| 6 | +import importPlugin from 'eslint-plugin-import' |
| 7 | +import unusedImports from 'eslint-plugin-unused-imports' |
| 8 | + |
| 9 | +export default [ |
| 10 | + { |
| 11 | + files: ['packages_generated/**/*.ts'], |
| 12 | + ignores: [ |
| 13 | + 'packages_generated/**/vite.config.ts', |
| 14 | + 'packages_generated/**/dist/**', |
| 15 | + ], |
| 16 | + languageOptions: { |
| 17 | + parser: typescriptParser, |
| 18 | + parserOptions: { |
| 19 | + ecmaVersion: 'latest', |
| 20 | + sourceType: 'module', |
| 21 | + }, |
| 22 | + }, |
| 23 | + plugins: { |
| 24 | + '@typescript-eslint': typescriptPlugin, |
| 25 | + 'import': importPlugin, |
| 26 | + 'unused-imports': unusedImports, |
| 27 | + }, |
| 28 | + settings: { |
| 29 | + 'import/resolver': { |
| 30 | + node: { |
| 31 | + extensions: ['.ts', '.tsx', '.js', '.jsx'], |
| 32 | + }, |
| 33 | + }, |
| 34 | + }, |
| 35 | + rules: { |
| 36 | + // CRITICAL: Disable base rules first (required for unused-imports plugin) |
| 37 | + 'no-unused-vars': 'off', |
| 38 | + '@typescript-eslint/no-unused-vars': 'off', |
| 39 | + |
| 40 | + // Code optimization |
| 41 | + 'object-shorthand': ['error', 'always'], |
| 42 | + 'arrow-body-style': ['error', 'as-needed'], |
| 43 | + |
| 44 | + // Import management (unused-imports plugin) |
| 45 | + 'unused-imports/no-unused-imports': 'error', |
| 46 | + 'unused-imports/no-unused-vars': ['warn', { |
| 47 | + vars: 'all', |
| 48 | + args: 'all', |
| 49 | + argsIgnorePattern: 'defaults|request', |
| 50 | + }], |
| 51 | + 'sort-imports': ['error', { |
| 52 | + ignoreDeclarationSort: true, |
| 53 | + }], |
| 54 | + 'import/order': ['error', { |
| 55 | + alphabetize: { order: 'asc' }, |
| 56 | + }], |
| 57 | + |
| 58 | + // Disable strict rules for generated code |
| 59 | + '@typescript-eslint/ban-types': 'off', |
| 60 | + '@typescript-eslint/no-empty-interface': 'off', |
| 61 | + '@typescript-eslint/no-unused-vars': 'off', |
| 62 | + '@typescript-eslint/no-explicit-any': 'off', |
| 63 | + 'no-useless-escape': 'off', |
| 64 | + 'import/no-unresolved': 'off', |
| 65 | + }, |
| 66 | + }, |
| 67 | +] |
| 68 | + |
0 commit comments