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