@pob/eslint-config 67.14.0 → 68.0.0
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/lib/_base.js +21 -31
- package/lib/eslint-rules.test.js +1 -3
- package/lib/index.js +77 -343
- package/lib/index.test.js +76 -40
- package/lib/node.js +60 -0
- package/lib/overrides/dev-only.js +10 -0
- package/lib/overrides/scripts.js +1 -1
- package/lib/overrides/test.js +7 -45
- package/lib/overrides/tools-project.js +4 -10
- package/lib/oxlint-js-plugins-rules.test.js +62 -0
- package/lib/oxlint-rules.test.js +2 -4
- package/lib/oxlint.test.js +58 -46
- package/lib/plugins/import.js +69 -0
- package/lib/typescript.js +27 -0
- package/oxlint/base.json +4 -0
- package/oxlint/commonjs.json +17 -0
- package/package.json +6 -13
- package/lib/base/commonjs.js +0 -12
- package/lib/base/module.js +0 -29
- package/lib/node/_base.js +0 -35
- package/lib/node/commonjs.js +0 -25
- package/lib/node/module.js +0 -35
- package/lib/node/typescript.js +0 -15
- package/lib/overrides/allow-implicit-return-type.js +0 -7
- package/lib/overrides/allow-unsafe-as-warn.js +0 -10
- package/lib/overrides/allow-unsafe.js +0 -10
- package/lib/overrides/app.js +0 -8
- package/lib/plugins/import/import-base.js +0 -136
- package/lib/plugins/import/import-commonjs.js +0 -7
- package/lib/plugins/import/import-module.js +0 -7
- package/lib/plugins/node.js +0 -17
- package/lib/plugins/regexp.js +0 -12
- package/lib/plugins/typescript-eslint/typescript-eslint-replace-eslint.js +0 -126
- package/lib/plugins/typescript-eslint/typescript-eslint-replace-unicorn.js +0 -13
- package/lib/plugins/typescript-eslint/typescript-eslint-rules.js +0 -213
- package/lib/plugins/unicorn.js +0 -392
- package/lib/rules/best-practices.js +0 -470
- package/lib/rules/code-quality.js +0 -10
- package/lib/rules/dev-only.js +0 -15
- package/lib/rules/errors.js +0 -128
- package/lib/rules/node.js +0 -26
- package/lib/rules/style.js +0 -26
- package/lib/rules/typescript.js +0 -61
- package/lib/utils/oxlint.js +0 -136
- package/lib/utils/oxlint.test.js +0 -197
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
name: "@pob/eslint-config/best-practices",
|
|
5
|
-
rules: {
|
|
6
|
-
// https://eslint.org/docs/rules/accessor-pairs
|
|
7
|
-
"accessor-pairs": "off",
|
|
8
|
-
|
|
9
|
-
// https://eslint.org/docs/rules/array-callback-return
|
|
10
|
-
"array-callback-return": "error",
|
|
11
|
-
|
|
12
|
-
// https://eslint.org/docs/rules/block-scoped-var
|
|
13
|
-
"block-scoped-var": "error",
|
|
14
|
-
|
|
15
|
-
// http://eslint.org/docs/rules/class-methods-use-this
|
|
16
|
-
"class-methods-use-this": "off",
|
|
17
|
-
|
|
18
|
-
// https://eslint.org/docs/rules/constructor-super
|
|
19
|
-
"constructor-super": "error",
|
|
20
|
-
|
|
21
|
-
// http://eslint.org/docs/rules/consistent-return
|
|
22
|
-
"consistent-return": "off",
|
|
23
|
-
|
|
24
|
-
// http://eslint.org/docs/rules/default-case
|
|
25
|
-
"default-case": ["error", { commentPattern: "^no default$" }],
|
|
26
|
-
|
|
27
|
-
// http://eslint.org/docs/rules/default-case-last
|
|
28
|
-
"default-case-last": "error",
|
|
29
|
-
|
|
30
|
-
// https://eslint.org/docs/rules/default-param-last
|
|
31
|
-
"default-param-last": "error",
|
|
32
|
-
|
|
33
|
-
// https://eslint.org/docs/rules/dot-notation
|
|
34
|
-
"dot-notation": ["error", { allowKeywords: true }],
|
|
35
|
-
|
|
36
|
-
// https://eslint.org/docs/rules/eqeqeq
|
|
37
|
-
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
38
|
-
|
|
39
|
-
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
40
|
-
"grouped-accessor-pairs": "error",
|
|
41
|
-
|
|
42
|
-
// https://eslint.org/docs/rules/guard-for-in
|
|
43
|
-
"guard-for-in": "error",
|
|
44
|
-
|
|
45
|
-
// https://eslint.org/docs/rules/max-classes-per-file
|
|
46
|
-
"max-classes-per-file": "off",
|
|
47
|
-
|
|
48
|
-
// https://eslint.org/docs/rules/max-params
|
|
49
|
-
"max-params": "warn",
|
|
50
|
-
|
|
51
|
-
// require a capital letter for constructors
|
|
52
|
-
// https://eslint.org/docs/rules/new-cap
|
|
53
|
-
"new-cap": [
|
|
54
|
-
"error",
|
|
55
|
-
{
|
|
56
|
-
newIsCap: true,
|
|
57
|
-
newIsCapExceptions: [],
|
|
58
|
-
capIsNew: false,
|
|
59
|
-
capIsNewExceptions: [
|
|
60
|
-
"Immutable.Map",
|
|
61
|
-
"Immutable.Set",
|
|
62
|
-
"Immutable.List",
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
|
|
67
|
-
// https://eslint.org/docs/rules/no-alert
|
|
68
|
-
"no-alert": "error",
|
|
69
|
-
|
|
70
|
-
// https://eslint.org/docs/rules/no-array-constructor
|
|
71
|
-
"no-array-constructor": "error",
|
|
72
|
-
|
|
73
|
-
// https://eslint.org/docs/rules/no-bitwise
|
|
74
|
-
"no-bitwise": "error",
|
|
75
|
-
|
|
76
|
-
// https://eslint.org/docs/rules/no-caller
|
|
77
|
-
"no-caller": "error",
|
|
78
|
-
|
|
79
|
-
// https://eslint.org/docs/rules/no-case-declarations
|
|
80
|
-
"no-case-declarations": "error",
|
|
81
|
-
|
|
82
|
-
// https://eslint.org/docs/rules/no-constructor-return
|
|
83
|
-
"no-constructor-return": "error",
|
|
84
|
-
|
|
85
|
-
// https://eslint.org/docs/rules/no-continue
|
|
86
|
-
"no-continue": "off",
|
|
87
|
-
|
|
88
|
-
// https://eslint.org/docs/rules/no-class-assign
|
|
89
|
-
"no-class-assign": "error",
|
|
90
|
-
|
|
91
|
-
// https://eslint.org/docs/rules/no-const-assign
|
|
92
|
-
"no-const-assign": "error",
|
|
93
|
-
|
|
94
|
-
// https://eslint.org/docs/rules/no-dupe-class-members
|
|
95
|
-
"no-dupe-class-members": "error",
|
|
96
|
-
|
|
97
|
-
// https://eslint.org/docs/rules/no-empty-function
|
|
98
|
-
"no-empty-function": [
|
|
99
|
-
"error",
|
|
100
|
-
{
|
|
101
|
-
allow: ["arrowFunctions", "functions", "methods"],
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
|
|
105
|
-
// https://eslint.org/docs/rules/no-empty-pattern
|
|
106
|
-
"no-empty-pattern": "error",
|
|
107
|
-
|
|
108
|
-
// https://eslint.org/docs/latest/rules/no-empty-static-block
|
|
109
|
-
"no-empty-static-block": "error",
|
|
110
|
-
|
|
111
|
-
// https://eslint.org/docs/rules/no-eq-null
|
|
112
|
-
"no-eq-null": "off",
|
|
113
|
-
|
|
114
|
-
// https://eslint.org/docs/rules/no-eval
|
|
115
|
-
"no-eval": "error",
|
|
116
|
-
|
|
117
|
-
// https://eslint.org/docs/rules/no-extend-native
|
|
118
|
-
"no-extend-native": "error",
|
|
119
|
-
|
|
120
|
-
// https://eslint.org/docs/rules/no-extra-bind
|
|
121
|
-
"no-extra-bind": "error",
|
|
122
|
-
|
|
123
|
-
// https://eslint.org/docs/rules/no-extra-label
|
|
124
|
-
"no-extra-label": "error",
|
|
125
|
-
|
|
126
|
-
// https://eslint.org/docs/rules/no-fallthrough
|
|
127
|
-
"no-fallthrough": "error",
|
|
128
|
-
|
|
129
|
-
// https://eslint.org/docs/rules/no-global-assign
|
|
130
|
-
"no-global-assign": "error",
|
|
131
|
-
|
|
132
|
-
// https://eslint.org/docs/rules/no-implicit-globals
|
|
133
|
-
// only reports in scripts: ES modules have their own scope, and node wraps
|
|
134
|
-
// CommonJS files in a function
|
|
135
|
-
"no-implicit-globals": "off",
|
|
136
|
-
|
|
137
|
-
// https://eslint.org/docs/rules/no-implied-eval
|
|
138
|
-
"no-implied-eval": "error",
|
|
139
|
-
|
|
140
|
-
// https://eslint.org/docs/rules/no-labels
|
|
141
|
-
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
142
|
-
|
|
143
|
-
// https://eslint.org/docs/rules/no-label-var
|
|
144
|
-
"no-label-var": "error",
|
|
145
|
-
|
|
146
|
-
// https://eslint.org/docs/rules/no-lone-blocks
|
|
147
|
-
"no-lone-blocks": "error",
|
|
148
|
-
|
|
149
|
-
// https://eslint.org/docs/rules/no-lonely-if
|
|
150
|
-
"no-lonely-if": "error",
|
|
151
|
-
|
|
152
|
-
// https://eslint.org/docs/rules/no-loop-func
|
|
153
|
-
"no-loop-func": "error",
|
|
154
|
-
|
|
155
|
-
// https://eslint.org/docs/rules/no-multi-assign
|
|
156
|
-
"no-multi-assign": "error",
|
|
157
|
-
|
|
158
|
-
// https://eslint.org/docs/rules/no-multi-str
|
|
159
|
-
"no-multi-str": "error",
|
|
160
|
-
|
|
161
|
-
// https://eslint.org/docs/rules/no-nested-ternary
|
|
162
|
-
"no-nested-ternary": "error",
|
|
163
|
-
|
|
164
|
-
// https://eslint.org/docs/rules/no-new
|
|
165
|
-
"no-new": "error",
|
|
166
|
-
|
|
167
|
-
// https://eslint.org/docs/rules/no-new-func
|
|
168
|
-
"no-new-func": "error",
|
|
169
|
-
|
|
170
|
-
// https://eslint.org/docs/rules/no-new-wrappers
|
|
171
|
-
"no-new-wrappers": "error",
|
|
172
|
-
|
|
173
|
-
// https://eslint.org/docs/rules/no-new-native-nonconstructor
|
|
174
|
-
"no-new-native-nonconstructor": "error",
|
|
175
|
-
|
|
176
|
-
// https://eslint.org/docs/rules/no-nonoctal-decimal-escape
|
|
177
|
-
"no-nonoctal-decimal-escape": "error",
|
|
178
|
-
|
|
179
|
-
// https://eslint.org/docs/rules/no-object-constructor
|
|
180
|
-
"no-object-constructor": "error",
|
|
181
|
-
|
|
182
|
-
// https://eslint.org/docs/rules/no-octal
|
|
183
|
-
"no-octal": "error",
|
|
184
|
-
|
|
185
|
-
// https://eslint.org/docs/rules/no-octal-escape
|
|
186
|
-
"no-octal-escape": "error",
|
|
187
|
-
|
|
188
|
-
// rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
189
|
-
"no-param-reassign": "off",
|
|
190
|
-
|
|
191
|
-
// https://eslint.org/docs/rules/no-plusplus
|
|
192
|
-
"no-plusplus": "off",
|
|
193
|
-
|
|
194
|
-
// https://eslint.org/docs/rules/no-proto
|
|
195
|
-
"no-proto": "error",
|
|
196
|
-
|
|
197
|
-
// https://eslint.org/docs/rules/no-redeclare
|
|
198
|
-
"no-redeclare": "error",
|
|
199
|
-
|
|
200
|
-
// https://eslint.org/docs/rules/no-restricted-globals
|
|
201
|
-
"no-restricted-globals": [
|
|
202
|
-
"error",
|
|
203
|
-
{
|
|
204
|
-
name: "isFinite",
|
|
205
|
-
message:
|
|
206
|
-
"Use Number.isFinite instead https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite",
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: "isNaN",
|
|
210
|
-
message:
|
|
211
|
-
"Use Number.isNaN instead https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN",
|
|
212
|
-
},
|
|
213
|
-
...confusingBrowserGlobals.map((g) => ({
|
|
214
|
-
name: g,
|
|
215
|
-
message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
|
|
216
|
-
})),
|
|
217
|
-
],
|
|
218
|
-
|
|
219
|
-
// https://eslint.org/docs/rules/no-restricted-properties
|
|
220
|
-
"no-restricted-properties": [
|
|
221
|
-
"error",
|
|
222
|
-
{
|
|
223
|
-
object: "global",
|
|
224
|
-
property: "isFinite",
|
|
225
|
-
message: "Use Number.isFinite instead",
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
object: "self",
|
|
229
|
-
property: "isFinite",
|
|
230
|
-
message: "Use Number.isFinite instead",
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
object: "window",
|
|
234
|
-
property: "isFinite",
|
|
235
|
-
message: "Use Number.isFinite instead",
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
object: "global",
|
|
239
|
-
property: "isNaN",
|
|
240
|
-
message: "Use Number.isNaN instead",
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
object: "self",
|
|
244
|
-
property: "isNaN",
|
|
245
|
-
message: "Use Number.isNaN instead",
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
object: "window",
|
|
249
|
-
property: "isNaN",
|
|
250
|
-
message: "Use Number.isNaN instead",
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
property: "__defineGetter__",
|
|
254
|
-
message: "Use Object.defineProperty instead.",
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
property: "__defineSetter__",
|
|
258
|
-
message: "Use Object.defineProperty instead.",
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
|
|
262
|
-
// https://eslint.org/docs/rules/no-return-assign
|
|
263
|
-
"no-return-assign": ["error", "always"],
|
|
264
|
-
|
|
265
|
-
// https://eslint.org/docs/rules/no-script-url
|
|
266
|
-
"no-script-url": "error",
|
|
267
|
-
|
|
268
|
-
// https://eslint.org/docs/rules/no-self-assign
|
|
269
|
-
"no-self-assign": [
|
|
270
|
-
"error",
|
|
271
|
-
{
|
|
272
|
-
props: true,
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
|
|
276
|
-
// https://eslint.org/docs/rules/no-self-compare
|
|
277
|
-
"no-self-compare": "error",
|
|
278
|
-
|
|
279
|
-
// https://eslint.org/docs/rules/no-sequences
|
|
280
|
-
"no-sequences": "error",
|
|
281
|
-
|
|
282
|
-
// disallow shadowing of names such as arguments
|
|
283
|
-
"no-shadow-restricted-names": "error",
|
|
284
|
-
|
|
285
|
-
// https://eslint.org/docs/rules/no-this-before-super
|
|
286
|
-
"no-this-before-super": "error",
|
|
287
|
-
|
|
288
|
-
// https://eslint.org/docs/rules/no-throw-literal
|
|
289
|
-
"no-throw-literal": "error",
|
|
290
|
-
|
|
291
|
-
// https://eslint.org/docs/rules/no-undef
|
|
292
|
-
"no-undef": "error",
|
|
293
|
-
|
|
294
|
-
// https://eslint.org/docs/rules/no-undef-init
|
|
295
|
-
"no-undef-init": "error",
|
|
296
|
-
|
|
297
|
-
// https://eslint.org/docs/rules/no-unneeded-ternary
|
|
298
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
299
|
-
|
|
300
|
-
// https://eslint.org/docs/rules/no-unused-expressions
|
|
301
|
-
"no-unused-expressions": [
|
|
302
|
-
"error",
|
|
303
|
-
{
|
|
304
|
-
allowShortCircuit: false,
|
|
305
|
-
allowTernary: false,
|
|
306
|
-
allowTaggedTemplates: false,
|
|
307
|
-
},
|
|
308
|
-
],
|
|
309
|
-
|
|
310
|
-
// https://eslint.org/docs/rules/no-unused-labels
|
|
311
|
-
"no-unused-labels": "error",
|
|
312
|
-
|
|
313
|
-
// https://eslint.org/docs/rules/no-unused-vars
|
|
314
|
-
"no-unused-vars": [
|
|
315
|
-
"error",
|
|
316
|
-
{
|
|
317
|
-
vars: "all",
|
|
318
|
-
args: "none",
|
|
319
|
-
caughtErrors: "none",
|
|
320
|
-
ignoreRestSiblings: true,
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
|
|
324
|
-
// https://eslint.org/docs/rules/no-use-before-define
|
|
325
|
-
"no-use-before-define": [
|
|
326
|
-
"error",
|
|
327
|
-
{ functions: true, classes: true, variables: true },
|
|
328
|
-
],
|
|
329
|
-
|
|
330
|
-
// https://eslint.org/docs/rules/no-useless-catch
|
|
331
|
-
"no-useless-catch": "error",
|
|
332
|
-
|
|
333
|
-
// https://eslint.org/docs/rules/no-useless-concat
|
|
334
|
-
"no-useless-concat": "error",
|
|
335
|
-
|
|
336
|
-
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
337
|
-
"no-useless-computed-key": "error",
|
|
338
|
-
|
|
339
|
-
// https://eslint.org/docs/rules/no-useless-constructor
|
|
340
|
-
"no-useless-constructor": "error",
|
|
341
|
-
|
|
342
|
-
// https://eslint.org/docs/rules/no-useless-escape
|
|
343
|
-
"no-useless-escape": "error",
|
|
344
|
-
|
|
345
|
-
// https://eslint.org/docs/rules/no-useless-rename
|
|
346
|
-
"no-useless-rename": [
|
|
347
|
-
"error",
|
|
348
|
-
{
|
|
349
|
-
ignoreDestructuring: false,
|
|
350
|
-
ignoreImport: false,
|
|
351
|
-
ignoreExport: false,
|
|
352
|
-
},
|
|
353
|
-
],
|
|
354
|
-
|
|
355
|
-
// https://eslint.org/docs/rules/no-useless-return
|
|
356
|
-
"no-useless-return": "error",
|
|
357
|
-
|
|
358
|
-
// https://eslint.org/docs/rules/no-var
|
|
359
|
-
"no-var": "error",
|
|
360
|
-
|
|
361
|
-
// https://eslint.org/docs/rules/no-void
|
|
362
|
-
"no-void": "error",
|
|
363
|
-
|
|
364
|
-
// https://eslint.org/docs/rules/no-with
|
|
365
|
-
"no-with": "error",
|
|
366
|
-
|
|
367
|
-
// https://eslint.org/docs/rules/object-shorthand
|
|
368
|
-
"object-shorthand": [
|
|
369
|
-
"error",
|
|
370
|
-
"always",
|
|
371
|
-
{
|
|
372
|
-
ignoreConstructors: false,
|
|
373
|
-
avoidQuotes: true,
|
|
374
|
-
},
|
|
375
|
-
],
|
|
376
|
-
|
|
377
|
-
// https://eslint.org/docs/rules/prefer-arrow-callback
|
|
378
|
-
"prefer-arrow-callback": [
|
|
379
|
-
"error",
|
|
380
|
-
{
|
|
381
|
-
allowNamedFunctions: false,
|
|
382
|
-
allowUnboundThis: true,
|
|
383
|
-
},
|
|
384
|
-
],
|
|
385
|
-
|
|
386
|
-
// https://eslint.org/docs/rules/prefer-const
|
|
387
|
-
"prefer-const": [
|
|
388
|
-
"error",
|
|
389
|
-
{
|
|
390
|
-
destructuring: "any",
|
|
391
|
-
ignoreReadBeforeAssign: true,
|
|
392
|
-
},
|
|
393
|
-
],
|
|
394
|
-
|
|
395
|
-
// https://eslint.org/docs/rules/prefer-exponentiation-operator
|
|
396
|
-
"prefer-exponentiation-operator": "error",
|
|
397
|
-
|
|
398
|
-
// https://eslint.org/docs/rules/prefer-numeric-literals
|
|
399
|
-
"prefer-numeric-literals": "error",
|
|
400
|
-
|
|
401
|
-
// https://eslint.org/docs/rules/prefer-object-has-own
|
|
402
|
-
"prefer-object-has-own": "error",
|
|
403
|
-
|
|
404
|
-
// https://eslint.org/docs/rules/prefer-object-spread
|
|
405
|
-
"prefer-object-spread": "error",
|
|
406
|
-
|
|
407
|
-
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
408
|
-
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
409
|
-
|
|
410
|
-
// https://eslint.org/docs/rules/prefer-regex-literals
|
|
411
|
-
"prefer-regex-literals": [
|
|
412
|
-
"error",
|
|
413
|
-
{
|
|
414
|
-
disallowRedundantWrapping: true,
|
|
415
|
-
},
|
|
416
|
-
],
|
|
417
|
-
|
|
418
|
-
// https://eslint.org/docs/rules/prefer-rest-params
|
|
419
|
-
"prefer-rest-params": "error",
|
|
420
|
-
|
|
421
|
-
// https://eslint.org/docs/rules/prefer-spread
|
|
422
|
-
"prefer-spread": "error",
|
|
423
|
-
|
|
424
|
-
// https://eslint.org/docs/rules/prefer-template
|
|
425
|
-
"prefer-template": "error",
|
|
426
|
-
|
|
427
|
-
// https://eslint.org/docs/rules/radix
|
|
428
|
-
radix: "error",
|
|
429
|
-
|
|
430
|
-
// https://eslint.org/docs/rules/require-await
|
|
431
|
-
"require-await": "error",
|
|
432
|
-
|
|
433
|
-
// https://eslint.org/docs/rules/require-yield
|
|
434
|
-
"require-yield": "error",
|
|
435
|
-
|
|
436
|
-
// https://eslint.org/docs/rules/symbol-description
|
|
437
|
-
"symbol-description": "error",
|
|
438
|
-
|
|
439
|
-
// https://eslint.org/docs/rules/unicode-bom
|
|
440
|
-
"unicode-bom": ["error", "never"],
|
|
441
|
-
|
|
442
|
-
// https://eslint.org/docs/rules/yoda
|
|
443
|
-
yoda: "error",
|
|
444
|
-
|
|
445
|
-
// Allow for-of, now supported by node 6 and modern browsers
|
|
446
|
-
"no-restricted-syntax": [
|
|
447
|
-
"error",
|
|
448
|
-
{
|
|
449
|
-
selector: "ForInStatement",
|
|
450
|
-
message:
|
|
451
|
-
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
452
|
-
},
|
|
453
|
-
// => allow 'ForOfStatement',
|
|
454
|
-
// {
|
|
455
|
-
// selector: 'ForOfStatement',
|
|
456
|
-
// message: '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.',
|
|
457
|
-
// },
|
|
458
|
-
{
|
|
459
|
-
selector: "LabeledStatement",
|
|
460
|
-
message:
|
|
461
|
-
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
selector: "WithStatement",
|
|
465
|
-
message:
|
|
466
|
-
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
467
|
-
},
|
|
468
|
-
],
|
|
469
|
-
},
|
|
470
|
-
};
|
package/lib/rules/dev-only.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "@pob/eslint-config/dev-only",
|
|
3
|
-
files: ["**/*.{js,cjs,mjs}"],
|
|
4
|
-
ignores: ["**/{src,lib}/*.{js,cjs,mjs}"],
|
|
5
|
-
rules: {
|
|
6
|
-
"no-console": "off",
|
|
7
|
-
|
|
8
|
-
"import-x/no-extraneous-dependencies": [
|
|
9
|
-
"error",
|
|
10
|
-
{
|
|
11
|
-
devDependencies: true,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
};
|
package/lib/rules/errors.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "@pob/eslint-config/errors",
|
|
3
|
-
|
|
4
|
-
rules: {
|
|
5
|
-
// https://eslint.org/docs/rules/for-direction
|
|
6
|
-
"for-direction": "error",
|
|
7
|
-
|
|
8
|
-
// https://eslint.org/docs/rules/getter-return
|
|
9
|
-
"getter-return": ["error", { allowImplicit: true }],
|
|
10
|
-
|
|
11
|
-
// https://eslint.org/docs/rules/no-async-promise-executor
|
|
12
|
-
"no-async-promise-executor": "error",
|
|
13
|
-
|
|
14
|
-
// https://eslint.org/docs/rules/no-compare-neg-zero
|
|
15
|
-
"no-compare-neg-zero": "error",
|
|
16
|
-
|
|
17
|
-
// https://eslint.org/docs/rules/no-cond-assign
|
|
18
|
-
"no-cond-assign": ["error", "always"],
|
|
19
|
-
|
|
20
|
-
// https://eslint.org/docs/rules/no-console
|
|
21
|
-
"no-console": "warn",
|
|
22
|
-
|
|
23
|
-
// https://eslint.org/docs/rules/no-constant-condition
|
|
24
|
-
"no-constant-condition": "error",
|
|
25
|
-
|
|
26
|
-
// https://eslint.org/docs/rules/no-control-regex
|
|
27
|
-
"no-control-regex": "error",
|
|
28
|
-
|
|
29
|
-
// https://eslint.org/docs/rules/no-debugger
|
|
30
|
-
"no-debugger": "error",
|
|
31
|
-
|
|
32
|
-
// https://eslint.org/docs/rules/no-dupe-args
|
|
33
|
-
"no-dupe-args": "error",
|
|
34
|
-
|
|
35
|
-
// https://eslint.org/docs/rules/no-dupe-else-if
|
|
36
|
-
"no-dupe-else-if": "error",
|
|
37
|
-
|
|
38
|
-
// https://eslint.org/docs/rules/no-dupe-keys
|
|
39
|
-
"no-dupe-keys": "error",
|
|
40
|
-
|
|
41
|
-
// https://eslint.org/docs/rules/no-duplicate-case
|
|
42
|
-
"no-duplicate-case": "error",
|
|
43
|
-
|
|
44
|
-
// https://eslint.org/docs/rules/no-empty
|
|
45
|
-
"no-empty": "off",
|
|
46
|
-
|
|
47
|
-
// https://eslint.org/docs/rules/no-empty-character-class
|
|
48
|
-
"no-empty-character-class": "error",
|
|
49
|
-
|
|
50
|
-
// https://eslint.org/docs/rules/no-ex-assign
|
|
51
|
-
"no-ex-assign": "error",
|
|
52
|
-
|
|
53
|
-
// https://eslint.org/docs/rules/no-extra-boolean-cast
|
|
54
|
-
"no-extra-boolean-cast": "error",
|
|
55
|
-
|
|
56
|
-
// https://eslint.org/docs/rules/no-func-assign
|
|
57
|
-
"no-func-assign": "error",
|
|
58
|
-
|
|
59
|
-
// https://eslint.org/docs/rules/no-import-assign
|
|
60
|
-
"no-import-assign": "error",
|
|
61
|
-
|
|
62
|
-
// https://eslint.org/docs/rules/no-invalid-regexp
|
|
63
|
-
"no-invalid-regexp": "error",
|
|
64
|
-
|
|
65
|
-
// https://eslint.org/docs/rules/no-irregular-whitespace
|
|
66
|
-
"no-irregular-whitespace": "error",
|
|
67
|
-
|
|
68
|
-
// https://eslint.org/docs/rules/no-loss-of-precision
|
|
69
|
-
"no-loss-of-precision": "error",
|
|
70
|
-
|
|
71
|
-
// https://eslint.org/docs/rules/no-misleading-character-class
|
|
72
|
-
"no-misleading-character-class": "error",
|
|
73
|
-
|
|
74
|
-
// https://eslint.org/docs/rules/no-obj-calls
|
|
75
|
-
"no-obj-calls": "error",
|
|
76
|
-
|
|
77
|
-
// https://eslint.org/docs/rules/no-new-native-nonconstructor
|
|
78
|
-
"no-new-native-nonconstructor": "error",
|
|
79
|
-
|
|
80
|
-
// https://eslint.org/docs/rules/no-promise-executor-return
|
|
81
|
-
"no-promise-executor-return": "error",
|
|
82
|
-
|
|
83
|
-
// https://eslint.org/docs/rules/no-prototype-builtins
|
|
84
|
-
"no-prototype-builtins": "error",
|
|
85
|
-
|
|
86
|
-
// https://eslint.org/docs/rules/no-regex-spaces
|
|
87
|
-
"no-regex-spaces": "error",
|
|
88
|
-
|
|
89
|
-
// https://eslint.org/docs/rules/no-self-compare
|
|
90
|
-
"no-self-compare": "error",
|
|
91
|
-
|
|
92
|
-
// https://eslint.org/docs/rules/no-setter-return
|
|
93
|
-
"no-setter-return": "error",
|
|
94
|
-
|
|
95
|
-
// https://eslint.org/docs/rules/no-sparse-arrays
|
|
96
|
-
"no-sparse-arrays": "error",
|
|
97
|
-
|
|
98
|
-
// https://eslint.org/docs/rules/no-template-curly-in-string
|
|
99
|
-
"no-template-curly-in-string": "error",
|
|
100
|
-
|
|
101
|
-
// https://eslint.org/docs/rules/no-unreachable
|
|
102
|
-
"no-unreachable": "error",
|
|
103
|
-
|
|
104
|
-
// https://eslint.org/docs/rules/no-unreachable-loop
|
|
105
|
-
"no-unreachable-loop": "error",
|
|
106
|
-
|
|
107
|
-
// https://eslint.org/docs/rules/no-unsafe-finally
|
|
108
|
-
"no-unsafe-finally": "error",
|
|
109
|
-
|
|
110
|
-
// https://eslint.org/docs/rules/no-unsafe-negation
|
|
111
|
-
"no-unsafe-negation": "error",
|
|
112
|
-
|
|
113
|
-
// https://eslint.org/docs/rules/no-unsafe-optional-chaining
|
|
114
|
-
"no-unsafe-optional-chaining": "error",
|
|
115
|
-
|
|
116
|
-
// https://eslint.org/docs/rules/no-unused-private-class-members
|
|
117
|
-
"no-unused-private-class-members": "error",
|
|
118
|
-
|
|
119
|
-
// https://eslint.org/docs/rules/no-useless-backreference
|
|
120
|
-
"no-useless-backreference": "error",
|
|
121
|
-
|
|
122
|
-
// https://eslint.org/docs/rules/use-isnan
|
|
123
|
-
"use-isnan": "error",
|
|
124
|
-
|
|
125
|
-
// https://eslint.org/docs/rules/valid-typeof
|
|
126
|
-
"valid-typeof": "error",
|
|
127
|
-
},
|
|
128
|
-
};
|
package/lib/rules/node.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createNodeResolver } from "eslint-plugin-import-x";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
name: "@pob/eslint-config/node",
|
|
5
|
-
settings: {
|
|
6
|
-
"import-x/resolver-next": [
|
|
7
|
-
createNodeResolver({
|
|
8
|
-
extensions: [".mjs", ".js", ".json", ".ts"],
|
|
9
|
-
conditionNames: ["node", "import"],
|
|
10
|
-
}),
|
|
11
|
-
],
|
|
12
|
-
},
|
|
13
|
-
rules: {
|
|
14
|
-
// ensure deprecated eslint rules are disabled
|
|
15
|
-
"callback-return": "off",
|
|
16
|
-
"global-require": "off",
|
|
17
|
-
"handle-callback-err": "off",
|
|
18
|
-
"no-mixed-requires": "off",
|
|
19
|
-
"no-new-require": "off",
|
|
20
|
-
"no-path-concat": "off",
|
|
21
|
-
"no-process-env": "off",
|
|
22
|
-
"no-process-exit": "off",
|
|
23
|
-
"no-restricted-modules": "off",
|
|
24
|
-
"no-sync": "off",
|
|
25
|
-
},
|
|
26
|
-
};
|
package/lib/rules/style.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "@pob/eslint-config/style",
|
|
3
|
-
rules: {
|
|
4
|
-
// changed properties: 'never' to properties: 'always' ; true to 'ignoreDestructuring': false
|
|
5
|
-
// http://eslint.org/docs/rules/camelcase
|
|
6
|
-
camelcase: ["error", { properties: "always", ignoreDestructuring: false }],
|
|
7
|
-
|
|
8
|
-
// http://eslint.org/docs/rules/object-shorthand
|
|
9
|
-
"object-shorthand": ["error", "always"],
|
|
10
|
-
|
|
11
|
-
// https://github.com/prettier/eslint-config-prettier#curly
|
|
12
|
-
// prettier doesn't enforce {} with multiline
|
|
13
|
-
curly: ["warn", "multi-line"],
|
|
14
|
-
|
|
15
|
-
// https://eslint.org/docs/latest/rules/sort-imports ; declaration is sorted using import/order
|
|
16
|
-
"sort-imports": ["error", { ignoreDeclarationSort: true }],
|
|
17
|
-
|
|
18
|
-
/* disabled rules */
|
|
19
|
-
|
|
20
|
-
// http://eslint.org/docs/rules/no-else-return
|
|
21
|
-
"no-else-return": "off",
|
|
22
|
-
|
|
23
|
-
// http://eslint.org/docs/rules/arrow-body-style
|
|
24
|
-
"arrow-body-style": "off",
|
|
25
|
-
},
|
|
26
|
-
};
|