|
| 1 | +// @ts-check |
| 2 | +import js from '@eslint/js'; |
| 3 | +import { configs, plugins, rules } from 'eslint-config-airbnb-extended'; |
| 4 | +import { rules as prettierConfigRules } from 'eslint-config-prettier'; |
| 5 | +import prettierPlugin from 'eslint-plugin-prettier'; |
| 6 | + |
| 7 | +const strictness = 'off'; |
| 8 | + |
| 9 | +const jsConfig = [ |
| 10 | + // ESLint Recommended Rules |
| 11 | + { |
| 12 | + name: 'js/config', |
| 13 | + ...js.configs.recommended, |
| 14 | + }, |
| 15 | + // Stylistic Plugin |
| 16 | + plugins.stylistic, |
| 17 | + // Import X Plugin |
| 18 | + plugins.importX, |
| 19 | + // Airbnb Base Recommended Config |
| 20 | + ...configs.base.recommended, |
| 21 | + // Strict Import Config |
| 22 | + rules.base.importsStrict, |
| 23 | +]; |
| 24 | + |
| 25 | +const typescriptConfig = [ |
| 26 | + // TypeScript ESLint Plugin |
| 27 | + plugins.typescriptEslint, |
| 28 | + // Airbnb Base TypeScript Config |
| 29 | + ...configs.base.typescript, |
| 30 | + // Strict TypeScript Config |
| 31 | + rules.typescript.typescriptEslintStrict, |
| 32 | +]; |
| 33 | + |
| 34 | +const prettierConfig = [ |
| 35 | + // Prettier Plugin |
| 36 | + { |
| 37 | + name: 'prettier/plugin/config', |
| 38 | + plugins: { |
| 39 | + prettier: prettierPlugin, |
| 40 | + }, |
| 41 | + }, |
| 42 | + // Prettier Config |
| 43 | + { |
| 44 | + name: 'prettier/config', |
| 45 | + rules: { |
| 46 | + ...prettierConfigRules, |
| 47 | + 'prettier/prettier': 'error', |
| 48 | + }, |
| 49 | + }, |
| 50 | +]; |
| 51 | + |
| 52 | +export default [ |
| 53 | + // Javascript Config |
| 54 | + ...jsConfig, |
| 55 | + // TypeScript Config |
| 56 | + ...typescriptConfig, |
| 57 | + // Prettier Config |
| 58 | + ...prettierConfig, |
| 59 | + { |
| 60 | + languageOptions: { |
| 61 | + parserOptions: { |
| 62 | + projectService: false, |
| 63 | + project: './tsconfig.eslint.json', |
| 64 | + }, |
| 65 | + }, |
| 66 | + rules: { |
| 67 | + 'import/export': 'off', |
| 68 | + 'max-classes-per-file': 'off', |
| 69 | + 'no-param-reassign': 'off', |
| 70 | + 'no-await-in-loop': 'off', |
| 71 | + 'no-restricted-syntax': 'off', |
| 72 | + 'consistent-return': 'off', |
| 73 | + 'class-methods-use-this': 'off', |
| 74 | + 'no-underscore-dangle': 'off', |
| 75 | + |
| 76 | + // compat rules to make lint temporarily pass after upgrading to eslint v9 and airbnb-config-extended |
| 77 | + // these can then get removed one by one to allow for small and focused PRs |
| 78 | + 'import-x/prefer-default-export': strictness, |
| 79 | + 'import-x/order': strictness, |
| 80 | + 'import-x/consistent-type-specifier-style': strictness, |
| 81 | + 'import-x/no-cycle': strictness, |
| 82 | + 'import-x/no-extraneous-dependencies': strictness, |
| 83 | + 'import-x/export': strictness, |
| 84 | + 'import-x/no-namespace': strictness, |
| 85 | + |
| 86 | + '@typescript-eslint/no-use-before-define': strictness, |
| 87 | + '@typescript-eslint/consistent-type-definitions': strictness, |
| 88 | + '@typescript-eslint/explicit-module-boundary-types': strictness, |
| 89 | + '@typescript-eslint/no-explicit-any': strictness, |
| 90 | + '@typescript-eslint/ban-ts-comment': strictness, |
| 91 | + '@typescript-eslint/no-wrapper-object-types': strictness, |
| 92 | + '@typescript-eslint/consistent-type-imports': strictness, |
| 93 | + '@typescript-eslint/method-signature-style': strictness, |
| 94 | + '@typescript-eslint/unified-signatures': strictness, |
| 95 | + '@typescript-eslint/no-unsafe-return': strictness, |
| 96 | + '@typescript-eslint/await-thenable': strictness, |
| 97 | + '@typescript-eslint/prefer-regexp-exec': strictness, |
| 98 | + '@typescript-eslint/no-confusing-void-expression': strictness, |
| 99 | + '@typescript-eslint/no-empty-object-type': strictness, |
| 100 | + '@typescript-eslint/no-import-type-side-effects': strictness, |
| 101 | + '@typescript-eslint/no-invalid-void-type': strictness, |
| 102 | + '@typescript-eslint/no-namespace': strictness, |
| 103 | + '@typescript-eslint/prefer-destructuring': strictness, |
| 104 | + '@typescript-eslint/consistent-type-assertions': strictness, |
| 105 | + '@typescript-eslint/no-unnecessary-type-assertion': strictness, |
| 106 | + '@typescript-eslint/no-non-null-assertion': strictness, |
| 107 | + '@typescript-eslint/prefer-optional-chain': strictness, |
| 108 | + '@typescript-eslint/prefer-for-of': strictness, |
| 109 | + '@typescript-eslint/no-duplicate-type-constituents': strictness, |
| 110 | + '@typescript-eslint/consistent-indexed-object-style': strictness, |
| 111 | + '@typescript-eslint/no-unnecessary-boolean-literal-compare': strictness, |
| 112 | + '@typescript-eslint/class-literal-property-style': strictness, |
| 113 | + '@typescript-eslint/consistent-generic-constructors': strictness, |
| 114 | + '@typescript-eslint/promise-function-async': strictness, |
| 115 | + '@typescript-eslint/no-unsafe-enum-comparison': strictness, |
| 116 | + '@typescript-eslint/no-redundant-type-constituents': strictness, |
| 117 | + '@typescript-eslint/prefer-reduce-type-parameter': strictness, |
| 118 | + '@typescript-eslint/no-unused-vars': strictness, |
| 119 | + '@typescript-eslint/prefer-includes': strictness, |
| 120 | + '@typescript-eslint/no-misused-spread': strictness, |
| 121 | + '@typescript-eslint/consistent-type-exports': strictness, |
| 122 | + '@typescript-eslint/prefer-function-type': strictness, |
| 123 | + '@typescript-eslint/prefer-find': strictness, |
| 124 | + |
| 125 | + '@stylistic/spaced-comment': strictness, |
| 126 | + |
| 127 | + 'no-self-assign': strictness, |
| 128 | + 'no-plusplus': strictness, |
| 129 | + 'no-bitwise': strictness, |
| 130 | + 'no-else-return': strictness, |
| 131 | + 'no-nested-ternary': strictness, |
| 132 | + 'no-promise-executor-return': strictness, |
| 133 | + 'prefer-const': strictness, |
| 134 | + 'prefer-exponentiation-operator': strictness, |
| 135 | + 'no-async-promise-executor': strictness, |
| 136 | + 'no-console': strictness, |
| 137 | + 'no-restricted-properties': strictness, |
| 138 | + 'no-undef-init': strictness, |
| 139 | + 'no-irregular-whitespace': strictness, |
| 140 | + 'object-shorthand': strictness, |
| 141 | + 'no-case-declarations': strictness, |
| 142 | + 'no-useless-escape': strictness, |
| 143 | + 'no-useless-catch': strictness, |
| 144 | + 'no-useless-return': strictness, |
| 145 | + 'no-return-assign': strictness, |
| 146 | + 'no-fallthrough': strictness, |
| 147 | + 'default-case': strictness, |
| 148 | + 'operator-assignment': strictness, |
| 149 | + 'prefer-promise-reject-errors': strictness, |
| 150 | + 'no-continue': strictness, |
| 151 | + 'arrow-body-style': strictness, |
| 152 | + 'no-new': strictness, |
| 153 | + 'vars-on-top': strictness, |
| 154 | + 'no-var': strictness, |
| 155 | + 'no-restricted-globals': strictness, |
| 156 | + 'no-lonely-if': strictness, |
| 157 | + 'no-empty': strictness, |
| 158 | + 'one-var': strictness, |
| 159 | + 'no-multi-assign': strictness, |
| 160 | + 'new-cap': strictness, |
| 161 | + |
| 162 | + radix: strictness, |
| 163 | + eqeqeq: strictness, |
| 164 | + |
| 165 | + // debatable |
| 166 | + '@typescript-eslint/array-type': 'off', |
| 167 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 168 | + '@typescript-eslint/prefer-nullish-coalescing': 'off', |
| 169 | + }, |
| 170 | + }, |
| 171 | +]; |
0 commit comments