|
1 | 1 | { |
2 | 2 | "extends": [ |
| 3 | + // https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js#L13-L71 |
| 4 | + "eslint:recommended", |
| 5 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.ts#L6-L33 |
3 | 6 | "plugin:@typescript-eslint/recommended", |
4 | | - "prettier", |
| 7 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts#L6-L25 |
| 8 | + "plugin:@typescript-eslint/recommended-requiring-type-checking", |
| 9 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/config/recommended.js#L6-L27 |
| 10 | + "plugin:import/recommended", |
| 11 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js#L9-L27 |
| 12 | + "plugin:import/typescript", |
| 13 | + // https://github.com/jest-community/eslint-plugin-jest#rules |
| 14 | + "plugin:jest/recommended", |
| 15 | + // https://github.com/jest-community/eslint-plugin-jest#rules |
| 16 | + "plugin:jest/style", |
| 17 | + // https://github.com/prettier/eslint-plugin-prettier/blob/master/eslint-plugin-prettier.js#L92-L100 |
5 | 18 | "plugin:prettier/recommended" |
6 | 19 | ], |
7 | | - "parser": "@typescript-eslint/parser", |
| 20 | + // Some @typescript-eslint rules need it |
| 21 | + "parserOptions": { |
| 22 | + "project": "tsconfig.json" |
| 23 | + }, |
| 24 | + "root": true, |
8 | 25 | "rules": { |
9 | | - "import/prefer-default-export": "off", |
| 26 | + // https://eslint.org/docs/rules/consistent-return |
| 27 | + "consistent-return": "error", |
| 28 | + // https://eslint.org/docs/rules/default-case-last |
| 29 | + "default-case-last": "error", |
| 30 | + // https://eslint.org/docs/rules/default-case |
| 31 | + "default-case": "error", |
| 32 | + // Handled by @typescript-eslint/default-param-last |
| 33 | + // https://eslint.org/docs/rules/default-param-last |
| 34 | + "default-param-last": "off", |
| 35 | + // Handled by @typescript-eslint/dot-notation |
| 36 | + // https://eslint.org/docs/rules/dot-notation |
| 37 | + "dot-notation": "off", |
| 38 | + // https://eslint.org/docs/rules/eqeqeq |
| 39 | + "eqeqeq": "error", |
| 40 | + // https://eslint.org/docs/rules/id-denylist |
| 41 | + "id-denylist": ["error", "err"], |
| 42 | + // https://eslint.org/docs/rules/line-comment-position |
| 43 | + "line-comment-position": [ |
| 44 | + "error", |
| 45 | + { "position": "above", "ignorePattern": "(Prefix|Suffix) (=|!)==" } |
| 46 | + ], |
| 47 | + // https://eslint.org/docs/rules/no-alert |
| 48 | + "no-alert": "error", |
| 49 | + // https://eslint.org/docs/rules/no-console |
| 50 | + "no-console": ["error", { "allow": ["error"] }], |
| 51 | + // https://eslint.org/docs/rules/no-implicit-coercion |
| 52 | + "no-implicit-coercion": "error", |
| 53 | + // https://eslint.org/docs/rules/no-new-wrappers |
| 54 | + "no-new-wrappers": "error", |
| 55 | + // https://eslint.org/docs/rules/no-param-reassign |
| 56 | + "no-param-reassign": "error", |
| 57 | + // https://eslint.org/docs/rules/no-plusplus |
| 58 | + "no-plusplus": "error", |
| 59 | + // https://eslint.org/docs/rules/no-restricted-imports |
| 60 | + "no-restricted-imports": [ |
| 61 | + "error", |
| 62 | + { |
| 63 | + "name": "lodash", |
| 64 | + "message": "Please use `import <package> from \"lodash/<package>\";` instead." |
| 65 | + } |
| 66 | + ], |
| 67 | + // https://eslint.org/docs/rules/no-return-assign |
| 68 | + "no-return-assign": "error", |
| 69 | + // Handled by @typescript-eslint/return-await |
| 70 | + // https://eslint.org/docs/rules/no-return-await |
| 71 | + "no-return-await": "off", |
| 72 | + // https://eslint.org/docs/rules/no-self-compare |
| 73 | + "no-self-compare": "error", |
| 74 | + // https://eslint.org/docs/rules/no-unneeded-ternary |
| 75 | + "no-unneeded-ternary": "error", |
| 76 | + // Handled by @typescript-eslint/no-unused-expressions |
| 77 | + // https://eslint.org/docs/rules/no-unused-expressions |
| 78 | + "no-unused-expressions": "off", |
| 79 | + // https://eslint.org/docs/rules/no-useless-computed-key |
| 80 | + "no-useless-computed-key": "error", |
| 81 | + // https://eslint.org/docs/rules/no-useless-concat |
| 82 | + "no-useless-concat": "error", |
| 83 | + // https://eslint.org/docs/rules/no-useless-rename |
| 84 | + "no-useless-rename": "error", |
| 85 | + // https://eslint.org/docs/rules/no-useless-return |
| 86 | + "no-useless-return": "error", |
| 87 | + // https://eslint.org/docs/rules/object-shorthand |
| 88 | + "object-shorthand": "error", |
| 89 | + // https://eslint.org/docs/rules/one-var |
| 90 | + "one-var": ["error", "never"], |
| 91 | + // https://eslint.org/docs/rules/operator-assignment |
| 92 | + "operator-assignment": ["error", "always"], |
| 93 | + // https://eslint.org/docs/rules/prefer-arrow-callback |
| 94 | + "prefer-arrow-callback": "error", |
| 95 | + // https://eslint.org/docs/rules/prefer-destructuring |
| 96 | + "prefer-destructuring": "error", |
| 97 | + // https://eslint.org/docs/rules/prefer-named-capture-group |
| 98 | + "prefer-named-capture-group": "error", |
| 99 | + // https://eslint.org/docs/rules/prefer-promise-reject-errors |
| 100 | + "prefer-promise-reject-errors": "error", |
| 101 | + // https://eslint.org/docs/rules/prefer-template |
| 102 | + "prefer-template": "error", |
| 103 | + // https://eslint.org/docs/rules/radix |
| 104 | + "radix": "error", |
| 105 | + // https://eslint.org/docs/rules/sort-imports |
10 | 106 | "sort-imports": [ |
11 | 107 | "error", |
12 | 108 | { |
13 | 109 | "ignoreCase": false, |
14 | 110 | "ignoreDeclarationSort": true, |
15 | 111 | "ignoreMemberSort": false |
16 | 112 | } |
17 | | - ] |
| 113 | + ], |
| 114 | + // https://eslint.org/docs/rules/yoda |
| 115 | + "yoda": ["error", "never"], |
| 116 | + |
| 117 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md |
| 118 | + "@typescript-eslint/array-type": ["error", { "default": "array-simple" }], |
| 119 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md |
| 120 | + "@typescript-eslint/consistent-indexed-object-style": "error", |
| 121 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-assertions.md |
| 122 | + "@typescript-eslint/consistent-type-assertions": "error", |
| 123 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md |
| 124 | + "@typescript-eslint/consistent-type-definitions": "error", |
| 125 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md |
| 126 | + "@typescript-eslint/consistent-type-imports": [ |
| 127 | + "error", |
| 128 | + { "prefer": "no-type-imports" } |
| 129 | + ], |
| 130 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/default-param-last.md |
| 131 | + "@typescript-eslint/default-param-last": "error", |
| 132 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md |
| 133 | + "@typescript-eslint/dot-notation": "error", |
| 134 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md |
| 135 | + "@typescript-eslint/explicit-function-return-type": [ |
| 136 | + "error", |
| 137 | + { "allowExpressions": true } |
| 138 | + ], |
| 139 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md |
| 140 | + "@typescript-eslint/method-signature-style": "error", |
| 141 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md |
| 142 | + "@typescript-eslint/no-confusing-non-null-assertion": "error", |
| 143 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md |
| 144 | + "@typescript-eslint/no-implicit-any-catch": "error", |
| 145 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-void-type.md |
| 146 | + "@typescript-eslint/no-invalid-void-type": "error", |
| 147 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md |
| 148 | + "@typescript-eslint/no-unnecessary-condition": "error", |
| 149 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md |
| 150 | + "@typescript-eslint/no-unnecessary-type-arguments": "error", |
| 151 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md |
| 152 | + "@typescript-eslint/no-unnecessary-type-constraint": "error", |
| 153 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md |
| 154 | + "@typescript-eslint/no-unused-expressions": "error", |
| 155 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md |
| 156 | + "@typescript-eslint/prefer-reduce-type-parameter": "error", |
| 157 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md |
| 158 | + "@typescript-eslint/prefer-string-starts-ends-with": "error", |
| 159 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md |
| 160 | + "@typescript-eslint/return-await": "error", |
| 161 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md |
| 162 | + "@typescript-eslint/strict-boolean-expressions": "error", |
| 163 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md |
| 164 | + "@typescript-eslint/unified-signatures": "error", |
| 165 | + |
| 166 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/exports-last.md |
| 167 | + "import/exports-last": "error", |
| 168 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md |
| 169 | + "import/first": "error", |
| 170 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/group-exports.md |
| 171 | + "import/group-exports": "error", |
| 172 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md |
| 173 | + "import/newline-after-import": "error", |
| 174 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md |
| 175 | + "import/no-absolute-path": "error", |
| 176 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-anonymous-default-export.md |
| 177 | + "import/no-anonymous-default-export": "error", |
| 178 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md |
| 179 | + "import/no-mutable-exports": "error", |
| 180 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-self-import.md |
| 181 | + "import/no-self-import": "error", |
| 182 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-useless-path-segments.md |
| 183 | + "import/no-useless-path-segments": ["error", { "noUselessIndex": true }], |
| 184 | + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md |
| 185 | + "import/order": [ |
| 186 | + "error", |
| 187 | + { |
| 188 | + "alphabetize": { "order": "asc", "caseInsensitive": false }, |
| 189 | + "groups": [ |
| 190 | + "builtin", |
| 191 | + "external", |
| 192 | + "internal", |
| 193 | + ["parent", "sibling", "index"], |
| 194 | + "object", |
| 195 | + "type", |
| 196 | + "unknown" |
| 197 | + ], |
| 198 | + "newlines-between": "always", |
| 199 | + "warnOnUnassignedImports": true |
| 200 | + } |
| 201 | + ], |
| 202 | + |
| 203 | + // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/consistent-test-it.md |
| 204 | + "jest/consistent-test-it": ["error", { "withinDescribe": "test" }], |
| 205 | + // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-duplicate-hooks.md |
| 206 | + "jest/no-duplicate-hooks": "error", |
| 207 | + // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-on-top.md |
| 208 | + "jest/prefer-hooks-on-top": "error", |
| 209 | + // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-spy-on.md |
| 210 | + "jest/prefer-spy-on": "error", |
| 211 | + // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-strict-equal.md |
| 212 | + "jest/prefer-strict-equal": "error", |
| 213 | + // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-to-throw-message.md |
| 214 | + "jest/require-to-throw-message": "error" |
| 215 | + }, |
| 216 | + "settings": { |
| 217 | + // https://github.com/benmosher/eslint-plugin-import/issues/1582#issuecomment-568951354 |
| 218 | + "import/resolver": { |
| 219 | + "node": { |
| 220 | + "moduleDirectory": ["node_modules", "src"] |
| 221 | + } |
| 222 | + } |
18 | 223 | } |
19 | 224 | } |
0 commit comments