@qlik/eslint-config 0.8.2 → 1.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.
Files changed (45) hide show
  1. package/README.md +137 -80
  2. package/package.json +33 -39
  3. package/src/configs/cjs.js +45 -0
  4. package/src/configs/esm.js +43 -0
  5. package/src/configs/jest.js +24 -0
  6. package/src/configs/playwright.js +19 -0
  7. package/src/configs/react.js +75 -0
  8. package/src/configs/recommended.js +64 -0
  9. package/src/configs/rules/eslint-core.js +970 -0
  10. package/src/configs/rules/import-x.js +159 -0
  11. package/src/configs/rules/index.js +17 -0
  12. package/src/configs/rules/node.js +10 -0
  13. package/src/configs/rules/react-a11y.js +232 -0
  14. package/src/configs/rules/react-hooks.js +16 -0
  15. package/src/configs/rules/react.js +479 -0
  16. package/src/configs/rules/svelte.js +11 -0
  17. package/src/configs/rules/testing-library.js +74 -0
  18. package/src/configs/rules/typescript.js +228 -0
  19. package/src/configs/svelte.js +48 -0
  20. package/src/configs/vitest.js +36 -0
  21. package/src/index.d.ts +24 -0
  22. package/src/index.js +29 -0
  23. package/src/types/index.ts +52 -0
  24. package/src/utils/compose.js +62 -0
  25. package/src/utils/config.js +22 -0
  26. package/src/utils/merge.js +28 -0
  27. package/configs/airbnb-base-mod.js +0 -77
  28. package/configs/airbnb-mod.js +0 -17
  29. package/configs/airbnb-ts-base-mod.js +0 -37
  30. package/configs/airbnb-ts-mod.js +0 -17
  31. package/configs/env.js +0 -11
  32. package/esm.js +0 -6
  33. package/index.js +0 -10
  34. package/jest.js +0 -25
  35. package/node.js +0 -10
  36. package/overrides/react.js +0 -27
  37. package/overrides/sveltejs.js +0 -25
  38. package/overrides/sveltets.js +0 -32
  39. package/overrides/ts.js +0 -23
  40. package/playwright.js +0 -12
  41. package/react-svelte.js +0 -6
  42. package/react.js +0 -3
  43. package/svelte-js.js +0 -6
  44. package/svelte.js +0 -6
  45. package/vitest.js +0 -13
