|
10 | 10 | "node": true, |
11 | 11 | "es6": true |
12 | 12 | }, |
| 13 | + "extends": [ |
| 14 | + "eslint:recommended", |
| 15 | + "plugin:@typescript-eslint/recommended", |
| 16 | + "plugin:@typescript-eslint/stylistic" |
| 17 | + ], |
13 | 18 | "plugins": [ |
14 | | - "@typescript-eslint", "no-null", "import", "eslint-plugin-local", "simple-import-sort" |
| 19 | + "@typescript-eslint", |
| 20 | + "no-null", |
| 21 | + "eslint-plugin-local", |
| 22 | + "simple-import-sort" |
15 | 23 | ], |
16 | 24 | "ignorePatterns": [ |
17 | 25 | "**/node_modules/**", |
|
25 | 33 | "/coverage/**" |
26 | 34 | ], |
27 | 35 | "rules": { |
28 | | - "simple-import-sort/imports": "error", |
29 | | - "simple-import-sort/exports": "error", |
30 | | - |
31 | | - "@typescript-eslint/adjacent-overload-signatures": "error", |
32 | | - "@typescript-eslint/array-type": "error", |
33 | | - "@typescript-eslint/no-array-constructor": "error", |
| 36 | + // eslint |
| 37 | + "dot-notation": "error", |
| 38 | + "eqeqeq": "error", |
| 39 | + "no-caller": "error", |
| 40 | + "no-constant-condition": ["error", { "checkLoops": false }], |
| 41 | + "no-eval": "error", |
| 42 | + "no-extra-bind": "error", |
| 43 | + "no-new-func": "error", |
| 44 | + "no-new-wrappers": "error", |
| 45 | + "no-return-await": "error", |
| 46 | + "no-restricted-globals": [ |
| 47 | + "error", |
| 48 | + { "name": "setTimeout" }, |
| 49 | + { "name": "clearTimeout" }, |
| 50 | + { "name": "setInterval" }, |
| 51 | + { "name": "clearInterval" }, |
| 52 | + { "name": "setImmediate" }, |
| 53 | + { "name": "clearImmediate" } |
| 54 | + ], |
| 55 | + "no-template-curly-in-string": "error", |
| 56 | + "no-throw-literal": "error", |
| 57 | + "no-undef-init": "error", |
| 58 | + "no-var": "error", |
| 59 | + "object-shorthand": "error", |
| 60 | + "prefer-const": "error", |
| 61 | + "prefer-object-spread": "error", |
| 62 | + "unicode-bom": ["error", "never"], |
34 | 63 |
|
35 | | - "brace-style": "off", |
36 | | - "@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }], |
| 64 | + // Enabled in eslint:recommended, but not applicable here |
| 65 | + "no-extra-boolean-cast": "off", |
| 66 | + "no-case-declarations": "off", |
| 67 | + "no-cond-assign": "off", |
| 68 | + "no-control-regex": "off", |
| 69 | + "no-inner-declarations": "off", |
37 | 70 |
|
| 71 | + // @typescript-eslint/eslint-plugin |
38 | 72 | "@typescript-eslint/naming-convention": [ |
39 | 73 | "error", |
40 | 74 | { "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } }, |
|
48 | 82 | { "selector": "property", "format": null } |
49 | 83 | ], |
50 | 84 |
|
51 | | - "@typescript-eslint/consistent-type-definitions": ["error", "interface"], |
52 | | - "@typescript-eslint/consistent-type-assertions": ["error", { "assertionStyle": "as" }], |
53 | | - |
54 | | - "max-statements-per-line": ["error", { "max": 1 }], |
55 | | - |
56 | | - "no-duplicate-imports": "off", |
57 | | - "@typescript-eslint/no-duplicate-imports": "error", |
58 | | - |
59 | | - "@typescript-eslint/no-inferrable-types": "error", |
60 | | - "@typescript-eslint/no-misused-new": "error", |
61 | | - "@typescript-eslint/no-this-alias": "error", |
62 | | - |
63 | | - "no-unused-expressions": "off", |
64 | | - "@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }], |
65 | | - |
66 | | - "@typescript-eslint/prefer-for-of": "error", |
67 | | - "@typescript-eslint/prefer-function-type": "error", |
68 | | - "@typescript-eslint/prefer-namespace-keyword": "error", |
69 | | - "@typescript-eslint/prefer-as-const": "error", |
70 | | - |
71 | | - "quotes": "off", |
72 | | - "@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }], |
73 | | - |
74 | | - "semi": "off", |
75 | | - "@typescript-eslint/semi": "error", |
76 | | - "@typescript-eslint/no-extra-semi": "error", |
77 | | - |
78 | | - "space-before-function-paren": "off", |
79 | | - "@typescript-eslint/space-before-function-paren": ["error", { |
80 | | - "asyncArrow": "always", |
81 | | - "anonymous": "always", |
82 | | - "named": "never" |
83 | | - }], |
| 85 | + // Rules enabled in typescript-eslint configs that are not applicable here |
| 86 | + "@typescript-eslint/ban-ts-comment": "off", |
| 87 | + "@typescript-eslint/class-literal-property-style": "off", |
| 88 | + "@typescript-eslint/consistent-indexed-object-style": "off", |
| 89 | + "@typescript-eslint/no-duplicate-enum-values": "off", |
| 90 | + "@typescript-eslint/no-empty-function": "off", |
| 91 | + "@typescript-eslint/no-namespace": "off", |
| 92 | + "@typescript-eslint/no-non-null-asserted-optional-chain": "off", |
| 93 | + "@typescript-eslint/no-var-requires": "off", |
| 94 | + "@typescript-eslint/no-empty-interface": "off", |
| 95 | + "@typescript-eslint/no-explicit-any": "off", |
| 96 | + "@typescript-eslint/ban-types": [ |
| 97 | + "error", |
| 98 | + { |
| 99 | + "extendDefaults": true, |
| 100 | + "types": { |
| 101 | + // This is theoretically good, but ts-eslint appears to mistake our declaration of Symbol for the global Symbol type. |
| 102 | + // See: https://github.com/typescript-eslint/typescript-eslint/issues/7306 |
| 103 | + "Symbol": false, |
| 104 | + "{}": false // {} is a totally useful and valid type. |
| 105 | + } |
| 106 | + } |
| 107 | + ], |
84 | 108 |
|
85 | | - "@typescript-eslint/triple-slash-reference": "error", |
86 | | - "@typescript-eslint/type-annotation-spacing": "error", |
87 | | - "@typescript-eslint/unified-signatures": "error", |
| 109 | + // Todo: For each of these, investigate whether we want to enable them ✨ |
| 110 | + "@typescript-eslint/no-unused-vars": "off", |
88 | 111 |
|
89 | | - "@typescript-eslint/no-extra-non-null-assertion": "error", |
| 112 | + // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820 |
| 113 | + "@typescript-eslint/prefer-optional-chain": "off", |
90 | 114 |
|
91 | 115 | // scripts/eslint/rules |
92 | | - "local/object-literal-surrounding-space": "error", |
93 | | - "local/no-type-assertion-whitespace": "error", |
94 | | - "local/type-operator-spacing": "error", |
95 | | - "local/only-arrow-functions": ["error", { |
96 | | - "allowNamedFunctions": true , |
97 | | - "allowDeclarations": true |
98 | | - }], |
99 | | - "local/no-double-space": "error", |
| 116 | + "local/only-arrow-functions": [ |
| 117 | + "error", |
| 118 | + { |
| 119 | + "allowNamedFunctions": true, |
| 120 | + "allowDeclarations": true |
| 121 | + } |
| 122 | + ], |
100 | 123 | "local/argument-trivia": "error", |
101 | 124 | "local/no-in-operator": "error", |
102 | | - "local/simple-indent": "error", |
103 | 125 | "local/debug-assert": "error", |
104 | 126 | "local/no-keywords": "error", |
105 | 127 | "local/jsdoc-format": "error", |
106 | 128 |
|
107 | | - // eslint-plugin-import |
108 | | - "import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }], |
109 | | - |
110 | 129 | // eslint-plugin-no-null |
111 | 130 | "no-null/no-null": "error", |
112 | 131 |
|
113 | | - // eslint |
114 | | - "constructor-super": "error", |
115 | | - "curly": ["error", "multi-line"], |
116 | | - "dot-notation": "error", |
117 | | - "eqeqeq": "error", |
118 | | - "linebreak-style": ["error", "windows"], |
119 | | - "new-parens": "error", |
120 | | - "no-caller": "error", |
121 | | - "no-duplicate-case": "error", |
122 | | - "no-empty": "error", |
123 | | - "no-eval": "error", |
124 | | - "no-extra-bind": "error", |
125 | | - "no-fallthrough": "error", |
126 | | - "no-new-func": "error", |
127 | | - "no-new-wrappers": "error", |
128 | | - "no-return-await": "error", |
129 | | - "no-restricted-globals": ["error", |
130 | | - { "name": "setTimeout" }, |
131 | | - { "name": "clearTimeout" }, |
132 | | - { "name": "setInterval" }, |
133 | | - { "name": "clearInterval" }, |
134 | | - { "name": "setImmediate" }, |
135 | | - { "name": "clearImmediate" } |
136 | | - ], |
137 | | - "no-sparse-arrays": "error", |
138 | | - "no-template-curly-in-string": "error", |
139 | | - "no-throw-literal": "error", |
140 | | - "no-trailing-spaces": "error", |
141 | | - "no-undef-init": "error", |
142 | | - "no-unsafe-finally": "error", |
143 | | - "no-unused-labels": "error", |
144 | | - "no-var": "error", |
145 | | - "object-shorthand": "error", |
146 | | - "prefer-const": "error", |
147 | | - "prefer-object-spread": "error", |
148 | | - "quote-props": ["error", "consistent-as-needed"], |
149 | | - "space-in-parens": "error", |
150 | | - "unicode-bom": ["error", "never"], |
151 | | - "use-isnan": "error", |
152 | | - "no-prototype-builtins": "error", |
153 | | - "no-self-assign": "error", |
154 | | - "no-dupe-else-if": "error" |
| 132 | + // eslint-plugin-simple-import-sort |
| 133 | + "simple-import-sort/imports": "error", |
| 134 | + "simple-import-sort/exports": "error" |
155 | 135 | }, |
156 | 136 | "overrides": [ |
157 | 137 | // By default, the ESLint CLI only looks at .js files. But, it will also look at |
158 | 138 | // any files which are referenced in an override config. Most users of typescript-eslint |
159 | | - // get this behavior by default by extending a recommended typescript-eslint config, which |
| 139 | + // get this behavior by default by extending a recommended typescript-eslint config, which |
160 | 140 | // just so happens to override some core ESLint rules. We don't extend from any config, so |
161 | 141 | // explicitly reference TS files here so the CLI picks them up. |
162 | 142 | // |
|
169 | 149 | "files": ["*.mjs", "*.mts"], |
170 | 150 | "rules": { |
171 | 151 | // These globals don't exist outside of CJS files. |
172 | | - "no-restricted-globals": ["error", |
| 152 | + "no-restricted-globals": [ |
| 153 | + "error", |
173 | 154 | { "name": "__filename" }, |
174 | 155 | { "name": "__dirname" }, |
175 | 156 | { "name": "require" }, |
|
0 commit comments