|
| 1 | +import js from '@eslint/js'; |
| 2 | +import tseslint from '@typescript-eslint/eslint-plugin'; |
| 3 | +import tsparser from '@typescript-eslint/parser'; |
| 4 | +import prettier from 'eslint-plugin-prettier'; |
| 5 | +import prettierConfig from 'eslint-config-prettier'; |
| 6 | + |
| 7 | +export default [ |
| 8 | + // Base JavaScript recommended configuration |
| 9 | + js.configs.recommended, |
| 10 | + |
| 11 | + // Configuration for TypeScript files |
| 12 | + { |
| 13 | + files: ['**/*.ts', '**/*.tsx'], |
| 14 | + languageOptions: { |
| 15 | + parser: tsparser, |
| 16 | + parserOptions: { |
| 17 | + ecmaVersion: 'latest', |
| 18 | + sourceType: 'module', |
| 19 | + project: './tsconfig.json', |
| 20 | + }, |
| 21 | + globals: { |
| 22 | + console: 'readonly', |
| 23 | + process: 'readonly', |
| 24 | + Buffer: 'readonly', |
| 25 | + __dirname: 'readonly', |
| 26 | + __filename: 'readonly', |
| 27 | + global: 'readonly', |
| 28 | + setTimeout: 'readonly', |
| 29 | + clearTimeout: 'readonly', |
| 30 | + setInterval: 'readonly', |
| 31 | + clearInterval: 'readonly', |
| 32 | + }, |
| 33 | + }, |
| 34 | + plugins: { |
| 35 | + '@typescript-eslint': tseslint, |
| 36 | + prettier: prettier, |
| 37 | + }, |
| 38 | + rules: { |
| 39 | + // ESLint recommended |
| 40 | + ...js.configs.recommended.rules, |
| 41 | + |
| 42 | + // TypeScript ESLint recommended |
| 43 | + '@typescript-eslint/no-unused-vars': 'error', |
| 44 | + '@typescript-eslint/no-explicit-any': 'off', |
| 45 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 46 | + '@typescript-eslint/no-unsafe-argument': 'off', |
| 47 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 48 | + '@typescript-eslint/unbound-method': 'off', |
| 49 | + '@typescript-eslint/no-floating-promises': 'error', |
| 50 | + |
| 51 | + // Prettier |
| 52 | + 'prettier/prettier': 'error', |
| 53 | + |
| 54 | + // Custom rules |
| 55 | + 'no-console': 'off', |
| 56 | + 'no-undef': 'off', // TypeScript handles this |
| 57 | + 'require-await': 'error', |
| 58 | + }, |
| 59 | + }, |
| 60 | + |
| 61 | + // Prettier config (must come last to override conflicting rules) |
| 62 | + prettierConfig, |
| 63 | + |
| 64 | + // Global ignores |
| 65 | + { |
| 66 | + ignores: ['dist/**', 'node_modules/**', 'coverage/**', '*.js'], |
| 67 | + }, |
| 68 | +]; |
0 commit comments