@@ -0,0 +1,970 @@
1
+ // @ts-check
2
+ import confusingBrowserGlobals from "confusing-browser-globals";
3
+
4
+ /**
5
+ * @satisfies {import("../../types/index.js").ESLintFlatConfig["rules"]}
6
+ *
7
+ * eslint core package https://eslint.org/docs/latest/rules/
8
+ */
9
+ const rules = {
10
+ // modify/add rules from eslint core package here additionally to the recommended rules
11
+
12
+ // enforces return statements in callbacks of array's methods
13
+ // https://eslint.org/docs/rules/array-callback-return
14
+ "array-callback-return": ["error", { allowImplicit: true }],
15
+
16
+ // treat var statements as if they were block scoped
17
+ // https://eslint.org/docs/rules/block-scoped-var
18
+ "block-scoped-var": "error",
19
+
20
+ // enforce that class methods use "this"
21
+ // https://eslint.org/docs/rules/class-methods-use-this
22
+ "class-methods-use-this": [
23
+ "warn",
24
+ {
25
+ exceptMethods: [],
26
+ },
27
+ ],
28
+
29
+ // require return statements to either always or never specify values
30
+ // https://eslint.org/docs/rules/consistent-return
31
+ "consistent-return": "error",
32
+
33
+ // specify curly brace conventions for all control statements
34
+ // https://eslint.org/docs/rules/curly
35
+ curly: ["error", "multi-line"], // multiline
36
+
37
+ // require default case in switch statements
38
+ // https://eslint.org/docs/rules/default-case
39
+ "default-case": ["error", { commentPattern: "^no default$" }],
40
+
41
+ // Enforce default clauses in switch statements to be last
42
+ // https://eslint.org/docs/rules/default-case-last
43
+ "default-case-last": "error",
44
+
45
+ // https://eslint.org/docs/rules/default-param-last
46
+ "default-param-last": "error",
47
+
48
+ // DEPRECATED. enforces consistent newlines before or after dots
49
+ // https://eslint.org/docs/rules/dot-location
50
+ // "dot-location": ["error", "property"],
51
+
52
+ // require the use of === and !==
53
+ // https://eslint.org/docs/rules/eqeqeq
54
+ eqeqeq: ["error", "always", { null: "ignore" }],
55
+
56
+ // Require grouped accessor pairs in object literals and classes
57
+ // https://eslint.org/docs/rules/grouped-accessor-pairs
58
+ "grouped-accessor-pairs": "error",
59
+
60
+ // enforce a maximum number of classes per file
61
+ // https://eslint.org/docs/rules/max-classes-per-file
62
+ "max-classes-per-file": ["error", 1],
63
+
64
+ // disallow the use of alert, confirm, and prompt
65
+ // https://eslint.org/docs/rules/no-alert
66
+ "no-alert": "error",
67
+
68
+ // disallow use of arguments.caller or arguments.callee
69
+ // https://eslint.org/docs/rules/no-caller
70
+ "no-caller": "error",
71
+
72
+ // disallow lexical declarations in case/default clauses
73
+ // https://eslint.org/docs/rules/no-case-declarations
74
+ "no-case-declarations": "error",
75
+
76
+ // Disallow returning value in constructor
77
+ // https://eslint.org/docs/rules/no-constructor-return
78
+ "no-constructor-return": "error",
79
+
80
+ // disallow else after a return in an if
81
+ // https://eslint.org/docs/rules/no-else-return
82
+ "no-else-return": ["error", { allowElseIf: false }],
83
+
84
+ // disallow empty functions, except for standalone funcs/arrows
85
+ // https://eslint.org/docs/rules/no-empty-function
86
+ "no-empty-function": [
87
+ "error",
88
+ {
89
+ allow: ["arrowFunctions", "functions", "methods"],
90
+ },
91
+ ],
92
+
93
+ // disallow empty destructuring patterns
94
+ // https://eslint.org/docs/rules/no-empty-pattern
95
+ "no-empty-pattern": "error",
96
+
97
+ // disallow use of eval()
98
+ // https://eslint.org/docs/rules/no-eval
99
+ "no-eval": "error",
100
+
101
+ // disallow adding to native types
102
+ // https://eslint.org/docs/rules/no-extend-native
103
+ "no-extend-native": "error",
104
+
105
+ // disallow unnecessary function binding
106
+ // https://eslint.org/docs/rules/no-extra-bind
107
+ "no-extra-bind": "error",
108
+
109
+ // disallow Unnecessary Labels
110
+ // https://eslint.org/docs/rules/no-extra-label
111
+ "no-extra-label": "error",
112
+
113
+ // disallow fallthrough of case statements
114
+ // https://eslint.org/docs/rules/no-fallthrough
115
+ "no-fallthrough": "error",
116
+
117
+ // DEPRECATED. disallow the use of leading or trailing decimal points in numeric literals
118
+ // https://eslint.org/docs/rules/no-floating-decimal
119
+ // "no-floating-decimal": "error",
120
+
121
+ // disallow reassignments of native objects or read-only globals
122
+ // https://eslint.org/docs/rules/no-global-assign
123
+ "no-global-assign": ["error", { exceptions: [] }],
124
+
125
+ // disallow use of eval()-like methods
126
+ // https://eslint.org/docs/rules/no-implied-eval
127
+ "no-implied-eval": "error",
128
+
129
+ // disallow usage of __iterator__ property
130
+ // https://eslint.org/docs/rules/no-iterator
131
+ "no-iterator": "error",
132
+
133
+ // disallow use of labels for anything other than loops and switches
134
+ // https://eslint.org/docs/rules/no-labels
135
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
136
+
137
+ // disallow unnecessary nested blocks
138
+ // https://eslint.org/docs/rules/no-lone-blocks
139
+ "no-lone-blocks": "error",
140
+
141
+ // disallow creation of functions within loops
142
+ // https://eslint.org/docs/rules/no-loop-func
143
+ "no-loop-func": "error",
144
+
145
+ // don't use magic numbers
146
+ // https://eslint.org/docs/rules/no-magic-numbers
147
+ "no-magic-numbers": "off",
148
+
149
+ // DEPRECATED. disallow use of multiple spaces
150
+ // https://eslint.org/docs/rules/no-multi-spaces
151
+ // "no-multi-spaces": [
152
+ // "error",
153
+ // {
154
+ // ignoreEOLComments: false,
155
+ // },
156
+ // ],
157
+
158
+ // disallow use of multiline strings
159
+ // https://eslint.org/docs/rules/no-multi-str
160
+ "no-multi-str": "error",
161
+
162
+ // disallow use of new operator when not part of the assignment or comparison
163
+ // https://eslint.org/docs/rules/no-new
164
+ "no-new": "error",
165
+
166
+ // disallow use of new operator for Function object
167
+ // https://eslint.org/docs/rules/no-new-func
168
+ "no-new-func": "error",
169
+
170
+ // disallows creating new instances of String, Number, and Boolean
171
+ // https://eslint.org/docs/rules/no-new-wrappers
172
+ "no-new-wrappers": "error",
173
+
174
+ // Disallow \8 and \9 escape sequences in string literals
175
+ // https://eslint.org/docs/rules/no-nonoctal-decimal-escape
176
+ "no-nonoctal-decimal-escape": "error",
177
+
178
+ // Disallow calls to the Object constructor without an argument
179
+ // https://eslint.org/docs/latest/rules/no-object-constructor
180
+ "no-object-constructor": "error",
181
+
182
+ // disallow use of (old style) octal literals
183
+ // https://eslint.org/docs/rules/no-octal
184
+ "no-octal": "error",
185
+
186
+ // disallow use of octal escape sequences in string literals, such as
187
+ // var foo = 'Copyright \251';
188
+ // https://eslint.org/docs/rules/no-octal-escape
189
+ "no-octal-escape": "error",
190
+
191
+ // disallow reassignment of function parameters
192
+ // disallow parameter object manipulation except for specific exclusions
193
+ // rule: https://eslint.org/docs/rules/no-param-reassign.html
194
+ "no-param-reassign": [
195
+ "error",
196
+ {
197
+ props: true,
198
+ ignorePropertyModificationsFor: [
199
+ "prev", // for reduce accumulators
200
+ "acc", // for reduce accumulators
201
+ "accumulator", // for reduce accumulators
202
+ "e", // for e.returnvalue
203
+ "ctx", // for Koa routing
204
+ "context", // for Koa routing
205
+ "req", // for Express requests
206
+ "request", // for Express requests
207
+ "res", // for Express responses
208
+ "response", // for Express responses
209
+ "$scope", // for Angular 1 scopes
210
+ "staticContext", // for ReactRouter context
211
+ ],
212
+ },
213
+ ],
214
+
215
+ // disallow usage of __proto__ property
216
+ // https://eslint.org/docs/rules/no-proto
217
+ "no-proto": "error",
218
+
219
+ // disallow declaring the same variable more than once
220
+ // https://eslint.org/docs/rules/no-redeclare
221
+ "no-redeclare": "error",
222
+
223
+ // disallow certain object properties
224
+ // https://eslint.org/docs/rules/no-restricted-properties
225
+ "no-restricted-properties": [
226
+ "error",
227
+ {
228
+ object: "arguments",
229
+ property: "callee",
230
+ message: "arguments.callee is deprecated",
231
+ },
232
+ {
233
+ object: "global",
234
+ property: "isFinite",
235
+ message: "Please use Number.isFinite instead",
236
+ },
237
+ {
238
+ object: "self",
239
+ property: "isFinite",
240
+ message: "Please use Number.isFinite instead",
241
+ },
242
+ {
243
+ object: "window",
244
+ property: "isFinite",
245
+ message: "Please use Number.isFinite instead",
246
+ },
247
+ {
248
+ object: "global",
249
+ property: "isNaN",
250
+ message: "Please use Number.isNaN instead",
251
+ },
252
+ {
253
+ object: "self",
254
+ property: "isNaN",
255
+ message: "Please use Number.isNaN instead",
256
+ },
257
+ {
258
+ object: "window",
259
+ property: "isNaN",
260
+ message: "Please use Number.isNaN instead",
261
+ },
262
+ {
263
+ property: "__defineGetter__",
264
+ message: "Please use Object.defineProperty instead.",
265
+ },
266
+ {
267
+ property: "__defineSetter__",
268
+ message: "Please use Object.defineProperty instead.",
269
+ },
270
+ {
271
+ object: "Math",
272
+ property: "pow",
273
+ message: "Use the exponentiation operator (**) instead.",
274
+ },
275
+ ],
276
+
277
+ // disallow use of assignment in return statement
278
+ // https://eslint.org/docs/rules/no-return-assign
279
+ "no-return-assign": ["error", "always"],
280
+
281
+ // DEPRECATED. disallow redundant `return await`
282
+ // https://eslint.org/docs/rules/no-return-await
283
+ // "no-return-await": "error",
284
+
285
+ // disallow use of `javascript:` urls.
286
+ // https://eslint.org/docs/rules/no-script-url
287
+ "no-script-url": "error",
288
+
289
+ // disallow self assignment
290
+ // https://eslint.org/docs/rules/no-self-assign
291
+ "no-self-assign": [
292
+ "error",
293
+ {
294
+ props: true,
295
+ },
296
+ ],
297
+
298
+ // disallow comparisons where both sides are exactly the same
299
+ // https://eslint.org/docs/rules/no-self-compare
300
+ "no-self-compare": "error",
301
+
302
+ // disallow use of comma operator
303
+ // https://eslint.org/docs/rules/no-sequences
304
+ "no-sequences": "error",
305
+
306
+ // restrict what can be thrown as an exception
307
+ // https://eslint.org/docs/rules/no-throw-literal
308
+ "no-throw-literal": "error",
309
+
310
+ // disallow unmodified conditions of loops
311
+ // https://eslint.org/docs/rules/no-unmodified-loop-condition
312
+ "no-unmodified-loop-condition": "error",
313
+
314
+ // disallow usage of expressions in statement position
315
+ // https://eslint.org/docs/rules/no-unused-expressions
316
+ "no-unused-expressions": [
317
+ "error",
318
+ {
319
+ allowShortCircuit: false,
320
+ allowTernary: false,
321
+ allowTaggedTemplates: false,
322
+ },
323
+ ],
324
+
325
+ // disallow unused labels
326
+ // https://eslint.org/docs/rules/no-unused-labels
327
+ "no-unused-labels": "error",
328
+
329
+ // disallow unnecessary .call() and .apply()
330
+ // https://eslint.org/docs/rules/no-useless-call
331
+ "no-useless-call": "error",
332
+
333
+ // Disallow unnecessary catch clauses
334
+ // https://eslint.org/docs/rules/no-useless-catch
335
+ "no-useless-catch": "error",
336
+
337
+ // disallow useless string concatenation
338
+ // https://eslint.org/docs/rules/no-useless-concat
339
+ "no-useless-concat": "error",
340
+
341
+ // disallow unnecessary string escaping
342
+ // https://eslint.org/docs/rules/no-useless-escape
343
+ "no-useless-escape": "error",
344
+
345
+ // disallow redundant return; keywords
346
+ // https://eslint.org/docs/rules/no-useless-return
347
+ "no-useless-return": "error",
348
+
349
+ // disallow use of the with statement
350
+ // https://eslint.org/docs/rules/no-with
351
+ "no-with": "error",
352
+
353
+ // require using Error objects as Promise rejection reasons
354
+ // https://eslint.org/docs/rules/prefer-promise-reject-errors
355
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
356
+
357
+ // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
358
+ // https://eslint.org/docs/rules/prefer-object-has-own
359
+ "prefer-object-has-own": "error",
360
+
361
+ // https://eslint.org/docs/rules/prefer-regex-literals
362
+ "prefer-regex-literals": [
363
+ "error",
364
+ {
365
+ disallowRedundantWrapping: true,
366
+ },
367
+ ],
368
+
369
+ // require use of the second argument for parseInt()
370
+ // https://eslint.org/docs/rules/radix
371
+ radix: "error",
372
+
373
+ // DEPRECATED. require immediate function invocation to be wrapped in parentheses
374
+ // https://eslint.org/docs/rules/wrap-iife.html
375
+ // "wrap-iife": ["error", "outside", { functionPrototypeMethods: false }],
376
+
377
+ // require or disallow Yoda conditions
378
+ // https://eslint.org/docs/rules/yoda
379
+ yoda: "error",
380
+
381
+ // Enforce “for” loop update clause moving the counter in the right direction
382
+ // https://eslint.org/docs/rules/for-direction
383
+ "for-direction": "error",
384
+
385
+ // Enforces that a return statement is present in property getters
386
+ // https://eslint.org/docs/rules/getter-return
387
+ "getter-return": ["error", { allowImplicit: true }],
388
+
389
+ // disallow using an async function as a Promise executor
390
+ // https://eslint.org/docs/rules/no-async-promise-executor
391
+ "no-async-promise-executor": "error",
392
+
393
+ // Disallow await inside of loops
394
+ // https://eslint.org/docs/rules/no-await-in-loop
395
+ "no-await-in-loop": "error",
396
+
397
+ // Disallow comparisons to negative zero
398
+ // https://eslint.org/docs/rules/no-compare-neg-zero
399
+ "no-compare-neg-zero": "error",
400
+
401
+ // disallow assignment in conditional expressions
402
+ "no-cond-assign": ["error", "always"],
403
+
404
+ // disallow use of console
405
+ "no-console": "warn",
406
+
407
+ // Disallows expressions where the operation doesn't affect the value
408
+ // https://eslint.org/docs/rules/no-constant-binary-expression
409
+ "no-constant-binary-expression": "error",
410
+
411
+ // disallow use of constant expressions in conditions
412
+ "no-constant-condition": "warn",
413
+
414
+ // disallow control characters in regular expressions
415
+ "no-control-regex": "error",
416
+
417
+ // disallow use of debugger
418
+ "no-debugger": "error",
419
+
420
+ // disallow duplicate arguments in functions
421
+ "no-dupe-args": "error",
422
+
423
+ // Disallow duplicate conditions in if-else-if chains
424
+ // https://eslint.org/docs/rules/no-dupe-else-if
425
+ "no-dupe-else-if": "error",
426
+
427
+ // disallow duplicate keys when creating object literals
428
+ "no-dupe-keys": "error",
429
+
430
+ // disallow a duplicate case label.
431
+ "no-duplicate-case": "error",
432
+
433
+ // disallow empty statements
434
+ "no-empty": "error",
435
+
436
+ // disallow the use of empty character classes in regular expressions
437
+ "no-empty-character-class": "error",
438
+
439
+ // disallow assigning to the exception in a catch block
440
+ "no-ex-assign": "error",
441
+
442
+ // disallow double-negation boolean casts in a boolean context
443
+ // https://eslint.org/docs/rules/no-extra-boolean-cast
444
+ "no-extra-boolean-cast": "error",
445
+
446
+ // DEPRECATED. disallow unnecessary semicolons
447
+ // "no-extra-semi": "error",
448
+
449
+ // disallow overwriting functions written as function declarations
450
+ "no-func-assign": "error",
451
+
452
+ // https://eslint.org/docs/rules/no-import-assign
453
+ "no-import-assign": "error",
454
+
455
+ // disallow function or variable declarations in nested blocks
456
+ "no-inner-declarations": "error",
457
+
458
+ // disallow invalid regular expression strings in the RegExp constructor
459
+ "no-invalid-regexp": "error",
460
+
461
+ // disallow irregular whitespace outside of strings and comments
462
+ "no-irregular-whitespace": "error",
463
+
464
+ // Disallow Number Literals That Lose Precision
465
+ // https://eslint.org/docs/rules/no-loss-of-precision
466
+ "no-loss-of-precision": "error",
467
+
468
+ // Disallow characters which are made with multiple code points in character class syntax
469
+ // https://eslint.org/docs/rules/no-misleading-character-class
470
+ "no-misleading-character-class": "error",
471
+
472
+ // disallow the use of object properties of the global object (Math and JSON) as functions
473
+ "no-obj-calls": "error",
474
+
475
+ // Disallow new operators with global non-constructor functions
476
+ // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
477
+ "no-new-native-nonconstructor": "error",
478
+
479
+ // Disallow returning values from Promise executor functions
480
+ // https://eslint.org/docs/rules/no-promise-executor-return
481
+ "no-promise-executor-return": "error",
482
+
483
+ // disallow use of Object.prototypes builtins directly
484
+ // https://eslint.org/docs/rules/no-prototype-builtins
485
+ "no-prototype-builtins": "error",
486
+
487
+ // disallow multiple spaces in a regular expression literal
488
+ "no-regex-spaces": "error",
489
+
490
+ // Disallow returning values from setters
491
+ // https://eslint.org/docs/rules/no-setter-return
492
+ "no-setter-return": "error",
493
+
494
+ // disallow sparse arrays
495
+ "no-sparse-arrays": "error",
496
+
497
+ // Disallow template literal placeholder syntax in regular strings
498
+ // https://eslint.org/docs/rules/no-template-curly-in-string
499
+ "no-template-curly-in-string": "error",
500
+
501
+ // Avoid code that looks like two expressions but is actually one
502
+ // https://eslint.org/docs/rules/no-unexpected-multiline
503
+ "no-unexpected-multiline": "error",
504
+
505
+ // disallow unreachable statements after a return, throw, continue, or break statement
506
+ "no-unreachable": "error",
507
+
508
+ // Disallow loops with a body that allows only one iteration
509
+ // https://eslint.org/docs/rules/no-unreachable-loop
510
+ "no-unreachable-loop": [
511
+ "error",
512
+ {
513
+ ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
514
+ },
515
+ ],
516
+
517
+ // disallow return/throw/break/continue inside finally blocks
518
+ // https://eslint.org/docs/rules/no-unsafe-finally
519
+ "no-unsafe-finally": "error",
520
+
521
+ // disallow negating the left operand of relational operators
522
+ // https://eslint.org/docs/rules/no-unsafe-negation
523
+ "no-unsafe-negation": "error",
524
+
525
+ // disallow use of optional chaining in contexts where the undefined value is not allowed
526
+ // https://eslint.org/docs/rules/no-unsafe-optional-chaining
527
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
528
+
529
+ // Disallow Unused Private Class Members
530
+ // https://eslint.org/docs/rules/no-unused-private-class-members
531
+ "no-unused-private-class-members": "error",
532
+
533
+ // Disallow useless backreferences in regular expressions
534
+ // https://eslint.org/docs/rules/no-useless-backreference
535
+ "no-useless-backreference": "error",
536
+
537
+ // Disallow assignments that can lead to race conditions due to usage of await or yield
538
+ // https://eslint.org/docs/rules/require-atomic-updates
539
+ // note: not enabled because it is very buggy
540
+ "require-atomic-updates": "error",
541
+
542
+ // disallow comparisons with the value NaN
543
+ "use-isnan": "error",
544
+
545
+ // ensure that the results of typeof are compared against a valid string
546
+ // https://eslint.org/docs/rules/valid-typeof
547
+ "valid-typeof": ["error", { requireStringLiterals: true }],
548
+
549
+ // enforces no braces where they can be omitted
550
+ // https://eslint.org/docs/rules/arrow-body-style
551
+ "arrow-body-style": "off",
552
+
553
+ // DEPRECATED. require parens in arrow function arguments
554
+ // https://eslint.org/docs/rules/arrow-parens
555
+ // "arrow-parens": ["error", "always"],
556
+
557
+ // DEPREACTED. require space before/after arrow function's arrow
558
+ // https://eslint.org/docs/rules/arrow-spacing
559
+ // "arrow-spacing": ["error", { before: true, after: true }],
560
+
561
+ // verify super() callings in constructors
562
+ "constructor-super": "error",
563
+
564
+ // DEPREACTED. enforce the spacing around the * in generator functions
565
+ // https://eslint.org/docs/rules/generator-star-spacing
566
+ // "generator-star-spacing": ["error", { before: false, after: true }],
567
+
568
+ // disallow modifying variables of class declarations
569
+ // https://eslint.org/docs/rules/no-class-assign
570
+ "no-class-assign": "error",
571
+
572
+ // DEPRECATED. disallow arrow functions where they could be confused with comparisons
573
+ // https://eslint.org/docs/rules/no-confusing-arrow
574
+ // "no-confusing-arrow": [
575
+ // "error",
576
+ // {
577
+ // allowParens: true,
578
+ // },
579
+ // ],
580
+
581
+ // disallow modifying variables that are declared using const
582
+ "no-const-assign": "error",
583
+
584
+ // disallow duplicate class members
585
+ // https://eslint.org/docs/rules/no-dupe-class-members
586
+ "no-dupe-class-members": "error",
587
+
588
+ // DEPRECATED. disallow symbol constructor
589
+ // https://eslint.org/docs/rules/no-new-symbol
590
+ // "no-new-symbol": "error",
591
+
592
+ // Disallow specified names in exports
593
+ // https://eslint.org/docs/rules/no-restricted-exports
594
+ "no-restricted-exports": [
595
+ "error",
596
+ {
597
+ restrictedNamedExports: [
598
+ "default", // use `export default` to provide a default export
599
+ "then", // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
600
+ ],
601
+ },
602
+ ],
603
+
604
+ // disallow specific imports
605
+ // https://eslint.org/docs/rules/no-restricted-imports
606
+ "no-restricted-imports": [
607
+ "off",
608
+ {
609
+ paths: [],
610
+ patterns: [],
611
+ },
612
+ ],
613
+
614
+ // disallow to use this/super before super() calling in constructors.
615
+ // https://eslint.org/docs/rules/no-this-before-super
616
+ "no-this-before-super": "error",
617
+
618
+ // disallow useless computed property keys
619
+ // https://eslint.org/docs/rules/no-useless-computed-key
620
+ "no-useless-computed-key": "error",
621
+
622
+ // disallow unnecessary constructor
623
+ // https://eslint.org/docs/rules/no-useless-constructor
624
+ "no-useless-constructor": "error",
625
+
626
+ // disallow renaming import, export, and destructured assignments to the same name
627
+ // https://eslint.org/docs/rules/no-useless-rename
628
+ "no-useless-rename": [
629
+ "error",
630
+ {
631
+ ignoreDestructuring: false,
632
+ ignoreImport: false,
633
+ ignoreExport: false,
634
+ },
635
+ ],
636
+
637
+ // require let or const instead of var
638
+ "no-var": "error",
639
+
640
+ // require method and property shorthand syntax for object literals
641
+ // https://eslint.org/docs/rules/object-shorthand
642
+ "object-shorthand": [
643
+ "error",
644
+ "always",
645
+ {
646
+ ignoreConstructors: false,
647
+ avoidQuotes: true,
648
+ },
649
+ ],
650
+
651
+ // suggest using arrow functions as callbacks
652
+ "prefer-arrow-callback": "off",
653
+
654
+ // suggest using of const declaration for variables that are never modified after declared
655
+ "prefer-const": [
656
+ "error",
657
+ {
658
+ destructuring: "any",
659
+ ignoreReadBeforeAssign: true,
660
+ },
661
+ ],
662
+
663
+ // disallow parseInt() in favor of binary, octal, and hexadecimal literals
664
+ // https://eslint.org/docs/rules/prefer-numeric-literals
665
+ "prefer-numeric-literals": "error",
666
+
667
+ // use rest parameters instead of arguments
668
+ // https://eslint.org/docs/rules/prefer-rest-params
669
+ "prefer-rest-params": "error",
670
+
671
+ // suggest using the spread syntax instead of .apply()
672
+ // https://eslint.org/docs/rules/prefer-spread
673
+ "prefer-spread": "error",
674
+
675
+ // suggest using template literals instead of string concatenation
676
+ // https://eslint.org/docs/rules/prefer-template
677
+ "prefer-template": "error",
678
+
679
+ // disallow generator functions that do not have yield
680
+ // https://eslint.org/docs/rules/require-yield
681
+ "require-yield": "error",
682
+
683
+ // DEPRECATED. enforce spacing between object rest-spread
684
+ // https://eslint.org/docs/rules/rest-spread-spacing
685
+ // "rest-spread-spacing": ["error", "never"],
686
+
687
+ // require a Symbol description
688
+ // https://eslint.org/docs/rules/symbol-description
689
+ "symbol-description": "error",
690
+
691
+ // DEPRECATED. enforce usage of spacing in template strings
692
+ // https://eslint.org/docs/rules/template-curly-spacing
693
+ // "template-curly-spacing": "error",
694
+
695
+ // DEPRECATED. enforce spacing around the * in yield* expressions
696
+ // https://eslint.org/docs/rules/yield-star-spacing
697
+ // "yield-star-spacing": ["error", "after"],
698
+
699
+ // disallow labels that share a name with a variable
700
+ // https://eslint.org/docs/rules/no-label-var
701
+ "no-label-var": "error",
702
+
703
+ // disallow specific globals
704
+ // https://eslint.org/docs/latest/rules/no-restricted-globals
705
+ "no-restricted-globals": [
706
+ "error",
707
+ {
708
+ name: "isFinite",
709
+ message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite",
710
+ },
711
+ {
712
+ name: "isNaN",
713
+ message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan",
714
+ },
715
+ ...confusingBrowserGlobals.map((g) => ({
716
+ name: g,
717
+ message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
718
+ })),
719
+ ],
720
+
721
+ // disallow declaration of variables already declared in the outer scope
722
+ "no-shadow": "error",
723
+
724
+ // disallow shadowing of names such as arguments
725
+ "no-shadow-restricted-names": "error",
726
+
727
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
728
+ "no-undef": "error",
729
+
730
+ // disallow use of undefined when initializing variables
731
+ "no-undef-init": "error",
732
+
733
+ // disallow declaration of variables that are not used in the code
734
+ "no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }],
735
+
736
+ // require camel case names
737
+ camelcase: ["error", { properties: "never", ignoreDestructuring: false }],
738
+
739
+ // DEPRECATED. https://eslint.org/docs/rules/function-call-argument-newline
740
+ // "function-call-argument-newline": ["error", "consistent"],
741
+
742
+ // require function expressions to have a name
743
+ // https://eslint.org/docs/rules/func-names
744
+ "func-names": "warn",
745
+
746
+ // DEPRECATED. require or disallow newlines around directives
747
+ // https://eslint.org/docs/rules/lines-around-directive
748
+ // "lines-around-directive": [
749
+ // "error",
750
+ // {
751
+ // before: "always",
752
+ // after: "always",
753
+ // },
754
+ // ],
755
+
756
+ // DEPRECATED. specify the maximum length of a line in your program
757
+ // https://eslint.org/docs/rules/max-len
758
+ // "max-len": [
759
+ // "error",
760
+ // 100,
761
+ // 2,
762
+ // {
763
+ // ignoreUrls: true,
764
+ // ignoreComments: false,
765
+ // ignoreRegExpLiterals: true,
766
+ // ignoreStrings: true,
767
+ // ignoreTemplateLiterals: true,
768
+ // },
769
+ // ],
770
+
771
+ // require a capital letter for constructors
772
+ "new-cap": [
773
+ "error",
774
+ {
775
+ newIsCap: true,
776
+ newIsCapExceptions: [],
777
+ capIsNew: false,
778
+ capIsNewExceptions: ["Immutable.Map", "Immutable.Set", "Immutable.List"],
779
+ },
780
+ ],
781
+
782
+ // DEPRECATED. disallow the omission of parentheses when invoking a constructor with no arguments
783
+ // https://eslint.org/docs/rules/new-parens
784
+ // "new-parens": "error",
785
+
786
+ // DEPRECATED. enforces new line after each method call in the chain to make it
787
+ // more readable and easy to maintain
788
+ // https://eslint.org/docs/rules/newline-per-chained-call
789
+ // "newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
790
+
791
+ // disallow use of the Array constructor
792
+ "no-array-constructor": "error",
793
+
794
+ // disallow use of bitwise operators
795
+ // https://eslint.org/docs/rules/no-bitwise
796
+ "no-bitwise": "error",
797
+
798
+ // disallow use of the continue statement
799
+ // https://eslint.org/docs/rules/no-continue
800
+ "no-continue": "error",
801
+
802
+ // disallow if as the only statement in an else block
803
+ // https://eslint.org/docs/rules/no-lonely-if
804
+ "no-lonely-if": "error",
805
+
806
+ // DEPRECATED. disallow un-paren'd mixes of different operators
807
+ // https://eslint.org/docs/rules/no-mixed-operators
808
+ // "no-mixed-operators": [
809
+ // "error",
810
+ // {
811
+ // // the list of arithmetic groups disallows mixing `%` and `**`
812
+ // // with other arithmetic operators.
813
+ // groups: [
814
+ // ["%", "**"],
815
+ // ["%", "+"],
816
+ // ["%", "-"],
817
+ // ["%", "*"],
818
+ // ["%", "/"],
819
+ // ["/", "*"],
820
+ // ["&", "|", "<<", ">>", ">>>"],
821
+ // ["==", "!=", "===", "!=="],
822
+ // ["&&", "||"],
823
+ // ],
824
+ // allowSamePrecedence: false,
825
+ // },
826
+ // ],
827
+
828
+ // DEPRECATED. disallow mixed spaces and tabs for indentation
829
+ // "no-mixed-spaces-and-tabs": "error",
830
+
831
+ // disallow use of chained assignment expressions
832
+ // https://eslint.org/docs/rules/no-multi-assign
833
+ "no-multi-assign": ["error"],
834
+
835
+ // DEPRECATED. disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
836
+ // https://eslint.org/docs/rules/no-multiple-empty-lines
837
+ // "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
838
+
839
+ // disallow nested ternary expressions
840
+ "no-nested-ternary": "error",
841
+
842
+ // DEPRECATED. disallow use of the Object constructor
843
+ // "no-new-object": "error",
844
+
845
+ // disallow certain syntax forms
846
+ // https://eslint.org/docs/rules/no-restricted-syntax
847
+ "no-restricted-syntax": [
848
+ "error",
849
+ // {
850
+ // selector: "ForInStatement",
851
+ // message:
852
+ // "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use for..of or Object.{keys,values,entries}, and iterate over the resulting array.",
853
+ // },
854
+ {
855
+ selector: "LabeledStatement",
856
+ message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
857
+ },
858
+ {
859
+ selector: "WithStatement",
860
+ message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
861
+ },
862
+ ],
863
+
864
+ // DEPRECATED. disallow tab characters entirely
865
+ // "no-tabs": "error",
866
+
867
+ // disallow dangling underscores in identifiers
868
+ // https://eslint.org/docs/rules/no-underscore-dangle
869
+ "no-underscore-dangle": [
870
+ "error",
871
+ {
872
+ allow: [],
873
+ allowAfterThis: false,
874
+ allowAfterSuper: false,
875
+ enforceInMethodNames: true,
876
+ },
877
+ ],
878
+
879
+ // disallow the use of Boolean literals in conditional expressions
880
+ // also, prefer `a || b` over `a ? a : b`
881
+ // https://eslint.org/docs/rules/no-unneeded-ternary
882
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
883
+
884
+ // DEPRECATED. disallow whitespace before properties
885
+ // https://eslint.org/docs/rules/no-whitespace-before-property
886
+ // "no-whitespace-before-property": "error",
887
+
888
+ // DEPRECATED. enforce the location of single-line statements
889
+ // https://eslint.org/docs/rules/nonblock-statement-body-position
890
+ // "nonblock-statement-body-position": ["error", "beside", { overrides: {} }],
891
+
892
+ // DEPRECATED. require padding inside curly braces
893
+ // "object-curly-spacing": ["error", "always"],
894
+
895
+ // DEPRECATED. enforce line breaks between braces
896
+ // https://eslint.org/docs/rules/object-curly-newline
897
+ // "object-curly-newline": [
898
+ // "error",
899
+ // {
900
+ // ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
901
+ // ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
902
+ // ImportDeclaration: { minProperties: 4, multiline: true, consistent: true },
903
+ // ExportDeclaration: { minProperties: 4, multiline: true, consistent: true },
904
+ // },
905
+ // ],
906
+
907
+ // DEPRECATED. enforce "same line" or "multiple line" on object properties.
908
+ // https://eslint.org/docs/rules/object-property-newline
909
+ // "object-property-newline": [
910
+ // "error",
911
+ // {
912
+ // allowAllPropertiesOnSameLine: true,
913
+ // },
914
+ // ],
915
+
916
+ // allow just one var statement per function
917
+ // https://eslint.org/docs/rules/one-var
918
+ "one-var": ["error", "never"],
919
+
920
+ // DEPREACTED. require a newline around variable declaration
921
+ // https://eslint.org/docs/rules/one-var-declaration-per-line
922
+ // "one-var-declaration-per-line": ["error", "always"],
923
+
924
+ // require assignment operator shorthand where possible or prohibit it entirely
925
+ // https://eslint.org/docs/rules/operator-assignment
926
+ "operator-assignment": ["error", "always"],
927
+
928
+ // DEPRECATED. Requires operator at the beginning of the line in multiline statements
929
+ // https://eslint.org/docs/rules/operator-linebreak
930
+ // "operator-linebreak": ["error", "before", { overrides: { "=": "none" } }],
931
+
932
+ // Disallow the use of Math.pow in favor of the ** operator
933
+ // https://eslint.org/docs/rules/prefer-exponentiation-operator
934
+ "prefer-exponentiation-operator": "error",
935
+
936
+ // Prefer use of an object spread over Object.assign
937
+ // https://eslint.org/docs/rules/prefer-object-spread
938
+ "prefer-object-spread": "error",
939
+
940
+ // DEPRECATED. require quotes around object literal property names
941
+ // https://eslint.org/docs/rules/quote-props.html
942
+ // "quote-props": ["error", "as-needed", { keywords: false, unnecessary: true, numbers: false }],
943
+
944
+ // DEPRECATED. require or disallow use of semicolons instead of ASI
945
+ // semi: ["error", "always"],
946
+
947
+ // DEPRECATED. require or disallow a space immediately following the // or /* in a comment
948
+ // https://eslint.org/docs/rules/spaced-comment
949
+ // "spaced-comment": [
950
+ // "error",
951
+ // "always",
952
+ // {
953
+ // line: {
954
+ // exceptions: ["-", "+"],
955
+ // markers: ["=", "!", "/"], // space here to support sprockets directives, slash for TS /// comments
956
+ // },
957
+ // block: {
958
+ // exceptions: ["-", "+"],
959
+ // markers: ["=", "!", ":", "::"], // space here to support sprockets directives and flow comment types
960
+ // balanced: true,
961
+ // },
962
+ // },
963
+ // ],
964
+
965
+ // require or disallow the Unicode Byte Order Mark
966
+ // https://eslint.org/docs/rules/unicode-bom
967
+ "unicode-bom": ["error", "never"],
968
+ };
969
+
970
+ export default rules;