|
| 1 | +import eslint from '@eslint/js' |
| 2 | +import tseslint from '@typescript-eslint/eslint-plugin' |
| 3 | +import tsparser from '@typescript-eslint/parser' |
| 4 | +import jestPlugin from 'eslint-plugin-jest' |
| 5 | +import githubPlugin from 'eslint-plugin-github' |
| 6 | +import prettierPlugin from 'eslint-plugin-prettier' |
| 7 | +import importPlugin from 'eslint-plugin-import' |
| 8 | + |
| 9 | +export default [ |
| 10 | + // Global ignores |
| 11 | + { |
| 12 | + ignores: ['**/node_modules/**', '**/dist/**', '**/coverage/**', '**/*.json'] |
| 13 | + }, |
| 14 | + |
| 15 | + // Base configuration for all files |
| 16 | + eslint.configs.recommended, |
| 17 | + |
| 18 | + // TypeScript files configuration |
| 19 | + { |
| 20 | + files: ['**/*.ts'], |
| 21 | + languageOptions: { |
| 22 | + parser: tsparser, |
| 23 | + parserOptions: { |
| 24 | + ecmaVersion: 2023, |
| 25 | + sourceType: 'module', |
| 26 | + project: ['./.github/linters/tsconfig.json', './tsconfig.json'] |
| 27 | + }, |
| 28 | + globals: { |
| 29 | + Atomics: 'readonly', |
| 30 | + SharedArrayBuffer: 'readonly', |
| 31 | + console: 'readonly', |
| 32 | + process: 'readonly', |
| 33 | + __dirname: 'readonly', |
| 34 | + __filename: 'readonly', |
| 35 | + module: 'readonly', |
| 36 | + require: 'readonly', |
| 37 | + exports: 'readonly', |
| 38 | + Buffer: 'readonly', |
| 39 | + global: 'readonly' |
| 40 | + } |
| 41 | + }, |
| 42 | + plugins: { |
| 43 | + '@typescript-eslint': tseslint, |
| 44 | + jest: jestPlugin, |
| 45 | + github: githubPlugin, |
| 46 | + prettier: prettierPlugin |
| 47 | + }, |
| 48 | + rules: { |
| 49 | + // Spread recommended rules from plugins |
| 50 | + ...tseslint.configs['eslint-recommended'].overrides[0].rules, |
| 51 | + ...tseslint.configs.recommended.rules, |
| 52 | + ...jestPlugin.configs.recommended.rules, |
| 53 | + |
| 54 | + // Custom rules |
| 55 | + camelcase: 'off', |
| 56 | + 'no-console': 'off', |
| 57 | + 'no-unused-vars': 'off', |
| 58 | + 'prettier/prettier': 'error', |
| 59 | + semi: ['error', 'never'], |
| 60 | + '@typescript-eslint/array-type': 'error', |
| 61 | + '@typescript-eslint/await-thenable': 'error', |
| 62 | + '@typescript-eslint/ban-ts-comment': 'error', |
| 63 | + '@typescript-eslint/consistent-type-assertions': 'error', |
| 64 | + '@typescript-eslint/explicit-member-accessibility': [ |
| 65 | + 'error', |
| 66 | + { accessibility: 'no-public' } |
| 67 | + ], |
| 68 | + '@typescript-eslint/explicit-function-return-type': [ |
| 69 | + 'error', |
| 70 | + { allowExpressions: true } |
| 71 | + ], |
| 72 | + 'func-call-spacing': ['error', 'never'], |
| 73 | + '@typescript-eslint/no-array-constructor': 'error', |
| 74 | + '@typescript-eslint/no-empty-interface': 'error', |
| 75 | + '@typescript-eslint/no-explicit-any': 'error', |
| 76 | + '@typescript-eslint/no-extraneous-class': 'error', |
| 77 | + '@typescript-eslint/no-for-in-array': 'error', |
| 78 | + '@typescript-eslint/no-inferrable-types': 'error', |
| 79 | + '@typescript-eslint/no-misused-new': 'error', |
| 80 | + '@typescript-eslint/no-namespace': 'error', |
| 81 | + '@typescript-eslint/no-non-null-assertion': 'warn', |
| 82 | + '@typescript-eslint/no-require-imports': 'error', |
| 83 | + '@typescript-eslint/no-unnecessary-qualifier': 'error', |
| 84 | + '@typescript-eslint/no-unnecessary-type-assertion': 'error', |
| 85 | + '@typescript-eslint/no-unused-vars': 'error', |
| 86 | + '@typescript-eslint/no-useless-constructor': 'error', |
| 87 | + '@typescript-eslint/no-var-requires': 'error', |
| 88 | + '@typescript-eslint/prefer-for-of': 'warn', |
| 89 | + '@typescript-eslint/prefer-function-type': 'warn', |
| 90 | + '@typescript-eslint/prefer-includes': 'error', |
| 91 | + '@typescript-eslint/prefer-string-starts-ends-with': 'error', |
| 92 | + '@typescript-eslint/promise-function-async': 'error', |
| 93 | + '@typescript-eslint/require-array-sort-compare': 'error', |
| 94 | + '@typescript-eslint/restrict-plus-operands': 'error', |
| 95 | + '@typescript-eslint/space-before-function-paren': 'off', |
| 96 | + '@typescript-eslint/unbound-method': 'error' |
| 97 | + } |
| 98 | + }, |
| 99 | + |
| 100 | + // JavaScript files configuration |
| 101 | + { |
| 102 | + files: ['**/*.js'], |
| 103 | + languageOptions: { |
| 104 | + ecmaVersion: 2023, |
| 105 | + sourceType: 'module', |
| 106 | + globals: { |
| 107 | + Atomics: 'readonly', |
| 108 | + SharedArrayBuffer: 'readonly', |
| 109 | + console: 'readonly', |
| 110 | + process: 'readonly', |
| 111 | + __dirname: 'readonly', |
| 112 | + __filename: 'readonly', |
| 113 | + module: 'readonly', |
| 114 | + require: 'readonly', |
| 115 | + exports: 'readonly', |
| 116 | + Buffer: 'readonly', |
| 117 | + global: 'readonly' |
| 118 | + } |
| 119 | + }, |
| 120 | + plugins: { |
| 121 | + prettier: prettierPlugin, |
| 122 | + import: importPlugin |
| 123 | + }, |
| 124 | + rules: { |
| 125 | + 'no-console': 'off', |
| 126 | + 'prettier/prettier': 'error', |
| 127 | + semi: ['error', 'never'], |
| 128 | + 'import/no-commonjs': 'off' |
| 129 | + } |
| 130 | + } |
| 131 | +] |
0 commit comments