|
4 | 4 | "parserOptions": {
|
5 | 5 | "project": true
|
6 | 6 | },
|
7 |
| - "plugins": ["@typescript-eslint", "jest", "prettier"], |
| 7 | + "plugins": [ |
| 8 | + "@typescript-eslint", |
| 9 | + "import", |
| 10 | + "jest", |
| 11 | + "prettier"], |
8 | 12 | "extends": [
|
9 | 13 | "eslint:recommended",
|
10 | 14 | "plugin:@typescript-eslint/eslint-recommended",
|
11 | 15 | "plugin:@typescript-eslint/recommended",
|
12 | 16 | // "plugin:@typescript-eslint/recommended-type-checked",
|
| 17 | + // "plugin:@typescript-eslint/stylistic-type-checked" |
| 18 | + "airbnb-base", |
13 | 19 | "prettier",
|
14 |
| - // "plugin:import/errors", |
15 |
| - // "plugin:import/warnings", |
| 20 | + "plugin:import/recommended", |
| 21 | + "plugin:import/errors", |
| 22 | + "plugin:import/warnings", |
16 | 23 | "plugin:jest/all"
|
17 | 24 | ],
|
18 | 25 | "rules": {
|
|
21 | 28 | // CUSTOM OVERRIDES
|
22 | 29 | // TODO: remove no-restricted-syntax override and replace for...Of due
|
23 | 30 | /// "iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations."
|
| 31 | + "import/extensions": [ |
| 32 | + "error", |
| 33 | + "always", |
| 34 | + { |
| 35 | + "pattern": { |
| 36 | + "ts": "never" |
| 37 | + } |
| 38 | + } |
| 39 | + ], |
24 | 40 | "no-restricted-syntax": 0,
|
25 | 41 | "no-console": "off",
|
26 | 42 | "no-underscore-dangle": 0,
|
27 |
| - "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }] |
28 |
| - // , |
29 |
| - // "import/no-unresolved": [2, {"commonjs": true, "amd": true}], |
30 |
| - // "import/extensions": ["error", { "js": "always", "json": "always"}] |
| 43 | + "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }], |
| 44 | + // Note: you must disable the base rule as it can report incorrect errors |
| 45 | + // https://stackoverflow.com/a/63961972/6366150 |
| 46 | + "no-shadow": "off", |
| 47 | + "@typescript-eslint/no-shadow": "error", |
| 48 | + // Note: you must disable the base rule as it can report incorrect errors |
| 49 | + // https://github.com/typescript-eslint/typescript-eslint/issues/2621#issuecomment-701970389 |
| 50 | + "no-unused-vars": "off", |
| 51 | + "@typescript-eslint/no-unused-vars": "error", |
| 52 | + // Note: you must disable the base rule as it can report incorrect errors |
| 53 | + // https://stackoverflow.com/a/77212380/6366150 |
| 54 | + "no-use-before-define": "off", |
| 55 | + "@typescript-eslint/no-use-before-define": "error" |
31 | 56 | },
|
32 | 57 | "overrides": [
|
33 | 58 | {
|
|
37 | 62 | "@typescript-eslint/explicit-function-return-type": "error"
|
38 | 63 | }
|
39 | 64 | }
|
40 |
| - ] |
| 65 | + ], |
| 66 | + "settings": { |
| 67 | + "import/parsers": { |
| 68 | + "@typescript-eslint/parser": [".ts", ".tsx"] |
| 69 | + }, |
| 70 | + "import/resolver": { |
| 71 | + "typescript": { |
| 72 | + "alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn"t contain any source code, like `@types/unist` |
| 73 | + "project": "." |
| 74 | + } |
| 75 | + } |
| 76 | + } |
41 | 77 | }
|
0 commit comments