UNPKG

35.7 kBJavaScriptView Raw
1/* eslint sort-keys: ["error", "asc"] */
2/* eslint-disable sort-keys */
3
4const options = require("./options.js");
5const globPatterns = require("./glob-patterns.js");
6
7module.exports = {
8 plugins: ["@typescript-eslint"],
9 overrides: [
10 {
11 files: globPatterns.typescript,
12 parser: "@typescript-eslint/parser",
13 parserOptions: {
14 ecmaFeatures: {
15 jsx: true,
16 },
17 extraFileExtensions: [".vue"],
18 },
19 extends: [
20 "plugin:import/typescript",
21 "plugin:@typescript-eslint/recommended",
22 "plugin:@typescript-eslint/eslint-recommended",
23 "plugin:@typescript-eslint/recommended-requiring-type-checking",
24 ],
25 rules: {
26 /* eslint-enable sort-keys */
27 "@babel/new-cap": "off", // There are some false positives with this rule (e.g. when a library is using uppercase letters) and TypeScript catches these errors anyway
28 "@babel/no-invalid-this": "off", // covered by @typescript-eslint/no-invalid-this
29 "@babel/no-unused-expressions": "off", // covered by @typescript-eslint/no-unused-expressions
30 "@babel/semi": "off", // covered by @typescript-eslint/semi
31 // "no-undef": "off", // produces false positive with some TypeScript syntax. This is caught by TypeScript anyway.
32 "@typescript-eslint/adjacent-overload-signatures": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
33 "@typescript-eslint/array-type": [
34 "warn",
35 { default: "generic" },
36 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
37 "@typescript-eslint/await-thenable": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md
38 // Disable the warning for legimitate use cases
39 "@typescript-eslint/ban-ts-comment": [
40 "warn",
41 {
42 "ts-expect-error": "allow-with-description",
43 },
44 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md
45 "@typescript-eslint/ban-tslint-comment": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-tslint-comment.md
46 "@typescript-eslint/ban-types": [
47 "warn",
48 options["@typescript-eslint/ban-types"],
49 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
50 "@typescript-eslint/brace-style": [
51 "warn",
52 "1tbs",
53 {
54 allowSingleLine: false,
55 },
56 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
57 // Handled by @typescript-eslint/naming-convention
58 "@typescript-eslint/camelcase": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/camelcase.md
59 "@typescript-eslint/class-literal-property-style": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/class-literal-property-style.md
60 "@typescript-eslint/comma-spacing": [
61 "warn",
62 options["comma-spacing"],
63 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
64 "@typescript-eslint/consistent-indexed-object-style": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md
65 "@typescript-eslint/consistent-type-assertions": [
66 "warn",
67 {
68 assertionStyle: "as",
69 // Using {} as Something can hide errors (see rule docs).
70 // It's better to declare a typed variable first.
71 objectLiteralTypeAssertions: "allow-as-parameter",
72 },
73 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-assertions.md
74 "@typescript-eslint/consistent-type-definitions": [
75 "warn",
76 "type",
77 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
78 "@typescript-eslint/consistent-type-imports": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md
79 "@typescript-eslint/default-param-last": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/default-param-last.md
80 "@typescript-eslint/dot-notation": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
81 "@typescript-eslint/explicit-function-return-type": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
82 "@typescript-eslint/explicit-member-accessibility": [
83 "warn",
84 {
85 accessibility: "no-public",
86 overrides: {
87 parameterProperties: "explicit",
88 },
89 },
90 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
91 "@typescript-eslint/explicit-module-boundary-types": [
92 "off",
93 {
94 allowDirectConstAssertionInArrowFunctions: true,
95 allowHigherOrderFunctions: true,
96 allowTypedFunctionExpressions: true,
97 allowedNames: [],
98 },
99 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md
100 "@typescript-eslint/func-call-spacing": ["warn"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
101 "@typescript-eslint/generic-type-naming": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/generic-type-naming.md
102 "@typescript-eslint/indent": ["warn", 4, options["indent"]], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
103 "@typescript-eslint/init-declarations": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/init-declarations.md
104 "@typescript-eslint/lines-between-class-members": [
105 "warn",
106 "always",
107 {
108 ...options["lines-between-class-members"],
109 exceptAfterOverload: true,
110 },
111 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
112 "@typescript-eslint/member-delimiter-style": [
113 "warn",
114 {
115 // We're using "semi" because classes do only allow semi
116 // and we want to stay consistent with them.
117 multiline: {
118 delimiter: "semi",
119 requireLast: true,
120 },
121 singleline: {
122 delimiter: "semi",
123 requireLast: false,
124 },
125 },
126 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md
127 "@typescript-eslint/member-naming": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-naming.md
128 "@typescript-eslint/member-ordering": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
129 "@typescript-eslint/method-signature-style": [
130 "warn",
131 "property",
132 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md
133 "@typescript-eslint/naming-convention": [
134 "warn",
135 ...options["@typescript-eslint/naming-convention"]
136 .defaultRules,
137 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
138 "@typescript-eslint/no-array-constructor": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
139 "@typescript-eslint/no-base-to-string": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-base-to-string.md
140 "@typescript-eslint/no-confusing-non-null-assertion": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md
141 // There are too many false positives with this rule
142 // Additionally, there are situations where you just want to pass on the returned value even
143 // when it's currently annotated as 'void'
144 "@typescript-eslint/no-confusing-void-expression": [
145 "off",
146 {
147 ignoreArrowShorthand: true,
148 ignoreVoidOperator: true,
149 },
150 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/no-confusing-void-expression.md
151 "@typescript-eslint/no-dupe-class-members": ["warn"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
152 "@typescript-eslint/no-duplicate-imports": ["warn"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/@typescript-eslint/no-duplicate-imports.md
153 "@typescript-eslint/no-dynamic-delete": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dynamic-delete.md
154 "@typescript-eslint/no-empty-function": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
155 "@typescript-eslint/no-empty-interface": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
156 // There are situations where explicit 'any' is the most pragmatic way.
157 // The appropiate use of 'any' requires human peer reviews :)
158 "@typescript-eslint/no-explicit-any": [
159 "off",
160 {
161 fixToUnknown: false,
162 ignoreRestArgs: true,
163 },
164 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
165 "@typescript-eslint/no-extra-non-null-assertion": ["warn"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md
166 "@typescript-eslint/no-extra-parens": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
167 "@typescript-eslint/no-extraneous-class": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extraneous-class.md
168 // This rule might be a good idea, but often it's ok to let the global error handler handle it
169 "@typescript-eslint/no-floating-promises": [
170 "off",
171 {
172 ignoreVoid: true,
173 },
174 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md
175 "@typescript-eslint/no-for-in-array": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-for-in-array.md
176 "@typescript-eslint/no-implicit-any-catch": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md
177 "@typescript-eslint/no-implied-eval": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
178 "@typescript-eslint/no-inferrable-types": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md
179 "@typescript-eslint/no-invalid-this": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-this.md
180 "@typescript-eslint/no-invalid-void-type": [
181 "warn",
182 {
183 allowAsThisParameter: true,
184 allowInGenericTypeArguments: true,
185 },
186 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-void-type.md
187 "@typescript-eslint/no-loop-func": ["warn"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
188 "@typescript-eslint/no-loss-of-precision": ["warn"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
189 "@typescript-eslint/no-magic-numbers": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
190 "@typescript-eslint/no-misused-new": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md
191 "@typescript-eslint/no-misused-promises": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-promises.md
192 "@typescript-eslint/no-namespace": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
193 "@typescript-eslint/no-non-null-asserted-optional-chain":
194 "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md
195 // Unfortunately non-null assertions are sometimes necessary
196 // e.g. when working with Maps
197 "@typescript-eslint/no-non-null-assertion": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
198 "@typescript-eslint/no-parameter-properties": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md
199 "@typescript-eslint/no-redeclare": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
200 "@typescript-eslint/no-require-imports": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-require-imports.md
201 "@typescript-eslint/no-shadow": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
202 "@typescript-eslint/no-this-alias": [
203 "warn",
204 {
205 allowDestructuring: true,
206 allowedNames: [],
207 },
208 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md
209 // When this rule is enabled, re-throwing an unknown error becomes a problem because
210 // we can't guarantee that it's going to be an error object.
211 // This rule would always report a warning in this case which is annoying.
212 "@typescript-eslint/no-throw-literal": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
213 "@typescript-eslint/no-type-alias": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-type-alias.md
214 "@typescript-eslint/no-unnecessary-boolean-literal-compare":
215 "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md
216 "@typescript-eslint/no-unnecessary-condition": [
217 "warn",
218 {
219 allowConstantLoopConditions: true,
220 },
221 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
222 "@typescript-eslint/no-unnecessary-qualifier": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md
223 "@typescript-eslint/no-unnecessary-type-arguments": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md
224 "@typescript-eslint/no-unnecessary-type-assertion": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
225 "@typescript-eslint/no-unnecessary-type-constraint": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md
226 // In practice, these unsafe rules are too strict. It's ok to use 'any' within a function.
227 // We decided to keep @typescript-eslint/no-unsafe-return in order to avoid that 'any'
228 // leaks into the rest of the application
229 "@typescript-eslint/no-unsafe-assignment": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md
230 "@typescript-eslint/no-unsafe-call": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-call.md
231 "@typescript-eslint/no-unsafe-member-access": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md
232 "@typescript-eslint/no-unsafe-return": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-return.md
233 "@typescript-eslint/no-unused-expressions": [
234 "warn",
235 options["no-unused-expressions"],
236 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
237 "@typescript-eslint/no-unused-vars": [
238 "warn",
239 options["no-unused-vars"],
240 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
241 "@typescript-eslint/no-unused-vars-experimental": "off", // https://github.com/typescript-eslint/typescript-eslint/tree/v2.19.0/packages/eslint-plugin
242 // The following rules would require to sort each function (declaration and expression)
243 // in a module in a specific way which seems to be impractical.
244 "@typescript-eslint/no-use-before-define": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
245 "@typescript-eslint/no-useless-constructor": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
246 "@typescript-eslint/no-var-requires": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md
247 // Using the ! operator to remove the nullable type is often better because it does not
248 // require refactoring if you decide to change the non-nullable type later.
249 // For instance:
250 // declare a: undefined | string;
251 // const b = a as string; // what if we change "string" later to "number"?
252 "@typescript-eslint/non-nullable-type-assertion-style": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md
253 "@typescript-eslint/prefer-as-const": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-as-const.md
254 "@typescript-eslint/prefer-enum-initializers": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md
255 "@typescript-eslint/prefer-for-of": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-for-of.md
256 "@typescript-eslint/prefer-function-type": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-function-type.md
257 "@typescript-eslint/prefer-includes": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-includes.md
258 "@typescript-eslint/prefer-interface": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-interface.md
259 // Dynamic enum members are quite rare and the problem illustrated in the readme sounds like a footgun.
260 // If dynamic enums are necessary in certain cases, this rule can be disabled.
261 "@typescript-eslint/prefer-literal-enum-member": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md
262 "@typescript-eslint/prefer-namespace-keyword": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
263 "@typescript-eslint/prefer-nullish-coalescing": [
264 "warn",
265 {
266 ignoreConditionalTests: true,
267 ignoreMixedLogicalExpressions: true,
268 },
269 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
270 "@typescript-eslint/prefer-optional-chain": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-optional-chain.md
271 // We can't activate prefer-readonly currently as we don't want to flag class properties
272 // that are functions as readonly (although it would be correct).
273 // Enabling prefer-readonly would require developers to write
274 // private readonly someMethod = () => {};
275 // which is verbose and kind of annoying.
276 "@typescript-eslint/prefer-readonly": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly.md
277 "@typescript-eslint/prefer-readonly-parameter-types": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md
278 "@typescript-eslint/prefer-reduce-type-parameter": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md
279 // Sometimes it makes more sense to use .match() or maybe the global flag is added later.
280 // In this case we want to prevent the developer from needing to refactor the code.
281 "@typescript-eslint/prefer-regexp-exec": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md
282 "@typescript-eslint/prefer-string-starts-ends-with": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md
283 "@typescript-eslint/prefer-ts-expect-error": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md
284 "@typescript-eslint/promise-function-async": [
285 "warn",
286 {
287 allowAny: true,
288 allowedPromiseNames: [],
289 checkArrowFunctions: true,
290 checkFunctionDeclarations: true,
291 checkFunctionExpressions: true,
292 checkMethodDeclarations: true,
293 },
294 ], // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
295 "@typescript-eslint/quotes": ["warn", "double", options.quotes], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
296 "@typescript-eslint/require-array-sort-compare": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-array-sort-compare.md
297 "@typescript-eslint/require-await": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
298 "@typescript-eslint/restrict-plus-operands": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-plus-operands.md
299 "@typescript-eslint/restrict-template-expressions": [
300 "off",
301 {
302 allowBoolean: false,
303 allowNullable: false,
304 allowNumber: true,
305 },
306 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
307 "@typescript-eslint/return-await": ["warn", "in-try-catch"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
308 "@typescript-eslint/semi": ["warn"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
309 "@typescript-eslint/sort-type-union-intersection-members":
310 "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md
311 "@typescript-eslint/space-before-function-paren": [
312 "warn",
313 options["space-before-function-paren"],
314 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
315 "@typescript-eslint/strict-boolean-expressions": [
316 "off",
317 {
318 allowNullable: true,
319 allowSafe: true,
320 ignoreRhs: true,
321 },
322 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
323 "@typescript-eslint/switch-exhaustiveness-check": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md
324 "@typescript-eslint/triple-slash-reference": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
325 "@typescript-eslint/type-annotation-spacing": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
326 "@typescript-eslint/typedef": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md
327 "@typescript-eslint/unbound-method": [
328 "warn",
329 {
330 ignoreStatic: true,
331 },
332 ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unbound-method.md
333 "@typescript-eslint/unified-signatures": "warn", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
334 "brace-style": "off", // covered by @typescript-eslint/brace-style
335 camelcase: "off", // covered by @typescript-eslint/naming-convention
336 "comma-spacing": "off", // covered by @typescript-eslint/comma-spacing
337 "func-call-spacing": "off", // covered by @typescript-eslint/func-call-spacing
338 // There's currently a problem with this rule, see https://github.com/benmosher/eslint-plugin-import/issues/1341
339 "import/export": "off", // TypeScript should catch it anyway
340 "import/extensions": [
341 "warn",
342 "ignorePackages",
343 {
344 ts: "never",
345 tsx: "never",
346 },
347 ], // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
348 // TypeScript project have usually more imports due to types
349 "import/max-dependencies": ["warn", { max: 45 }],
350 "import/named": "off", // TypeScript should catch it anyway
351 "import/namespace": "off", // TypeScript should catch it anyway
352 "import/no-duplicates": "off", // covered by @typescript-eslint/no-duplicate-imports
353 "import/no-unresolved": "off", // TypeScript should catch it anyway
354 indent: "off",
355 "lines-between-class-members": "off", // covered by @typescript-eslint/lines-between-class-members
356 // TypeScript files tend to get longer due to types
357 "max-lines": [
358 "warn",
359 {
360 ...options["max-lines"],
361 max: 1400,
362 },
363 ],
364 "no-dupe-class-members": "off", // covered by @typescript-eslint/no-dupe-class-members
365 "no-empty-function": "off", // covered by @typescript-eslint/no-empty-function
366 "no-extra-parens": "off",
367 "no-loop-func": "off", // covered by @typescript-eslint/no-loop-func
368 "no-loss-of-precision": "off", // covered by @typescript-eslint/no-loss-of-precision
369 "no-redeclare": "off", // covered by @typescript-eslint/no-redeclare
370 "no-useless-constructor": "off", // covered by @typescript-eslint/no-useless-constructor
371 quotes: "off", // covered by @typescript-eslint/quotes
372 semi: "off", // covered by @typescript-eslint/semi
373 "space-before-function-paren": "off", // covered by @typescript-eslint/space-before-function-paren
374 },
375 },
376 {
377 files: ["*.d.ts"],
378 rules: {
379 // In d.ts files it might be necessary to merge an existing interface
380 "@typescript-eslint/consistent-type-definitions": "off",
381 // In d.ts files it's sometimes necessary to overload existing methods
382 "@typescript-eslint/method-signature-style": "off",
383 // Unused vars can be common in d.ts files when declaration merging is used
384 "@typescript-eslint/no-unused-vars": "off",
385 // When someone wants to extend the typings of a third-party module, it might
386 // be necessary to import the module so that TypeScript finds the typings that should be extended.
387 // This is a better alternative to the triple-slash directive
388 "import/no-unassigned-import": "off",
389 },
390 },
391 {
392 files: globPatterns.tests,
393 rules: {
394 // Type assertions are quite common in tests
395 "@typescript-eslint/consistent-type-assertions": "off",
396 // We allow any to be used in tests, so returning it is ok
397 "@typescript-eslint/no-unsafe-return": "off",
398 // chai uses these as assertions
399 "@typescript-eslint/no-unused-expressions": "off",
400 // Passing functions around like this can be common with mocking
401 "@typescript-eslint/unbound-method": "off",
402 },
403 },
404 ],
405};