eslint-config-complete 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/base-eslint.d.ts +12 -0
- package/dist/base/base-eslint.d.ts.map +1 -0
- package/dist/base/base-eslint.js +670 -0
- package/dist/base/base-import-x.d.ts +12 -0
- package/dist/base/base-import-x.d.ts.map +1 -0
- package/dist/base/base-import-x.js +262 -0
- package/dist/base/base-jsdoc.d.ts +6 -0
- package/dist/base/base-jsdoc.d.ts.map +1 -0
- package/dist/base/base-jsdoc.js +212 -0
- package/dist/base/base-n.d.ts +7 -0
- package/dist/base/base-n.d.ts.map +1 -0
- package/dist/base/base-n.js +108 -0
- package/dist/base/base-stylistic.d.ts +6 -0
- package/dist/base/base-stylistic.d.ts.map +1 -0
- package/dist/base/base-stylistic.js +35 -0
- package/dist/base/base-typescript-eslint.d.ts +6 -0
- package/dist/base/base-typescript-eslint.d.ts.map +1 -0
- package/dist/base/base-typescript-eslint.js +476 -0
- package/dist/base/base-unicorn.d.ts +10 -0
- package/dist/base/base-unicorn.d.ts.map +1 -0
- package/dist/base/base-unicorn.js +203 -0
- package/dist/base.d.ts +8 -0
- package/dist/base.d.ts.map +1 -0
- package/{src → dist}/base.js +17 -30
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/monorepo.d.ts +6 -0
- package/dist/monorepo.d.ts.map +1 -0
- package/dist/monorepo.js +16 -0
- package/package.json +5 -3
- package/src/base/base-eslint.js +0 -850
- package/src/base/base-import-x.js +0 -310
- package/src/base/base-jsdoc.js +0 -276
- package/src/base/base-n.js +0 -150
- package/src/base/base-stylistic.js +0 -38
- package/src/base/base-typescript-eslint.js +0 -554
- package/src/base/base-unicorn.js +0 -246
- package/src/monorepo.js +0 -18
- /package/{src → dist}/index.js +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This ESLint config only contains built-in rules from ESLint itself:
|
|
3
|
+
* https://eslint.org/docs/latest/rules/
|
|
4
|
+
*
|
|
5
|
+
* Rules are separated into categories:
|
|
6
|
+
* 1) Possible Problems
|
|
7
|
+
* 2) Suggestions
|
|
8
|
+
* 3) Layout & Formatting
|
|
9
|
+
* 4) Deprecated
|
|
10
|
+
*/
|
|
11
|
+
export const baseESLint: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
12
|
+
//# sourceMappingURL=base-eslint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-eslint.d.ts","sourceRoot":"","sources":["../../src/base/base-eslint.js"],"names":[],"mappings":"AAg0BA;;;;;;;;;GASG;AACH,6FAOG"}
|
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
2
|
+
import tseslint from "typescript-eslint";
|
|
3
|
+
/**
|
|
4
|
+
* @see https://eslint.org/docs/latest/rules/#possible-problems
|
|
5
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
6
|
+
*/
|
|
7
|
+
const POSSIBLE_PROBLEMS = {
|
|
8
|
+
/** The `checkForEach` option is enabled to make the rule stricter. */
|
|
9
|
+
"array-callback-return": [
|
|
10
|
+
"warn",
|
|
11
|
+
{
|
|
12
|
+
checkForEach: true,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
"constructor-super": "off", // @typescript-eslint/eslint-recommended
|
|
16
|
+
"for-direction": "warn",
|
|
17
|
+
"getter-return": "off", // @typescript-eslint/eslint-recommended
|
|
18
|
+
"no-async-promise-executor": "warn",
|
|
19
|
+
"no-await-in-loop": "warn",
|
|
20
|
+
"no-class-assign": "warn",
|
|
21
|
+
"no-compare-neg-zero": "warn",
|
|
22
|
+
"no-cond-assign": "warn",
|
|
23
|
+
"no-const-assign": "off", // @typescript-eslint/eslint-recommended
|
|
24
|
+
"no-constant-binary-expression": "warn",
|
|
25
|
+
"no-constant-condition": "warn",
|
|
26
|
+
"no-constructor-return": "warn",
|
|
27
|
+
"no-control-regex": "warn",
|
|
28
|
+
"no-debugger": "warn",
|
|
29
|
+
"no-dupe-args": "off", // @typescript-eslint/eslint-recommended
|
|
30
|
+
"no-dupe-class-members": "off", // @typescript-eslint/eslint-recommended
|
|
31
|
+
"no-dupe-else-if": "warn",
|
|
32
|
+
"no-dupe-keys": "off", // @typescript-eslint/eslint-recommended
|
|
33
|
+
"no-duplicate-case": "warn",
|
|
34
|
+
/** Superseded by the `import-x/no-duplicates` rule. */
|
|
35
|
+
"no-duplicate-imports": "off",
|
|
36
|
+
"no-empty-character-class": "warn",
|
|
37
|
+
"no-empty-pattern": "warn",
|
|
38
|
+
"no-ex-assign": "warn",
|
|
39
|
+
"no-fallthrough": "warn",
|
|
40
|
+
"no-func-assign": "off", // @typescript-eslint/eslint-recommended
|
|
41
|
+
"no-import-assign": "off", // @typescript-eslint/eslint-recommended
|
|
42
|
+
"no-inner-declarations": "warn",
|
|
43
|
+
"no-invalid-regexp": "warn",
|
|
44
|
+
"no-irregular-whitespace": "warn",
|
|
45
|
+
/** Superseded by the `@typescript-eslint/no-loss-of-precision` rule. */
|
|
46
|
+
"no-loss-of-precision": "off",
|
|
47
|
+
"no-misleading-character-class": "warn",
|
|
48
|
+
"no-new-native-nonconstructor": "warn",
|
|
49
|
+
"no-new-symbol": "off", // @typescript-eslint/eslint-recommended
|
|
50
|
+
"no-obj-calls": "off", // @typescript-eslint/eslint-recommended`
|
|
51
|
+
"no-promise-executor-return": "warn",
|
|
52
|
+
"no-prototype-builtins": "warn",
|
|
53
|
+
"no-self-assign": "warn",
|
|
54
|
+
"no-self-compare": "warn",
|
|
55
|
+
"no-setter-return": "off", // @typescript-eslint/eslint-recommended
|
|
56
|
+
"no-sparse-arrays": "warn",
|
|
57
|
+
"no-template-curly-in-string": "warn",
|
|
58
|
+
"no-this-before-super": "off", // @typescript-eslint/eslint-recommended`
|
|
59
|
+
"no-undef": "off", // @typescript-eslint/eslint-recommended
|
|
60
|
+
"no-unexpected-multiline": "off", // eslint-config-prettier
|
|
61
|
+
"no-unmodified-loop-condition": "warn",
|
|
62
|
+
"no-unreachable": "off", // @typescript-eslint/eslint-recommended
|
|
63
|
+
"no-unreachable-loop": "warn",
|
|
64
|
+
"no-unsafe-finally": "warn",
|
|
65
|
+
"no-unsafe-negation": "off", // @typescript-eslint/eslint-recommended
|
|
66
|
+
"no-unsafe-optional-chaining": "warn",
|
|
67
|
+
"no-unused-private-class-members": "warn",
|
|
68
|
+
/** Superseded by the `@typescript-eslint/no-unused-vars` rule. */
|
|
69
|
+
"no-unused-vars": "off",
|
|
70
|
+
/** Superseded by the `@typescript-eslint/no-use-before-define` rule. */
|
|
71
|
+
"no-use-before-define": "off",
|
|
72
|
+
"no-useless-backreference": "warn",
|
|
73
|
+
/**
|
|
74
|
+
* Disabled since [Airbnb reports that the rule is "very
|
|
75
|
+
* buggy"](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js).
|
|
76
|
+
*/
|
|
77
|
+
"require-atomic-updates": "off",
|
|
78
|
+
"use-isnan": "warn",
|
|
79
|
+
"valid-typeof": "warn",
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @see https://eslint.org/docs/latest/rules/#suggestions
|
|
83
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
84
|
+
*/
|
|
85
|
+
const SUGGESTIONS = {
|
|
86
|
+
"accessor-pairs": "warn",
|
|
87
|
+
"arrow-body-style": "warn",
|
|
88
|
+
"block-scoped-var": "warn",
|
|
89
|
+
/**
|
|
90
|
+
* Superseded by the `@typescript-eslint/naming-convention` rule. (`camelcase` is used to enforce
|
|
91
|
+
* naming conventions.)
|
|
92
|
+
*/
|
|
93
|
+
camelcase: "off",
|
|
94
|
+
/**
|
|
95
|
+
* Superseded by the `complete/complete-sentences-jsdoc` and
|
|
96
|
+
* `complete/complete-sentences-line-comments` rules.
|
|
97
|
+
*/
|
|
98
|
+
"capitalized-comments": "off",
|
|
99
|
+
/** Superseded by the `@typescript-eslint/class-methods-use-this` rule. */
|
|
100
|
+
"class-methods-use-this": "off",
|
|
101
|
+
/**
|
|
102
|
+
* Disabled since cyclomatic complexity is not a good enough general indicator of code complexity
|
|
103
|
+
* and leads to too many false positives.
|
|
104
|
+
*/
|
|
105
|
+
complexity: "off",
|
|
106
|
+
/** Superseded by the `@typescript-eslint/consistent-return` rule. */
|
|
107
|
+
"consistent-return": "off",
|
|
108
|
+
"consistent-this": "warn",
|
|
109
|
+
/**
|
|
110
|
+
* Always requiring curly braces can partially ward against [Apple-style if statement
|
|
111
|
+
* bugs](https://www.imperialviolet.org/2014/02/22/applebug.html). Additionally, this rule needs
|
|
112
|
+
* to be set to "all" to [work properly with
|
|
113
|
+
* `eslint-prettier-config`](https://github.com/prettier/eslint-config-prettier#curly).
|
|
114
|
+
*/
|
|
115
|
+
curly: ["warn", "all"],
|
|
116
|
+
/**
|
|
117
|
+
* Disabled since it would cause the `@typescript-eslint/switch-exhaustiveness-check` rule to not
|
|
118
|
+
* work properly.
|
|
119
|
+
*/
|
|
120
|
+
"default-case": "off",
|
|
121
|
+
"default-case-last": "warn",
|
|
122
|
+
/** Superseded by the `@typescript-eslint/default-param-last` rule. */
|
|
123
|
+
"default-param-last": "off",
|
|
124
|
+
/** Superseded by the `@typescript-eslint/dot-notation` rule. */
|
|
125
|
+
"dot-notation": "off",
|
|
126
|
+
/** Superseded by the `complete/eqeqeq-fix` rule. */
|
|
127
|
+
eqeqeq: "off",
|
|
128
|
+
"func-name-matching": "warn",
|
|
129
|
+
"func-names": "warn",
|
|
130
|
+
/**
|
|
131
|
+
* Disabled since it is common in the TypeScript ecosystem to use both function forms, depending
|
|
132
|
+
* on the situation.
|
|
133
|
+
*/
|
|
134
|
+
"func-style": "off",
|
|
135
|
+
"grouped-accessor-pairs": "warn",
|
|
136
|
+
/** Superseded by the `complete/no-for-in` rule. */
|
|
137
|
+
"guard-for-in": "off",
|
|
138
|
+
/** Disabled since it is expected to be configured with project-specific keywords. */
|
|
139
|
+
"id-denylist": "off",
|
|
140
|
+
/** Disabled because short variable names are understandable in many contexts. */
|
|
141
|
+
"id-length": "off",
|
|
142
|
+
/**
|
|
143
|
+
* Superseded by the `@typescript-eslint/naming-convention` rule. (`id-match` is used to enforce
|
|
144
|
+
* naming conventions.)
|
|
145
|
+
*/
|
|
146
|
+
"id-match": "off",
|
|
147
|
+
/** Superseded by the `@typescript-eslint/init-declarations` rule. */
|
|
148
|
+
"init-declarations": "off",
|
|
149
|
+
/** The `enforceForIfStatements` option is enabled to make the rule stricter. */
|
|
150
|
+
"logical-assignment-operators": [
|
|
151
|
+
"warn",
|
|
152
|
+
"always",
|
|
153
|
+
{
|
|
154
|
+
enforceForIfStatements: true,
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
"max-classes-per-file": "warn",
|
|
158
|
+
/** Disabled since this rule is too prescriptive for general-purpose use. */
|
|
159
|
+
"max-depth": "off",
|
|
160
|
+
/**
|
|
161
|
+
* Disabled because enforcing an arbitrary line threshold for every file in a project does not
|
|
162
|
+
* provide much value.
|
|
163
|
+
*/
|
|
164
|
+
"max-lines": "off",
|
|
165
|
+
/**
|
|
166
|
+
* Disabled because enforcing an arbitrary line threshold for every function in a project does not
|
|
167
|
+
* provide much value.
|
|
168
|
+
*/
|
|
169
|
+
"max-lines-per-function": "off",
|
|
170
|
+
"max-nested-callbacks": "warn",
|
|
171
|
+
/** Superseded by the `@typescript-eslint/max-params` rule. */
|
|
172
|
+
"max-params": "off",
|
|
173
|
+
/**
|
|
174
|
+
* Disabled because enforcing an arbitrary statement threshold for every function in a project
|
|
175
|
+
* does not provide much value.
|
|
176
|
+
*/
|
|
177
|
+
"max-statements": "off",
|
|
178
|
+
/** Disabled because it is conventional to use both kinds of comments in TypeScript projects. */
|
|
179
|
+
"multiline-comment-style": "off",
|
|
180
|
+
"new-cap": "warn",
|
|
181
|
+
"no-alert": "warn",
|
|
182
|
+
/** Superseded by the `@typescript-eslint/no-array-constructor` rule. */
|
|
183
|
+
"no-array-constructor": "off",
|
|
184
|
+
"no-bitwise": "warn",
|
|
185
|
+
"no-caller": "warn",
|
|
186
|
+
"no-case-declarations": "warn",
|
|
187
|
+
"no-confusing-arrow": "off", // eslint-config-prettier
|
|
188
|
+
/**
|
|
189
|
+
* Disabled because command-line programs written in TypeScript commonly write to standard out and
|
|
190
|
+
* standard error.
|
|
191
|
+
*/
|
|
192
|
+
"no-console": "off",
|
|
193
|
+
/**
|
|
194
|
+
* Disabled because proper use of continues can reduce indentation for long blocks of code in the
|
|
195
|
+
* same way as the [early return
|
|
196
|
+
* pattern](https://medium.com/swlh/return-early-pattern-3d18a41bba8).
|
|
197
|
+
*/
|
|
198
|
+
"no-continue": "off",
|
|
199
|
+
"no-delete-var": "warn",
|
|
200
|
+
/** Disabled since it is incompatible with the `unicorn/better-regex` rule. */
|
|
201
|
+
"no-div-regex": "off",
|
|
202
|
+
/** The `allowElseIf` option is disabled to make the rule stricter. */
|
|
203
|
+
"no-else-return": [
|
|
204
|
+
"warn",
|
|
205
|
+
{
|
|
206
|
+
allowElseIf: false,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
"no-empty": "warn",
|
|
210
|
+
/** Superseded by the `@typescript-eslint/no-empty-function` rule. */
|
|
211
|
+
"no-empty-function": "off",
|
|
212
|
+
"no-empty-static-block": "warn",
|
|
213
|
+
"no-eq-null": "warn",
|
|
214
|
+
"no-eval": "warn",
|
|
215
|
+
"no-extend-native": "warn",
|
|
216
|
+
"no-extra-bind": "warn",
|
|
217
|
+
"no-extra-boolean-cast": "warn",
|
|
218
|
+
"no-extra-label": "warn",
|
|
219
|
+
/** Superseded by the `@typescript-eslint/no-extra-semi` rule. */
|
|
220
|
+
"no-extra-semi": "off",
|
|
221
|
+
"no-floating-decimal": "off", // eslint-config-prettier
|
|
222
|
+
"no-global-assign": "warn",
|
|
223
|
+
"no-implicit-coercion": "warn",
|
|
224
|
+
"no-implicit-globals": "warn",
|
|
225
|
+
/** Superseded by the `@typescript-eslint/no-implied-eval` rule. */
|
|
226
|
+
"no-implied-eval": "off",
|
|
227
|
+
/** Disabled because inline comments are common in the TypeScript ecosystem. */
|
|
228
|
+
"no-inline-comments": "off",
|
|
229
|
+
/** Superseded by the `@typescript-eslint/no-invalid-this` rule. */
|
|
230
|
+
"no-invalid-this": "off",
|
|
231
|
+
"no-iterator": "warn",
|
|
232
|
+
"no-label-var": "warn",
|
|
233
|
+
"no-labels": "warn",
|
|
234
|
+
"no-lone-blocks": "warn",
|
|
235
|
+
"no-lonely-if": "warn",
|
|
236
|
+
/** Superseded by the `@typescript-eslint/no-loop-func` rule. */
|
|
237
|
+
"no-loop-func": "off",
|
|
238
|
+
/** Superseded by the `@typescript-eslint/no-magic-numbers` rule. */
|
|
239
|
+
"no-magic-numbers": "off",
|
|
240
|
+
"no-mixed-operators": "off", // eslint-config-prettier
|
|
241
|
+
"no-multi-assign": "warn",
|
|
242
|
+
"no-multi-str": "warn",
|
|
243
|
+
/** Superseded by the `unicorn/no-negated-condition` rule. */
|
|
244
|
+
"no-negated-condition": "off",
|
|
245
|
+
/**
|
|
246
|
+
* `unicorn/no-nested-ternary` is a modified version of this rule but that version is less strict.
|
|
247
|
+
*/
|
|
248
|
+
"no-nested-ternary": "warn",
|
|
249
|
+
"no-new": "warn",
|
|
250
|
+
"no-new-func": "warn",
|
|
251
|
+
"no-new-wrappers": "warn",
|
|
252
|
+
"no-nonoctal-decimal-escape": "warn",
|
|
253
|
+
"no-object-constructor": "warn",
|
|
254
|
+
"no-octal": "warn",
|
|
255
|
+
"no-octal-escape": "warn",
|
|
256
|
+
/**
|
|
257
|
+
* The options are [copied from
|
|
258
|
+
* Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js).
|
|
259
|
+
*/
|
|
260
|
+
"no-param-reassign": [
|
|
261
|
+
"warn",
|
|
262
|
+
{
|
|
263
|
+
props: true,
|
|
264
|
+
ignorePropertyModificationsFor: [
|
|
265
|
+
"acc", // for reduce accumulators
|
|
266
|
+
"accumulator", // for reduce accumulators
|
|
267
|
+
"e", // for e.returnvalue
|
|
268
|
+
"ctx", // for Koa routing
|
|
269
|
+
"context", // for Koa routing
|
|
270
|
+
"req", // for Express requests
|
|
271
|
+
"request", // for Express requests
|
|
272
|
+
"res", // for Express responses
|
|
273
|
+
"response", // for Express responses
|
|
274
|
+
"$scope", // for Angular 1 scopes
|
|
275
|
+
"staticContext", // for ReactRouter context
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
/**
|
|
280
|
+
* Disabled because the rule is unnecessary when using Prettier. (Unary operators can lead to
|
|
281
|
+
* errors with minified code, but Prettier adds semicolons automatically.)
|
|
282
|
+
*/
|
|
283
|
+
"no-plusplus": "off",
|
|
284
|
+
"no-proto": "warn",
|
|
285
|
+
/** Superseded by the `@typescript-eslint/block-spacing` rule. */
|
|
286
|
+
"no-redeclare": "off",
|
|
287
|
+
"no-regex-spaces": "warn",
|
|
288
|
+
/**
|
|
289
|
+
* The options are [copied from
|
|
290
|
+
* Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js).
|
|
291
|
+
*/
|
|
292
|
+
"no-restricted-exports": [
|
|
293
|
+
"warn",
|
|
294
|
+
{
|
|
295
|
+
restrictedNamedExports: [
|
|
296
|
+
"default", // use `export default` to provide a default export
|
|
297
|
+
"then", // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
/**
|
|
302
|
+
* The options are [copied from
|
|
303
|
+
* Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/variables.js).
|
|
304
|
+
*/
|
|
305
|
+
"no-restricted-globals": [
|
|
306
|
+
"warn",
|
|
307
|
+
{
|
|
308
|
+
name: "isFinite",
|
|
309
|
+
message: "Use Number.isFinite instead: https://github.com/airbnb/javascript#standard-library--isfinite",
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: "isNaN",
|
|
313
|
+
message: "Use Number.isNaN instead: https://github.com/airbnb/javascript#standard-library--isnan",
|
|
314
|
+
},
|
|
315
|
+
...confusingBrowserGlobals,
|
|
316
|
+
],
|
|
317
|
+
/** Superseded by the `@typescript-eslint/no-restricted-imports` rule. */
|
|
318
|
+
"no-restricted-imports": "off",
|
|
319
|
+
/**
|
|
320
|
+
* The options are [copied from
|
|
321
|
+
* Airbnb](https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js).
|
|
322
|
+
*/
|
|
323
|
+
"no-restricted-properties": [
|
|
324
|
+
"warn",
|
|
325
|
+
{
|
|
326
|
+
object: "arguments",
|
|
327
|
+
property: "callee",
|
|
328
|
+
message: "arguments.callee is deprecated",
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
object: "global",
|
|
332
|
+
property: "isFinite",
|
|
333
|
+
message: "Please use Number.isFinite instead",
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
object: "self",
|
|
337
|
+
property: "isFinite",
|
|
338
|
+
message: "Please use Number.isFinite instead",
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
object: "window",
|
|
342
|
+
property: "isFinite",
|
|
343
|
+
message: "Please use Number.isFinite instead",
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
object: "global",
|
|
347
|
+
property: "isNaN",
|
|
348
|
+
message: "Please use Number.isNaN instead",
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
object: "self",
|
|
352
|
+
property: "isNaN",
|
|
353
|
+
message: "Please use Number.isNaN instead",
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
object: "window",
|
|
357
|
+
property: "isNaN",
|
|
358
|
+
message: "Please use Number.isNaN instead",
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
property: "__defineGetter__",
|
|
362
|
+
message: "Please use Object.defineProperty instead.",
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
property: "__defineSetter__",
|
|
366
|
+
message: "Please use Object.defineProperty instead.",
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
object: "Math",
|
|
370
|
+
property: "pow",
|
|
371
|
+
message: "Use the exponentiation operator (**) instead.",
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
/** Disabled because it is intended for disallowing specific language features per-project. */
|
|
375
|
+
"no-restricted-syntax": "off",
|
|
376
|
+
/** The `always` option is provided to make the rule stricter. */
|
|
377
|
+
"no-return-assign": ["warn", "always"],
|
|
378
|
+
"no-script-url": "warn",
|
|
379
|
+
/**
|
|
380
|
+
* Disabled because [it can conflict with
|
|
381
|
+
* Prettier](https://github.com/prettier/eslint-config-prettier/tree/main#no-sequences).
|
|
382
|
+
*/
|
|
383
|
+
"no-sequences": "off",
|
|
384
|
+
/** Superseded by the `@typescript-eslint/no-shadow` rule. */
|
|
385
|
+
"no-shadow": "off",
|
|
386
|
+
"no-shadow-restricted-names": "warn",
|
|
387
|
+
/**
|
|
388
|
+
* Disabled because ternaries are common in the TypeScript ecosystem and can often lead to concise
|
|
389
|
+
* code that is easy to read.
|
|
390
|
+
*/
|
|
391
|
+
"no-ternary": "off",
|
|
392
|
+
/** Superseded by the `@typescript-eslint/no-throw-literal` rule. */
|
|
393
|
+
"no-throw-literal": "off",
|
|
394
|
+
"no-undef-init": "warn",
|
|
395
|
+
/**
|
|
396
|
+
* Disabled because in TypeScript, it is common to explicitly check for undefined for the purposes
|
|
397
|
+
* of type narrowing.
|
|
398
|
+
*/
|
|
399
|
+
"no-undefined": "off",
|
|
400
|
+
/**
|
|
401
|
+
* Disabled since it is a common pattern to use underscores to temporarily allow unused variables
|
|
402
|
+
* during development.
|
|
403
|
+
*/
|
|
404
|
+
"no-underscore-dangle": "off",
|
|
405
|
+
/** The `defaultAssignment` option is disabled to make the rule stricter. */
|
|
406
|
+
"no-unneeded-ternary": [
|
|
407
|
+
"warn",
|
|
408
|
+
{
|
|
409
|
+
defaultAssignment: false,
|
|
410
|
+
},
|
|
411
|
+
],
|
|
412
|
+
/** Superseded by the `@typescript-eslint/no-unused-expressions` rule. */
|
|
413
|
+
"no-unused-expressions": "off",
|
|
414
|
+
"no-unused-labels": "warn",
|
|
415
|
+
"no-useless-assignment": "warn",
|
|
416
|
+
"no-useless-call": "warn",
|
|
417
|
+
"no-useless-catch": "warn",
|
|
418
|
+
/** The `enforceForClassMembers` option is enabled to make the rule stricter. */
|
|
419
|
+
"no-useless-computed-key": [
|
|
420
|
+
"warn",
|
|
421
|
+
{
|
|
422
|
+
enforceForClassMembers: true,
|
|
423
|
+
},
|
|
424
|
+
],
|
|
425
|
+
"no-useless-concat": "warn",
|
|
426
|
+
/** Superseded by the `@typescript-eslint/no-useless-constructor` rule. */
|
|
427
|
+
"no-useless-constructor": "off",
|
|
428
|
+
"no-useless-escape": "warn",
|
|
429
|
+
"no-useless-rename": "warn",
|
|
430
|
+
/**
|
|
431
|
+
* Superseded by the `complete/no-useless-return` rule (since the auto-fix is usually unwanted).
|
|
432
|
+
*/
|
|
433
|
+
"no-useless-return": "off",
|
|
434
|
+
"no-var": "warn",
|
|
435
|
+
"no-void": "warn",
|
|
436
|
+
/** Superseded by the `unicorn/expiring-todo-comments` rule. */
|
|
437
|
+
"no-warning-comments": "off",
|
|
438
|
+
"no-with": "warn",
|
|
439
|
+
/** The `ignoreConstructors` option is disabled to make the rule stricter. */
|
|
440
|
+
"object-shorthand": [
|
|
441
|
+
"warn",
|
|
442
|
+
"always",
|
|
443
|
+
{
|
|
444
|
+
ignoreConstructors: false,
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
/**
|
|
448
|
+
* The `never` option is provided to disallow multi-variable declarations (since they can be
|
|
449
|
+
* confusing).
|
|
450
|
+
*/
|
|
451
|
+
"one-var": ["warn", "never"],
|
|
452
|
+
"one-var-declaration-per-line": "off", // eslint-config-prettier
|
|
453
|
+
"operator-assignment": "warn",
|
|
454
|
+
"prefer-arrow-callback": "warn",
|
|
455
|
+
/** Superseded by the `complete/prefer-const` rule (since the auto-fix is usually unwanted). */
|
|
456
|
+
"prefer-const": "off",
|
|
457
|
+
/** Superseded by the `@typescript-eslint/prefer-destructuring` rule. */
|
|
458
|
+
"prefer-destructuring": "off",
|
|
459
|
+
"prefer-exponentiation-operator": "warn",
|
|
460
|
+
/**
|
|
461
|
+
* Disabled because it is common to have a regex with only a single match, in which case a named
|
|
462
|
+
* capture group can be needlessly verbose (and cause extra type narrowing).
|
|
463
|
+
*/
|
|
464
|
+
"prefer-named-capture-group": "off",
|
|
465
|
+
"prefer-numeric-literals": "warn",
|
|
466
|
+
"prefer-object-has-own": "warn",
|
|
467
|
+
"prefer-object-spread": "warn",
|
|
468
|
+
/** Superseded by the `@typescript-eslint/prefer-promise-reject-errors` rule. */
|
|
469
|
+
"prefer-promise-reject-errors": "off",
|
|
470
|
+
/** The `disallowRedundantWrapping` option is enabled to make the rule stricter. */
|
|
471
|
+
"prefer-regex-literals": [
|
|
472
|
+
"warn",
|
|
473
|
+
{
|
|
474
|
+
disallowRedundantWrapping: true,
|
|
475
|
+
},
|
|
476
|
+
],
|
|
477
|
+
"prefer-rest-params": "warn",
|
|
478
|
+
"prefer-spread": "warn",
|
|
479
|
+
"prefer-template": "warn",
|
|
480
|
+
"quote-props": "off", // eslint-config-prettier
|
|
481
|
+
radix: "warn",
|
|
482
|
+
/** Superseded by the `@typescript-eslint/require-await` rule. */
|
|
483
|
+
"require-await": "off",
|
|
484
|
+
/**
|
|
485
|
+
* Disabled because requiring the `u` or the `v` flag for ASCII text is verbose and cumbersome.
|
|
486
|
+
* (Even though these flags would also enable regex strict mode, the marginal benefit is not worth
|
|
487
|
+
* the verbosity.)
|
|
488
|
+
*/
|
|
489
|
+
"require-unicode-regexp": "off",
|
|
490
|
+
"require-yield": "warn",
|
|
491
|
+
/** Disabled since this is automatically handled by `prettier-plugin-organize-imports`. */
|
|
492
|
+
"sort-imports": "off",
|
|
493
|
+
/** Disabled because object keys are often not meant to be sorted in alphabetical order. */
|
|
494
|
+
"sort-keys": "off",
|
|
495
|
+
/**
|
|
496
|
+
* Disabled because variable declarations are often not meant to be sorted in alphabetical order.
|
|
497
|
+
*/
|
|
498
|
+
"sort-vars": "off",
|
|
499
|
+
/**
|
|
500
|
+
* Partially superseded by `complete/format-jsdoc-comments` and `complete/format-line-comments`,
|
|
501
|
+
* but those rules do not handle trailing line comments.
|
|
502
|
+
*
|
|
503
|
+
* The `markers` option is provided to make this rule ignore lines that start with "///".
|
|
504
|
+
*/
|
|
505
|
+
"spaced-comment": [
|
|
506
|
+
"warn",
|
|
507
|
+
"always",
|
|
508
|
+
{
|
|
509
|
+
markers: ["/"],
|
|
510
|
+
},
|
|
511
|
+
],
|
|
512
|
+
/** The `never` option is provided to make the rule stricter. */
|
|
513
|
+
strict: ["warn", "never"],
|
|
514
|
+
"symbol-description": "warn",
|
|
515
|
+
"vars-on-top": "warn",
|
|
516
|
+
yoda: "warn",
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* @see https://eslint.org/docs/latest/rules/#suggestions
|
|
520
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
521
|
+
*/
|
|
522
|
+
const LAYOUT_AND_FORMATTING = {
|
|
523
|
+
"unicode-bom": "warn",
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* @see https://eslint.org/docs/latest/rules/#deprecated
|
|
527
|
+
* @type {Record<string, import("@typescript-eslint/utils").TSESLint.SharedConfig.RuleEntry>}
|
|
528
|
+
*/
|
|
529
|
+
const DEPRECATED = {
|
|
530
|
+
/** Disabled since the rule is deprecated. */
|
|
531
|
+
"array-bracket-newline": "off",
|
|
532
|
+
/** Disabled since the rule is deprecated. */
|
|
533
|
+
"array-bracket-spacing": "off",
|
|
534
|
+
/** Disabled since the rule is deprecated. */
|
|
535
|
+
"array-element-newline": "off",
|
|
536
|
+
/** Disabled since the rule is deprecated. */
|
|
537
|
+
"arrow-parens": "off",
|
|
538
|
+
/** Disabled since the rule is deprecated. */
|
|
539
|
+
"arrow-spacing": "off",
|
|
540
|
+
/** Disabled since the rule is deprecated. */
|
|
541
|
+
"block-spacing": "off",
|
|
542
|
+
/** Disabled since the rule is deprecated. */
|
|
543
|
+
"brace-style": "off",
|
|
544
|
+
/** Disabled since the rule is deprecated. */
|
|
545
|
+
"comma-dangle": "off",
|
|
546
|
+
/** Disabled since the rule is deprecated. */
|
|
547
|
+
"comma-spacing": "off",
|
|
548
|
+
/** Disabled since the rule is deprecated. */
|
|
549
|
+
"comma-style": "off",
|
|
550
|
+
/** Disabled since the rule is deprecated. */
|
|
551
|
+
"computed-property-spacing": "off",
|
|
552
|
+
/** Disabled since the rule is deprecated. */
|
|
553
|
+
"dot-location": "off",
|
|
554
|
+
/** Disabled since the rule is deprecated. */
|
|
555
|
+
"eol-last": "off",
|
|
556
|
+
/** Disabled since the rule is deprecated. */
|
|
557
|
+
"func-call-spacing": "off",
|
|
558
|
+
/** Disabled since the rule is deprecated. */
|
|
559
|
+
"function-call-argument-newline": "off",
|
|
560
|
+
/** Disabled since the rule is deprecated. */
|
|
561
|
+
"function-paren-newline": "off",
|
|
562
|
+
/** Disabled since the rule is deprecated. */
|
|
563
|
+
"generator-star-spacing": "off",
|
|
564
|
+
/** Disabled since the rule is deprecated. */
|
|
565
|
+
"implicit-arrow-linebreak": "off",
|
|
566
|
+
/** Disabled since the rule is deprecated. */
|
|
567
|
+
indent: "off",
|
|
568
|
+
/** Disabled since the rule is deprecated. */
|
|
569
|
+
"jsx-quotes": "off",
|
|
570
|
+
/** Disabled since the rule is deprecated. */
|
|
571
|
+
"key-spacing": "off",
|
|
572
|
+
/** Disabled since the rule is deprecated. */
|
|
573
|
+
"keyword-spacing": "off",
|
|
574
|
+
/** Disabled since the rule is deprecated. */
|
|
575
|
+
"line-comment-position": "off",
|
|
576
|
+
/** Disabled since the rule is deprecated. */
|
|
577
|
+
"linebreak-style": "off",
|
|
578
|
+
/** Disabled since the rule is deprecated. */
|
|
579
|
+
"lines-around-comment": "off",
|
|
580
|
+
/** Disabled since the rule is deprecated. */
|
|
581
|
+
"lines-between-class-members": "off",
|
|
582
|
+
/** Disabled since the rule is deprecated. */
|
|
583
|
+
"max-len": "off",
|
|
584
|
+
/** Disabled since the rule is deprecated. */
|
|
585
|
+
"max-statements-per-line": "off",
|
|
586
|
+
/** Disabled since the rule is deprecated. */
|
|
587
|
+
"multiline-ternary": "off",
|
|
588
|
+
/** Disabled since the rule is deprecated. */
|
|
589
|
+
"new-parens": "off",
|
|
590
|
+
/** Disabled since the rule is deprecated. */
|
|
591
|
+
"newline-per-chained-call": "off",
|
|
592
|
+
/** Disabled since the rule is deprecated. */
|
|
593
|
+
"no-extra-parens": "off",
|
|
594
|
+
/** Disabled since the rule is deprecated. */
|
|
595
|
+
"no-mixed-spaces-and-tabs": "off",
|
|
596
|
+
/** Disabled since the rule is deprecated. */
|
|
597
|
+
"no-multi-spaces": "off",
|
|
598
|
+
/** Disabled since the rule is deprecated. */
|
|
599
|
+
"no-multiple-empty-lines": "off",
|
|
600
|
+
/** Disabled since the rule is deprecated. */
|
|
601
|
+
"no-tabs": "off",
|
|
602
|
+
/** Disabled since the rule is deprecated. */
|
|
603
|
+
"no-trailing-spaces": "off",
|
|
604
|
+
/** Disabled since the rule is deprecated. */
|
|
605
|
+
"no-whitespace-before-property": "off",
|
|
606
|
+
/** Disabled since the rule is deprecated. */
|
|
607
|
+
"nonblock-statement-body-position": "off",
|
|
608
|
+
/** Disabled since the rule is deprecated. */
|
|
609
|
+
"object-curly-newline": "off",
|
|
610
|
+
/** Disabled since the rule is deprecated. */
|
|
611
|
+
"object-curly-spacing": "off",
|
|
612
|
+
/** Disabled since the rule is deprecated. */
|
|
613
|
+
"object-property-newline": "off",
|
|
614
|
+
/** Disabled since the rule is deprecated. */
|
|
615
|
+
"operator-linebreak": "off",
|
|
616
|
+
/** Disabled since the rule is deprecated. */
|
|
617
|
+
"padded-blocks": "off",
|
|
618
|
+
/** Disabled since the rule is deprecated. */
|
|
619
|
+
"padding-line-between-statements": "off",
|
|
620
|
+
/** Disabled since the rule is deprecated. */
|
|
621
|
+
quotes: "off",
|
|
622
|
+
/** Disabled since the rule is deprecated. */
|
|
623
|
+
"rest-spread-spacing": "off",
|
|
624
|
+
/** Disabled since the rule is deprecated. */
|
|
625
|
+
semi: "off",
|
|
626
|
+
/** Disabled since the rule is deprecated. */
|
|
627
|
+
"semi-spacing": "off",
|
|
628
|
+
/** Disabled since the rule is deprecated. */
|
|
629
|
+
"semi-style": "off",
|
|
630
|
+
/** Disabled since the rule is deprecated. */
|
|
631
|
+
"space-before-blocks": "off",
|
|
632
|
+
/** Disabled since the rule is deprecated. */
|
|
633
|
+
"space-before-function-paren": "off",
|
|
634
|
+
/** Disabled since the rule is deprecated. */
|
|
635
|
+
"space-in-parens": "off",
|
|
636
|
+
/** Disabled since the rule is deprecated. */
|
|
637
|
+
"space-infix-ops": "off",
|
|
638
|
+
/** Disabled since the rule is deprecated. */
|
|
639
|
+
"space-unary-ops": "off",
|
|
640
|
+
/** Disabled since the rule is deprecated. */
|
|
641
|
+
"switch-colon-spacing": "off",
|
|
642
|
+
/** Disabled since the rule is deprecated. */
|
|
643
|
+
"template-curly-spacing": "off",
|
|
644
|
+
/** Disabled since the rule is deprecated. */
|
|
645
|
+
"template-tag-spacing": "off",
|
|
646
|
+
/** Disabled since the rule is deprecated. */
|
|
647
|
+
"wrap-iife": "off",
|
|
648
|
+
/** Disabled since the rule is deprecated. */
|
|
649
|
+
"wrap-regex": "off",
|
|
650
|
+
/** Disabled since the rule is deprecated. */
|
|
651
|
+
"yield-star-spacing": "off",
|
|
652
|
+
};
|
|
653
|
+
/**
|
|
654
|
+
* This ESLint config only contains built-in rules from ESLint itself:
|
|
655
|
+
* https://eslint.org/docs/latest/rules/
|
|
656
|
+
*
|
|
657
|
+
* Rules are separated into categories:
|
|
658
|
+
* 1) Possible Problems
|
|
659
|
+
* 2) Suggestions
|
|
660
|
+
* 3) Layout & Formatting
|
|
661
|
+
* 4) Deprecated
|
|
662
|
+
*/
|
|
663
|
+
export const baseESLint = tseslint.config({
|
|
664
|
+
rules: {
|
|
665
|
+
...POSSIBLE_PROBLEMS,
|
|
666
|
+
...SUGGESTIONS,
|
|
667
|
+
...LAYOUT_AND_FORMATTING,
|
|
668
|
+
...DEPRECATED,
|
|
669
|
+
},
|
|
670
|
+
});
|