|
| 1 | +import { createESLintConfig } from '@reduxjs/eslint-config' |
| 2 | +import eslintConfigPackageJson from '@reduxjs/eslint-config/package.json' with { type: 'json' } |
| 3 | + |
| 4 | +const basename = `${eslintConfigPackageJson.name}/overrides` |
| 5 | + |
| 6 | +const eslintConfig = createESLintConfig([ |
| 7 | + { |
| 8 | + name: `${basename}/global-ignores`, |
| 9 | + ignores: [ |
| 10 | + 'packages/rtk-codemods/transforms/*/__testfixtures__/', |
| 11 | + 'packages/toolkit/.size-limit.cjs', |
| 12 | + 'packages/rtk-query-codegen-openapi/lib/', |
| 13 | + 'packages/rtk-query-codegen-openapi/test/config.example.js', |
| 14 | + 'examples/publish-ci/', |
| 15 | + |
| 16 | + // TODO: Remove this later. |
| 17 | + 'examples/', |
| 18 | + ], |
| 19 | + }, |
| 20 | + |
| 21 | + { |
| 22 | + name: `${basename}/main`, |
| 23 | + files: ['**/*.?(c|m)[jt]s?(x)'], |
| 24 | + languageOptions: { |
| 25 | + parserOptions: { |
| 26 | + projectService: true, |
| 27 | + tsconfigRootDir: import.meta.dirname, |
| 28 | + }, |
| 29 | + }, |
| 30 | + rules: { |
| 31 | + // TODO: Enable this later. |
| 32 | + '@typescript-eslint/consistent-type-definitions': [0, 'type'], |
| 33 | + '@typescript-eslint/prefer-nullish-coalescing': [0], |
| 34 | + '@typescript-eslint/no-namespace': [0], |
| 35 | + '@typescript-eslint/require-await': [0], |
| 36 | + '@typescript-eslint/unified-signatures': [0], |
| 37 | + '@typescript-eslint/no-unnecessary-type-parameters': [0], |
| 38 | + '@typescript-eslint/no-invalid-void-type': [0], |
| 39 | + '@typescript-eslint/no-unnecessary-type-arguments': [0], |
| 40 | + '@typescript-eslint/no-confusing-void-expression': [0], |
| 41 | + '@typescript-eslint/no-duplicate-type-constituents': [0], |
| 42 | + '@typescript-eslint/no-redundant-type-constituents': [0], |
| 43 | + '@typescript-eslint/no-unnecessary-type-assertion': [0], |
| 44 | + 'object-shorthand': [0], |
| 45 | + '@typescript-eslint/no-explicit-any': [ |
| 46 | + 0, |
| 47 | + { |
| 48 | + fixToUnknown: false, |
| 49 | + ignoreRestArgs: false, |
| 50 | + }, |
| 51 | + ], |
| 52 | + }, |
| 53 | + }, |
| 54 | + |
| 55 | + { |
| 56 | + name: `${basename}/vitest-custom-matchers-declaration-file`, |
| 57 | + files: ['packages/toolkit/src/tests/utils/CustomMatchers.d.ts'], |
| 58 | + rules: { |
| 59 | + '@typescript-eslint/no-empty-object-type': [ |
| 60 | + 2, |
| 61 | + { |
| 62 | + allowInterfaces: 'with-single-extends', |
| 63 | + allowObjectTypes: 'never', |
| 64 | + }, |
| 65 | + ], |
| 66 | + }, |
| 67 | + }, |
| 68 | + |
| 69 | + { |
| 70 | + name: `${basename}/no-require-imports`, |
| 71 | + files: ['examples/query/react/graphql-codegen/src/mocks/schema.js'], |
| 72 | + languageOptions: { |
| 73 | + sourceType: 'commonjs', |
| 74 | + }, |
| 75 | + rules: { |
| 76 | + '@typescript-eslint/no-require-imports': [ |
| 77 | + 2, |
| 78 | + { |
| 79 | + allow: ['ts-node', '\\./db(.c?[tj]s)?$'], |
| 80 | + allowAsImport: false, |
| 81 | + }, |
| 82 | + ], |
| 83 | + }, |
| 84 | + }, |
| 85 | + |
| 86 | + { |
| 87 | + name: `${basename}/examples/type-portability/nodenext-cjs`, |
| 88 | + files: ['examples/type-portability/nodenext-cjs/**/*.?(c)ts?(x)'], |
| 89 | + languageOptions: { |
| 90 | + sourceType: 'commonjs', |
| 91 | + }, |
| 92 | + rules: { |
| 93 | + '@typescript-eslint/no-namespace': [ |
| 94 | + 0, |
| 95 | + { |
| 96 | + allowDeclarations: false, |
| 97 | + allowDefinitionFiles: true, |
| 98 | + }, |
| 99 | + ], |
| 100 | + }, |
| 101 | + }, |
| 102 | +]) |
| 103 | + |
| 104 | +export default eslintConfig |
0 commit comments