@rhyster/eslint-config 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 (44) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +7 -0
  3. package/dist/build.config.d.ts +3 -0
  4. package/dist/build.config.d.ts.map +1 -0
  5. package/dist/eslint.config.d.ts +853 -0
  6. package/dist/eslint.config.d.ts.map +1 -0
  7. package/dist/index.cjs +1911 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.cts +3731 -0
  10. package/dist/index.d.mts +3731 -0
  11. package/dist/index.d.ts +3731 -0
  12. package/dist/index.mjs +1898 -0
  13. package/dist/index.mjs.map +1 -0
  14. package/dist/src/airbnb/best-practices.d.ts +177 -0
  15. package/dist/src/airbnb/best-practices.d.ts.map +1 -0
  16. package/dist/src/airbnb/errors.d.ts +69 -0
  17. package/dist/src/airbnb/errors.d.ts.map +1 -0
  18. package/dist/src/airbnb/es6.d.ts +82 -0
  19. package/dist/src/airbnb/es6.d.ts.map +1 -0
  20. package/dist/src/airbnb/imports.d.ts +91 -0
  21. package/dist/src/airbnb/imports.d.ts.map +1 -0
  22. package/dist/src/airbnb/node.d.ts +19 -0
  23. package/dist/src/airbnb/node.d.ts.map +1 -0
  24. package/dist/src/airbnb/strict.d.ts +8 -0
  25. package/dist/src/airbnb/strict.d.ts.map +1 -0
  26. package/dist/src/airbnb/style.d.ts +310 -0
  27. package/dist/src/airbnb/style.d.ts.map +1 -0
  28. package/dist/src/airbnb/variables.d.ts +35 -0
  29. package/dist/src/airbnb/variables.d.ts.map +1 -0
  30. package/dist/src/index.d.ts +3729 -0
  31. package/dist/src/index.d.ts.map +1 -0
  32. package/dist/src/typescript.d.ts +49 -0
  33. package/dist/src/typescript.d.ts.map +1 -0
  34. package/package.json +59 -0
  35. package/src/airbnb/best-practices.ts +477 -0
  36. package/src/airbnb/errors.ts +215 -0
  37. package/src/airbnb/es6.ts +210 -0
  38. package/src/airbnb/imports.ts +288 -0
  39. package/src/airbnb/node.ts +54 -0
  40. package/src/airbnb/strict.ts +9 -0
  41. package/src/airbnb/style.ts +699 -0
  42. package/src/airbnb/variables.ts +74 -0
  43. package/src/index.ts +111 -0
  44. package/src/typescript.ts +90 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,1911 @@
1
+ 'use strict';
2
+
3
+ const stylistic = require('@stylistic/eslint-plugin');
4
+ const importx = require('eslint-plugin-import-x');
5
+ const nodePlugin = require('eslint-plugin-n');
6
+ const globals = require('globals');
7
+ const tseslint = require('typescript-eslint');
8
+ const confusingBrowserGlobals = require('confusing-browser-globals');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
+
12
+ const stylistic__default = /*#__PURE__*/_interopDefaultCompat(stylistic);
13
+ const importx__default = /*#__PURE__*/_interopDefaultCompat(importx);
14
+ const nodePlugin__default = /*#__PURE__*/_interopDefaultCompat(nodePlugin);
15
+ const globals__default = /*#__PURE__*/_interopDefaultCompat(globals);
16
+ const tseslint__default = /*#__PURE__*/_interopDefaultCompat(tseslint);
17
+ const confusingBrowserGlobals__default = /*#__PURE__*/_interopDefaultCompat(confusingBrowserGlobals);
18
+
19
+ const bestPractices = {
20
+ name: "@rhyster/eslint-config/airbnb/best-practices",
21
+ rules: {
22
+ // enforces getter/setter pairs in objects
23
+ // https://eslint.org/docs/rules/accessor-pairs
24
+ "accessor-pairs": "off",
25
+ // enforces return statements in callbacks of array's methods
26
+ // https://eslint.org/docs/rules/array-callback-return
27
+ "array-callback-return": ["error", { allowImplicit: true }],
28
+ // treat var statements as if they were block scoped
29
+ // https://eslint.org/docs/rules/block-scoped-var
30
+ "block-scoped-var": "error",
31
+ // specify the maximum cyclomatic complexity allowed in a program
32
+ // https://eslint.org/docs/rules/complexity
33
+ complexity: ["off", 20],
34
+ // enforce that class methods use "this"
35
+ // https://eslint.org/docs/rules/class-methods-use-this
36
+ "class-methods-use-this": [
37
+ "error",
38
+ {
39
+ exceptMethods: []
40
+ }
41
+ ],
42
+ // require return statements to either always or never specify values
43
+ // https://eslint.org/docs/rules/consistent-return
44
+ "consistent-return": "error",
45
+ // specify curly brace conventions for all control statements
46
+ // https://eslint.org/docs/rules/curly
47
+ curly: ["error", "multi-line"],
48
+ // multiline
49
+ // require default case in switch statements
50
+ // https://eslint.org/docs/rules/default-case
51
+ "default-case": ["error", { commentPattern: "^no default$" }],
52
+ // Enforce default clauses in switch statements to be last
53
+ // https://eslint.org/docs/rules/default-case-last
54
+ "default-case-last": "error",
55
+ // https://eslint.org/docs/rules/default-param-last
56
+ "default-param-last": "error",
57
+ // encourages use of dot notation whenever possible
58
+ // https://eslint.org/docs/rules/dot-notation
59
+ "dot-notation": ["error", { allowKeywords: true }],
60
+ // enforces consistent newlines before or after dots
61
+ // https://eslint.style/rules/default/dot-location
62
+ "@stylistic/dot-location": ["error", "property"],
63
+ // require the use of === and !==
64
+ // https://eslint.org/docs/rules/eqeqeq
65
+ eqeqeq: [
66
+ "error",
67
+ "always",
68
+ { null: "ignore" }
69
+ ],
70
+ // Require grouped accessor pairs in object literals and classes
71
+ // https://eslint.org/docs/rules/grouped-accessor-pairs
72
+ "grouped-accessor-pairs": "error",
73
+ // make sure for-in loops have an if statement
74
+ // https://eslint.org/docs/rules/guard-for-in
75
+ "guard-for-in": "error",
76
+ // enforce a maximum number of classes per file
77
+ // https://eslint.org/docs/rules/max-classes-per-file
78
+ "max-classes-per-file": ["error", 1],
79
+ // disallow the use of alert, confirm, and prompt
80
+ // https://eslint.org/docs/rules/no-alert
81
+ "no-alert": "error",
82
+ // disallow use of arguments.caller or arguments.callee
83
+ // https://eslint.org/docs/rules/no-caller
84
+ "no-caller": "error",
85
+ // disallow lexical declarations in case/default clauses
86
+ // https://eslint.org/docs/rules/no-case-declarations
87
+ "no-case-declarations": "error",
88
+ // Disallow returning value in constructor
89
+ // https://eslint.org/docs/rules/no-constructor-return
90
+ "no-constructor-return": "error",
91
+ // disallow division operators explicitly at beginning of regular expression
92
+ // https://eslint.org/docs/rules/no-div-regex
93
+ "no-div-regex": "off",
94
+ // disallow else after a return in an if
95
+ // https://eslint.org/docs/rules/no-else-return
96
+ "no-else-return": ["error", { allowElseIf: false }],
97
+ // disallow empty functions, except for standalone funcs/arrows
98
+ // https://eslint.org/docs/rules/no-empty-function
99
+ "no-empty-function": [
100
+ "error",
101
+ {
102
+ allow: [
103
+ "arrowFunctions",
104
+ "functions",
105
+ "methods"
106
+ ]
107
+ }
108
+ ],
109
+ // disallow empty destructuring patterns
110
+ // https://eslint.org/docs/rules/no-empty-pattern
111
+ "no-empty-pattern": "error",
112
+ // Disallow empty static blocks
113
+ // https://eslint.org/docs/rules/no-empty-static-block
114
+ "no-empty-static-block": "error",
115
+ // disallow comparisons to null without a type-checking operator
116
+ // https://eslint.org/docs/rules/no-eq-null
117
+ "no-eq-null": "off",
118
+ // disallow use of eval()
119
+ // https://eslint.org/docs/rules/no-eval
120
+ "no-eval": "error",
121
+ // disallow adding to native types
122
+ // https://eslint.org/docs/rules/no-extend-native
123
+ "no-extend-native": "error",
124
+ // disallow unnecessary function binding
125
+ // https://eslint.org/docs/rules/no-extra-bind
126
+ "no-extra-bind": "error",
127
+ // disallow Unnecessary Labels
128
+ // https://eslint.org/docs/rules/no-extra-label
129
+ "no-extra-label": "error",
130
+ // disallow fallthrough of case statements
131
+ // https://eslint.org/docs/rules/no-fallthrough
132
+ "no-fallthrough": "error",
133
+ // disallow the use of leading or trailing decimal points in numeric literals
134
+ // https://eslint.style/rules/default/no-floating-decimal
135
+ "@stylistic/no-floating-decimal": "error",
136
+ // disallow reassignments of native objects or read-only globals
137
+ // https://eslint.org/docs/rules/no-global-assign
138
+ "no-global-assign": ["error", { exceptions: [] }],
139
+ // disallow implicit type conversions
140
+ // https://eslint.org/docs/rules/no-implicit-coercion
141
+ "no-implicit-coercion": [
142
+ "off",
143
+ {
144
+ boolean: false,
145
+ number: true,
146
+ string: true,
147
+ allow: []
148
+ }
149
+ ],
150
+ // disallow var and named functions in global scope
151
+ // https://eslint.org/docs/rules/no-implicit-globals
152
+ "no-implicit-globals": "off",
153
+ // disallow use of eval()-like methods
154
+ // https://eslint.org/docs/rules/no-implied-eval
155
+ "no-implied-eval": "error",
156
+ // disallow this keywords outside of classes or class-like objects
157
+ // https://eslint.org/docs/rules/no-invalid-this
158
+ "no-invalid-this": "off",
159
+ // disallow usage of __iterator__ property
160
+ // https://eslint.org/docs/rules/no-iterator
161
+ "no-iterator": "error",
162
+ // disallow use of labels for anything other than loops and switches
163
+ // https://eslint.org/docs/rules/no-labels
164
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
165
+ // disallow unnecessary nested blocks
166
+ // https://eslint.org/docs/rules/no-lone-blocks
167
+ "no-lone-blocks": "error",
168
+ // disallow creation of functions within loops
169
+ // https://eslint.org/docs/rules/no-loop-func
170
+ "no-loop-func": "error",
171
+ // disallow magic numbers
172
+ // https://eslint.org/docs/rules/no-magic-numbers
173
+ "no-magic-numbers": [
174
+ "off",
175
+ {
176
+ ignore: [],
177
+ ignoreArrayIndexes: true,
178
+ enforceConst: true,
179
+ detectObjects: false
180
+ }
181
+ ],
182
+ // disallow use of multiple spaces
183
+ // https://eslint.style/rules/default/no-multi-spaces
184
+ "@stylistic/no-multi-spaces": [
185
+ "error",
186
+ {
187
+ ignoreEOLComments: false
188
+ }
189
+ ],
190
+ // disallow use of multiline strings
191
+ // https://eslint.org/docs/rules/no-multi-str
192
+ "no-multi-str": "error",
193
+ // disallow use of new operator when not part of the assignment or comparison
194
+ // https://eslint.org/docs/rules/no-new
195
+ "no-new": "error",
196
+ // disallow use of new operator for Function object
197
+ // https://eslint.org/docs/rules/no-new-func
198
+ "no-new-func": "error",
199
+ // disallows creating new instances of String, Number, and Boolean
200
+ // https://eslint.org/docs/rules/no-new-wrappers
201
+ "no-new-wrappers": "error",
202
+ // Disallow \8 and \9 escape sequences in string literals
203
+ // https://eslint.org/docs/rules/no-nonoctal-decimal-escape
204
+ "no-nonoctal-decimal-escape": "error",
205
+ // Disallow calls to the Object constructor without an argument
206
+ // https://eslint.org/docs/rules/no-object-constructor
207
+ "no-object-constructor": "error",
208
+ // disallow use of (old style) octal literals
209
+ // https://eslint.org/docs/rules/no-octal
210
+ "no-octal": "error",
211
+ // disallow use of octal escape sequences in string literals, such as
212
+ // var foo = 'Copyright \251';
213
+ // https://eslint.org/docs/rules/no-octal-escape
214
+ "no-octal-escape": "error",
215
+ // disallow reassignment of function parameters
216
+ // disallow parameter object manipulation except for specific exclusions
217
+ // rule: https://eslint.org/docs/rules/no-param-reassign.html
218
+ "no-param-reassign": [
219
+ "error",
220
+ {
221
+ props: true,
222
+ ignorePropertyModificationsFor: [
223
+ "acc",
224
+ // for reduce accumulators
225
+ "accumulator",
226
+ // for reduce accumulators
227
+ "e",
228
+ // for e.returnvalue
229
+ "ctx",
230
+ // for Koa routing
231
+ "context",
232
+ // for Koa routing
233
+ "req",
234
+ // for Express requests
235
+ "request",
236
+ // for Express requests
237
+ "res",
238
+ // for Express responses
239
+ "response",
240
+ // for Express responses
241
+ "$scope",
242
+ // for Angular 1 scopes
243
+ "staticContext"
244
+ // for ReactRouter context
245
+ ]
246
+ }
247
+ ],
248
+ // disallow usage of __proto__ property
249
+ // https://eslint.org/docs/rules/no-proto
250
+ "no-proto": "error",
251
+ // disallow declaring the same variable more than once
252
+ // https://eslint.org/docs/rules/no-redeclare
253
+ "no-redeclare": "error",
254
+ // disallow certain object properties
255
+ // https://eslint.org/docs/rules/no-restricted-properties
256
+ "no-restricted-properties": [
257
+ "error",
258
+ {
259
+ object: "arguments",
260
+ property: "callee",
261
+ message: "arguments.callee is deprecated"
262
+ },
263
+ {
264
+ object: "global",
265
+ property: "isFinite",
266
+ message: "Please use Number.isFinite instead"
267
+ },
268
+ {
269
+ object: "self",
270
+ property: "isFinite",
271
+ message: "Please use Number.isFinite instead"
272
+ },
273
+ {
274
+ object: "window",
275
+ property: "isFinite",
276
+ message: "Please use Number.isFinite instead"
277
+ },
278
+ {
279
+ object: "global",
280
+ property: "isNaN",
281
+ message: "Please use Number.isNaN instead"
282
+ },
283
+ {
284
+ object: "self",
285
+ property: "isNaN",
286
+ message: "Please use Number.isNaN instead"
287
+ },
288
+ {
289
+ object: "window",
290
+ property: "isNaN",
291
+ message: "Please use Number.isNaN instead"
292
+ },
293
+ {
294
+ property: "__defineGetter__",
295
+ message: "Please use Object.defineProperty instead."
296
+ },
297
+ {
298
+ property: "__defineSetter__",
299
+ message: "Please use Object.defineProperty instead."
300
+ },
301
+ {
302
+ object: "Math",
303
+ property: "pow",
304
+ message: "Use the exponentiation operator (**) instead."
305
+ }
306
+ ],
307
+ // disallow use of assignment in return statement
308
+ // https://eslint.org/docs/rules/no-return-assign
309
+ "no-return-assign": ["error", "always"],
310
+ // disallow redundant `return await`
311
+ // https://eslint.org/docs/rules/no-return-await
312
+ "no-return-await": "error",
313
+ // disallow use of `javascript:` urls.
314
+ // https://eslint.org/docs/rules/no-script-url
315
+ "no-script-url": "error",
316
+ // disallow self assignment
317
+ // https://eslint.org/docs/rules/no-self-assign
318
+ "no-self-assign": [
319
+ "error",
320
+ {
321
+ props: true
322
+ }
323
+ ],
324
+ // disallow comparisons where both sides are exactly the same
325
+ // https://eslint.org/docs/rules/no-self-compare
326
+ "no-self-compare": "error",
327
+ // disallow use of comma operator
328
+ // https://eslint.org/docs/rules/no-sequences
329
+ "no-sequences": "error",
330
+ // restrict what can be thrown as an exception
331
+ // https://eslint.org/docs/rules/no-throw-literal
332
+ "no-throw-literal": "error",
333
+ // disallow unmodified conditions of loops
334
+ // https://eslint.org/docs/rules/no-unmodified-loop-condition
335
+ "no-unmodified-loop-condition": "off",
336
+ // disallow usage of expressions in statement position
337
+ // https://eslint.org/docs/rules/no-unused-expressions
338
+ "no-unused-expressions": [
339
+ "error",
340
+ {
341
+ allowShortCircuit: false,
342
+ allowTernary: false,
343
+ allowTaggedTemplates: false
344
+ }
345
+ ],
346
+ // disallow unused labels
347
+ // https://eslint.org/docs/rules/no-unused-labels
348
+ "no-unused-labels": "error",
349
+ // disallow unnecessary .call() and .apply()
350
+ // https://eslint.org/docs/rules/no-useless-call
351
+ "no-useless-call": "off",
352
+ // Disallow unnecessary catch clauses
353
+ // https://eslint.org/docs/rules/no-useless-catch
354
+ "no-useless-catch": "error",
355
+ // disallow useless string concatenation
356
+ // https://eslint.org/docs/rules/no-useless-concat
357
+ "no-useless-concat": "error",
358
+ // disallow unnecessary string escaping
359
+ // https://eslint.org/docs/rules/no-useless-escape
360
+ "no-useless-escape": "error",
361
+ // disallow redundant return; keywords
362
+ // https://eslint.org/docs/rules/no-useless-return
363
+ "no-useless-return": "error",
364
+ // disallow use of void operator
365
+ // https://eslint.org/docs/rules/no-void
366
+ "no-void": "error",
367
+ // disallow usage of configurable warning terms in comments: e.g. todo
368
+ // https://eslint.org/docs/rules/no-warning-comments
369
+ "no-warning-comments": [
370
+ "off",
371
+ {
372
+ terms: [
373
+ "todo",
374
+ "fixme",
375
+ "xxx"
376
+ ],
377
+ location: "start"
378
+ }
379
+ ],
380
+ // disallow use of the with statement
381
+ // https://eslint.org/docs/rules/no-with
382
+ "no-with": "error",
383
+ // require using Error objects as Promise rejection reasons
384
+ // https://eslint.org/docs/rules/prefer-promise-reject-errors
385
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
386
+ // Suggest using named capture group in regular expression
387
+ // https://eslint.org/docs/rules/prefer-named-capture-group
388
+ "prefer-named-capture-group": "off",
389
+ // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
390
+ // https://eslint.org/docs/rules/prefer-object-has-own
391
+ "prefer-object-has-own": "error",
392
+ // https://eslint.org/docs/rules/prefer-regex-literals
393
+ "prefer-regex-literals": [
394
+ "error",
395
+ {
396
+ disallowRedundantWrapping: true
397
+ }
398
+ ],
399
+ // require use of the second argument for parseInt()
400
+ // https://eslint.org/docs/rules/radix
401
+ radix: "error",
402
+ // require `await` in `async function`
403
+ // (note: this is a horrible rule that should never be used)
404
+ // https://eslint.org/docs/rules/require-await
405
+ "require-await": "off",
406
+ // Enforce the use of u flag on RegExp
407
+ // https://eslint.org/docs/rules/require-unicode-regexp
408
+ "require-unicode-regexp": "off",
409
+ // requires to declare all vars on top of their containing scope
410
+ // https://eslint.org/docs/rules/vars-on-top
411
+ "vars-on-top": "error",
412
+ // require immediate function invocation to be wrapped in parentheses
413
+ // https://eslint.style/rules/default/wrap-iife
414
+ "@stylistic/wrap-iife": [
415
+ "error",
416
+ "outside",
417
+ { functionPrototypeMethods: false }
418
+ ],
419
+ // require or disallow Yoda conditions
420
+ // https://eslint.org/docs/rules/yoda
421
+ yoda: "error"
422
+ }
423
+ };
424
+
425
+ const errors = {
426
+ name: "@rhyster/eslint-config/airbnb/errors",
427
+ rules: {
428
+ // Enforce “for” loop update clause moving the counter in the right direction
429
+ // https://eslint.org/docs/rules/for-direction
430
+ "for-direction": "error",
431
+ // Enforces that a return statement is present in property getters
432
+ // https://eslint.org/docs/rules/getter-return
433
+ "getter-return": ["error", { allowImplicit: true }],
434
+ // disallow using an async function as a Promise executor
435
+ // https://eslint.org/docs/rules/no-async-promise-executor
436
+ "no-async-promise-executor": "error",
437
+ // Disallow await inside of loops
438
+ // https://eslint.org/docs/rules/no-await-in-loop
439
+ "no-await-in-loop": "error",
440
+ // Disallow comparisons to negative zero
441
+ // https://eslint.org/docs/rules/no-compare-neg-zero
442
+ "no-compare-neg-zero": "error",
443
+ // disallow assignment in conditional expressions
444
+ // https://eslint.org/docs/rules/no-cond-assign
445
+ "no-cond-assign": ["error", "always"],
446
+ // disallow use of console
447
+ // https://eslint.org/docs/rules/no-console
448
+ "no-console": [
449
+ "error",
450
+ {
451
+ allow: ["warn", "error"]
452
+ }
453
+ ],
454
+ // Disallows expressions where the operation doesn't affect the value
455
+ // https://eslint.org/docs/rules/no-constant-binary-expression
456
+ "no-constant-binary-expression": "error",
457
+ // disallow use of constant expressions in conditions
458
+ // https://eslint.org/docs/rules/no-constant-condition
459
+ "no-constant-condition": "error",
460
+ // disallow control characters in regular expressions
461
+ // https://eslint.org/docs/rules/no-control-regex
462
+ "no-control-regex": "error",
463
+ // disallow use of debugger
464
+ // https://eslint.org/docs/rules/no-debugger
465
+ "no-debugger": "error",
466
+ // disallow duplicate arguments in functions
467
+ // https://eslint.org/docs/rules/no-dupe-args
468
+ "no-dupe-args": "error",
469
+ // Disallow duplicate conditions in if-else-if chains
470
+ // https://eslint.org/docs/rules/no-dupe-else-if
471
+ "no-dupe-else-if": "error",
472
+ // disallow duplicate keys when creating object literals
473
+ // https://eslint.org/docs/rules/no-dupe-keys
474
+ "no-dupe-keys": "error",
475
+ // disallow a duplicate case label.
476
+ // https://eslint.org/docs/rules/no-duplicate-case
477
+ "no-duplicate-case": "error",
478
+ // disallow empty statements
479
+ // https://eslint.org/docs/rules/no-empty
480
+ "no-empty": "error",
481
+ // disallow the use of empty character classes in regular expressions
482
+ // https://eslint.org/docs/rules/no-empty-character-class
483
+ "no-empty-character-class": "error",
484
+ // disallow assigning to the exception in a catch block
485
+ // https://eslint.org/docs/rules/no-ex-assign
486
+ "no-ex-assign": "error",
487
+ // disallow double-negation boolean casts in a boolean context
488
+ // https://eslint.org/docs/rules/no-extra-boolean-cast
489
+ "no-extra-boolean-cast": "error",
490
+ // disallow unnecessary parentheses
491
+ // https://eslint.style/rules/default/no-extra-parens
492
+ "@stylistic/no-extra-parens": [
493
+ "off",
494
+ "all",
495
+ {
496
+ conditionalAssign: true,
497
+ nestedBinaryExpressions: false,
498
+ returnAssign: false,
499
+ enforceForArrowConditionals: false
500
+ }
501
+ ],
502
+ // disallow unnecessary semicolons
503
+ // https://eslint.style/rules/default/no-extra-semi
504
+ "@stylistic/no-extra-semi": "error",
505
+ // disallow overwriting functions written as function declarations
506
+ // https://eslint.org/docs/rules/no-func-assign
507
+ "no-func-assign": "error",
508
+ // disallow assigning to imported bindings
509
+ // https://eslint.org/docs/rules/no-import-assign
510
+ "no-import-assign": "error",
511
+ // disallow function or variable declarations in nested blocks
512
+ // https://eslint.org/docs/rules/no-inner-declarations
513
+ "no-inner-declarations": "error",
514
+ // disallow invalid regular expression strings in the RegExp constructor
515
+ // https://eslint.org/docs/rules/no-invalid-regexp
516
+ "no-invalid-regexp": "error",
517
+ // disallow irregular whitespace outside of strings and comments
518
+ // https://eslint.org/docs/rules/no-irregular-whitespace
519
+ "no-irregular-whitespace": "error",
520
+ // Disallow Number Literals That Lose Precision
521
+ // https://eslint.org/docs/rules/no-loss-of-precision
522
+ "no-loss-of-precision": "error",
523
+ // Disallow characters which are made with multiple code points in character class syntax
524
+ // https://eslint.org/docs/rules/no-misleading-character-class
525
+ "no-misleading-character-class": "error",
526
+ // disallow the use of object properties of the global object (Math and JSON) as functions
527
+ // https://eslint.org/docs/rules/no-obj-calls
528
+ "no-obj-calls": "error",
529
+ // Disallow new operators with global non-constructor functions
530
+ // https://eslint.org/docs/rules/no-new-native-nonconstructor
531
+ "no-new-native-nonconstructor": "error",
532
+ // Disallow returning values from Promise executor functions
533
+ // https://eslint.org/docs/rules/no-promise-executor-return
534
+ "no-promise-executor-return": "error",
535
+ // disallow use of Object.prototypes builtins directly
536
+ // https://eslint.org/docs/rules/no-prototype-builtins
537
+ "no-prototype-builtins": "error",
538
+ // disallow multiple spaces in a regular expression literal
539
+ // https://eslint.org/docs/rules/no-regex-spaces
540
+ "no-regex-spaces": "error",
541
+ // Disallow returning values from setters
542
+ // https://eslint.org/docs/rules/no-setter-return
543
+ "no-setter-return": "error",
544
+ // disallow sparse arrays
545
+ // https://eslint.org/docs/rules/no-sparse-arrays
546
+ "no-sparse-arrays": "error",
547
+ // Disallow template literal placeholder syntax in regular strings
548
+ // https://eslint.org/docs/rules/no-template-curly-in-string
549
+ "no-template-curly-in-string": "error",
550
+ // Avoid code that looks like two expressions but is actually one
551
+ // https://eslint.org/docs/rules/no-unexpected-multiline
552
+ "no-unexpected-multiline": "error",
553
+ // disallow unreachable statements after a return, throw, continue, or break statement
554
+ // https://eslint.org/docs/rules/no-unreachable
555
+ "no-unreachable": "error",
556
+ // Disallow loops with a body that allows only one iteration
557
+ // https://eslint.org/docs/rules/no-unreachable-loop
558
+ "no-unreachable-loop": [
559
+ "error",
560
+ {
561
+ ignore: []
562
+ // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
563
+ }
564
+ ],
565
+ // disallow return/throw/break/continue inside finally blocks
566
+ // https://eslint.org/docs/rules/no-unsafe-finally
567
+ "no-unsafe-finally": "error",
568
+ // disallow negating the left operand of relational operators
569
+ // https://eslint.org/docs/rules/no-unsafe-negation
570
+ "no-unsafe-negation": "error",
571
+ // disallow use of optional chaining in contexts where the undefined value is not allowed
572
+ // https://eslint.org/docs/rules/no-unsafe-optional-chaining
573
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
574
+ // Disallow Unused Private Class Members
575
+ // https://eslint.org/docs/rules/no-unused-private-class-members
576
+ "no-unused-private-class-members": "error",
577
+ // Disallow useless backreferences in regular expressions
578
+ // https://eslint.org/docs/rules/no-useless-backreference
579
+ "no-useless-backreference": "error",
580
+ // Disallow assignments that can lead to race conditions due to usage of await or yield
581
+ // https://eslint.org/docs/rules/require-atomic-updates
582
+ // note: not enabled because it is very buggy
583
+ "require-atomic-updates": "off",
584
+ // disallow comparisons with the value NaN
585
+ // https://eslint.org/docs/rules/use-isnan
586
+ "use-isnan": "error",
587
+ // ensure that the results of typeof are compared against a valid string
588
+ // https://eslint.org/docs/rules/valid-typeof
589
+ "valid-typeof": ["error", { requireStringLiterals: true }]
590
+ }
591
+ };
592
+
593
+ const es6 = {
594
+ name: "@rhyster/eslint-config/airbnb/es6",
595
+ rules: {
596
+ // enforces no braces where they can be omitted
597
+ // https://eslint.org/docs/rules/arrow-body-style
598
+ "arrow-body-style": [
599
+ "error",
600
+ "as-needed",
601
+ {
602
+ requireReturnForObjectLiteral: false
603
+ }
604
+ ],
605
+ // require parens in arrow function arguments
606
+ // https://eslint.style/rules/default/arrow-parens
607
+ "@stylistic/arrow-parens": ["error", "always"],
608
+ // require space before/after arrow function's arrow
609
+ // https://eslint.style/rules/default/arrow-spacing
610
+ "@stylistic/arrow-spacing": ["error", { before: true, after: true }],
611
+ // verify super() callings in constructors
612
+ // https://eslint.org/docs/rules/constructor-super
613
+ "constructor-super": "error",
614
+ // enforce the spacing around the * in generator functions
615
+ // https://eslint.style/rules/default/generator-star-spacing
616
+ "@stylistic/generator-star-spacing": ["error", { before: false, after: true }],
617
+ // disallow modifying variables of class declarations
618
+ // https://eslint.org/docs/rules/no-class-assign
619
+ "no-class-assign": "error",
620
+ // disallow arrow functions where they could be confused with comparisons
621
+ // https://eslint.style/rules/default/no-confusing-arrow
622
+ "@stylistic/no-confusing-arrow": [
623
+ "error",
624
+ {
625
+ allowParens: true
626
+ }
627
+ ],
628
+ // disallow modifying variables that are declared using const
629
+ // https://eslint.org/docs/rules/no-const-assign
630
+ "no-const-assign": "error",
631
+ // disallow duplicate class members
632
+ // https://eslint.org/docs/rules/no-dupe-class-members
633
+ "no-dupe-class-members": "error",
634
+ // disallow importing from the same path more than once
635
+ // https://eslint.org/docs/rules/no-duplicate-imports
636
+ // replaced by https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
637
+ "no-duplicate-imports": "off",
638
+ // Disallow specified names in exports
639
+ // https://eslint.org/docs/rules/no-restricted-exports
640
+ "no-restricted-exports": [
641
+ "error",
642
+ {
643
+ restrictedNamedExports: [
644
+ "default",
645
+ // use `export default` to provide a default export
646
+ "then"
647
+ // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
648
+ ]
649
+ }
650
+ ],
651
+ // disallow specific imports
652
+ // https://eslint.org/docs/rules/no-restricted-imports
653
+ "no-restricted-imports": [
654
+ "off",
655
+ {
656
+ paths: [],
657
+ patterns: []
658
+ }
659
+ ],
660
+ // disallow to use this/super before super() calling in constructors.
661
+ // https://eslint.org/docs/rules/no-this-before-super
662
+ "no-this-before-super": "error",
663
+ // disallow useless computed property keys
664
+ // https://eslint.org/docs/rules/no-useless-computed-key
665
+ "no-useless-computed-key": "error",
666
+ // disallow unnecessary constructor
667
+ // https://eslint.org/docs/rules/no-useless-constructor
668
+ "no-useless-constructor": "error",
669
+ // disallow renaming import, export, and destructured assignments to the same name
670
+ // https://eslint.org/docs/rules/no-useless-rename
671
+ "no-useless-rename": [
672
+ "error",
673
+ {
674
+ ignoreDestructuring: false,
675
+ ignoreImport: false,
676
+ ignoreExport: false
677
+ }
678
+ ],
679
+ // require let or const instead of var
680
+ // https://eslint.org/docs/rules/no-var
681
+ "no-var": "error",
682
+ // require method and property shorthand syntax for object literals
683
+ // https://eslint.org/docs/rules/object-shorthand
684
+ "object-shorthand": [
685
+ "error",
686
+ "always",
687
+ {
688
+ ignoreConstructors: false,
689
+ avoidQuotes: true
690
+ }
691
+ ],
692
+ // suggest using arrow functions as callbacks
693
+ // https://eslint.org/docs/rules/prefer-arrow-callback
694
+ "prefer-arrow-callback": [
695
+ "error",
696
+ {
697
+ allowNamedFunctions: false,
698
+ allowUnboundThis: true
699
+ }
700
+ ],
701
+ // suggest using of const declaration for variables that are never modified after declared
702
+ // https://eslint.org/docs/rules/prefer-const
703
+ "prefer-const": [
704
+ "error",
705
+ {
706
+ destructuring: "any",
707
+ ignoreReadBeforeAssign: true
708
+ }
709
+ ],
710
+ // Prefer destructuring from arrays and objects
711
+ // https://eslint.org/docs/rules/prefer-destructuring
712
+ "prefer-destructuring": [
713
+ "error",
714
+ {
715
+ VariableDeclarator: {
716
+ array: false,
717
+ object: true
718
+ },
719
+ AssignmentExpression: {
720
+ array: true,
721
+ object: false
722
+ }
723
+ },
724
+ {
725
+ enforceForRenamedProperties: false
726
+ }
727
+ ],
728
+ // disallow parseInt() in favor of binary, octal, and hexadecimal literals
729
+ // https://eslint.org/docs/rules/prefer-numeric-literals
730
+ "prefer-numeric-literals": "error",
731
+ // use rest parameters instead of arguments
732
+ // https://eslint.org/docs/rules/prefer-rest-params
733
+ "prefer-rest-params": "error",
734
+ // suggest using the spread syntax instead of .apply()
735
+ // https://eslint.org/docs/rules/prefer-spread
736
+ "prefer-spread": "error",
737
+ // suggest using template literals instead of string concatenation
738
+ // https://eslint.org/docs/rules/prefer-template
739
+ "prefer-template": "error",
740
+ // disallow generator functions that do not have yield
741
+ // https://eslint.org/docs/rules/require-yield
742
+ "require-yield": "error",
743
+ // enforce spacing between object rest-spread
744
+ // https://eslint.style/rules/default/rest-spread-spacing
745
+ "@stylistic/rest-spread-spacing": ["error", "never"],
746
+ // import sorting
747
+ // https://eslint.org/docs/rules/sort-imports
748
+ "sort-imports": [
749
+ "off",
750
+ {
751
+ ignoreCase: false,
752
+ ignoreDeclarationSort: false,
753
+ ignoreMemberSort: false,
754
+ memberSyntaxSortOrder: [
755
+ "none",
756
+ "all",
757
+ "multiple",
758
+ "single"
759
+ ]
760
+ }
761
+ ],
762
+ // require a Symbol description
763
+ // https://eslint.org/docs/rules/symbol-description
764
+ "symbol-description": "error",
765
+ // enforce usage of spacing in template strings
766
+ // https://eslint.style/rules/default/template-curly-spacing
767
+ "@stylistic/template-curly-spacing": "error",
768
+ // enforce spacing around the * in yield* expressions
769
+ // https://eslint.style/rules/default/yield-star-spacing
770
+ "@stylistic/yield-star-spacing": ["error", "after"]
771
+ }
772
+ };
773
+
774
+ const imports = {
775
+ name: "@rhyster/eslint-config/airbnb/imports",
776
+ rules: {
777
+ // Static analysis:
778
+ // ensure imports point to files/modules that can be resolved
779
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
780
+ "import-x/no-unresolved": [
781
+ "error",
782
+ { commonjs: true, caseSensitive: true }
783
+ ],
784
+ // ensure named imports coupled with named exports
785
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/named.md
786
+ "import-x/named": "error",
787
+ // ensure default import coupled with default export
788
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/default.md
789
+ "import-x/default": "off",
790
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/namespace.md
791
+ "import-x/namespace": "off",
792
+ // Helpful warnings:
793
+ // disallow invalid exports, e.g. multiple defaults
794
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/export.md
795
+ "import-x/export": "error",
796
+ // do not allow a default import name to match a named export
797
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default.md
798
+ "import-x/no-named-as-default": "error",
799
+ // warn on accessing default export property names that are also named exports
800
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default-member.md
801
+ "import-x/no-named-as-default-member": "error",
802
+ // disallow use of jsdoc-marked-deprecated imports
803
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-deprecated.md
804
+ "import-x/no-deprecated": "off",
805
+ // Forbid the use of extraneous packages
806
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
807
+ // paths are treated both as absolute paths, and relative to process.cwd()
808
+ "import-x/no-extraneous-dependencies": [
809
+ "error",
810
+ {
811
+ devDependencies: [
812
+ "test/**",
813
+ // tape, common npm pattern
814
+ "tests/**",
815
+ // also common npm pattern
816
+ "spec/**",
817
+ // mocha, rspec-like pattern
818
+ "**/__tests__/**",
819
+ // jest pattern
820
+ "**/__mocks__/**",
821
+ // jest pattern
822
+ "test.{js,ts}",
823
+ // repos with a single test file
824
+ "test-*.{js,ts}",
825
+ // repos with multiple top-level test files
826
+ "**/*{.,_}{test,spec}.{js,ts}",
827
+ // tests where the extension or filename suffix denotes that it is a test
828
+ "**/jest.config.js",
829
+ // jest config
830
+ "**/jest.setup.js",
831
+ // jest setup
832
+ "**/vue.config.js",
833
+ // vue-cli config
834
+ "**/webpack.config.js",
835
+ // webpack config
836
+ "**/webpack.config.*.js",
837
+ // webpack config
838
+ "**/rollup.config.js",
839
+ // rollup config
840
+ "**/rollup.config.*.js",
841
+ // rollup config
842
+ "**/gulpfile.js",
843
+ // gulp config
844
+ "**/gulpfile.*.js",
845
+ // gulp config
846
+ "**/Gruntfile{,.js}",
847
+ // grunt config
848
+ "**/protractor.conf.js",
849
+ // protractor config
850
+ "**/protractor.conf.*.js",
851
+ // protractor config
852
+ "**/karma.conf.js",
853
+ // karma config
854
+ "**/.eslintrc.js"
855
+ // eslint config
856
+ ],
857
+ optionalDependencies: false
858
+ }
859
+ ],
860
+ // Forbid mutable exports
861
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-mutable-exports.md
862
+ "import-x/no-mutable-exports": "error",
863
+ // Module systems:
864
+ // disallow require()
865
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-commonjs.md
866
+ "import-x/no-commonjs": "error",
867
+ // disallow AMD require/define
868
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-amd.md
869
+ "import-x/no-amd": "error",
870
+ // No Node.js builtin modules
871
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-nodejs-modules.md
872
+ "import-x/no-nodejs-modules": "error",
873
+ // Style guide:
874
+ // disallow non-import statements appearing before import statements
875
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/first.md
876
+ "import-x/first": "error",
877
+ // disallow duplicate imports
878
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
879
+ "import-x/no-duplicates": "error",
880
+ // disallow namespace imports
881
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-namespace.md
882
+ "import-x/no-namespace": "error",
883
+ // Ensure consistent use of file extension within the import path
884
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
885
+ "import-x/extensions": [
886
+ "error",
887
+ "always",
888
+ {
889
+ ignorePackages: true,
890
+ checkTypeImports: true
891
+ }
892
+ ],
893
+ // ensure absolute imports are above relative imports and
894
+ // that unassigned imports are ignored
895
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
896
+ "import-x/order": [
897
+ "error",
898
+ {
899
+ groups: [
900
+ "builtin",
901
+ "external",
902
+ "internal",
903
+ "parent",
904
+ "sibling",
905
+ "index",
906
+ "object",
907
+ "type"
908
+ ],
909
+ "newlines-between": "always",
910
+ alphabetize: {
911
+ order: "asc",
912
+ orderImportKind: "asc"
913
+ }
914
+ }
915
+ ],
916
+ // Require a newline after the last import-x/require in a group
917
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/newline-after-import.md
918
+ "import-x/newline-after-import": "error",
919
+ // Require modules with a single export to use a default export
920
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-default-export.md
921
+ "import-x/prefer-default-export": "error",
922
+ // Restrict which files can be imported in a given folder
923
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-restricted-paths.md
924
+ "import-x/no-restricted-paths": "off",
925
+ // Forbid modules to have too many dependencies
926
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
927
+ "import-x/max-dependencies": ["off", { max: 10 }],
928
+ // Forbid import of modules using absolute paths
929
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-absolute-path.md
930
+ "import-x/no-absolute-path": "error",
931
+ // Forbid require() calls with expressions
932
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-dynamic-require.md
933
+ "import-x/no-dynamic-require": "error",
934
+ // prevent importing the submodules of other modules
935
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-internal-modules.md
936
+ "import-x/no-internal-modules": [
937
+ "off",
938
+ {
939
+ allow: []
940
+ }
941
+ ],
942
+ // Warn if a module could be mistakenly parsed as a script by a consumer
943
+ // leveraging Unambiguous JavaScript Grammar
944
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/unambiguous.md
945
+ // this should not be enabled until this proposal has at least been *presented* to TC39.
946
+ // At the moment, it's not a thing.
947
+ "import-x/unambiguous": "off",
948
+ // Forbid Webpack loader syntax in imports
949
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-webpack-loader-syntax.md
950
+ "import-x/no-webpack-loader-syntax": "error",
951
+ // Prevent unassigned imports
952
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unassigned-import.md
953
+ // importing for side effects is perfectly acceptable, if you need side effects.
954
+ "import-x/no-unassigned-import": "off",
955
+ // Prevent importing the default as if it were named
956
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-default.md
957
+ "import-x/no-named-default": "error",
958
+ // Reports if a module's default export is unnamed
959
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-anonymous-default-export.md
960
+ "import-x/no-anonymous-default-export": [
961
+ "off",
962
+ {
963
+ allowArray: false,
964
+ allowArrowFunction: false,
965
+ allowAnonymousClass: false,
966
+ allowAnonymousFunction: false,
967
+ allowLiteral: false,
968
+ allowObject: false
969
+ }
970
+ ],
971
+ // This rule enforces that all exports are declared at the bottom of the file.
972
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/exports-last.md
973
+ "import-x/exports-last": "error",
974
+ // Reports when named exports are not grouped together in a single export declaration
975
+ // or when multiple assignments to CommonJS module.exports or exports object are present
976
+ // in a single file.
977
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/group-exports.md
978
+ "import-x/group-exports": "off",
979
+ // forbid default exports. this is a terrible rule, do not use it.
980
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-default-export.md
981
+ "import-x/no-default-export": "off",
982
+ // Prohibit named exports. this is a terrible rule, do not use it.
983
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-export.md
984
+ "import-x/no-named-export": "off",
985
+ // Forbid a module from importing itself
986
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-self-import.md
987
+ "import-x/no-self-import": "error",
988
+ // Forbid cyclical dependencies between modules
989
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-cycle.md
990
+ "import-x/no-cycle": ["error", { maxDepth: "\u221E" }],
991
+ // Ensures that there are no useless path segments
992
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
993
+ "import-x/no-useless-path-segments": ["error", { commonjs: true }],
994
+ // dynamic imports require a leading comment with a webpackChunkName
995
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/dynamic-import-chunkname.md
996
+ "import-x/dynamic-import-chunkname": [
997
+ "off",
998
+ {
999
+ importFunctions: [],
1000
+ webpackChunknameFormat: "[0-9a-zA-Z-_/.]+"
1001
+ }
1002
+ ],
1003
+ // Use this rule to prevent imports to folders in relative parent paths.
1004
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-parent-imports.md
1005
+ "import-x/no-relative-parent-imports": "off",
1006
+ // Reports modules without any exports, or with unused exports
1007
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unused-modules.md
1008
+ "import-x/no-unused-modules": [
1009
+ "error",
1010
+ {
1011
+ ignoreExports: [],
1012
+ missingExports: true,
1013
+ unusedExports: true
1014
+ }
1015
+ ],
1016
+ // Reports the use of import declarations with CommonJS exports
1017
+ // in any module except for the main module.
1018
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-import-module-exports.md
1019
+ "import-x/no-import-module-exports": [
1020
+ "error",
1021
+ {
1022
+ exceptions: []
1023
+ }
1024
+ ],
1025
+ // Use this rule to prevent importing packages through relative paths.
1026
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-packages.md
1027
+ "import-x/no-relative-packages": "error",
1028
+ // enforce a consistent style for type specifiers (inline or top-level)
1029
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
1030
+ "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
1031
+ // Reports the use of empty named import blocks.
1032
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-empty-named-blocks.md
1033
+ "import-x/no-empty-named-blocks": "error"
1034
+ }
1035
+ };
1036
+
1037
+ const nodeRules = {
1038
+ name: "@rhyster/eslint-config/airbnb/node",
1039
+ rules: {
1040
+ // enforce return after a callback
1041
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/callback-return.md
1042
+ "n/callback-return": "off",
1043
+ // require all requires be top-level
1044
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md
1045
+ "n/global-require": "error",
1046
+ // enforces error handling in callbacks (node environment)
1047
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/handle-callback-err.md
1048
+ "n/handle-callback-err": "off",
1049
+ // disallow use of the Buffer() constructor
1050
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-deprecated-api.md
1051
+ "n/no-deprecated-api": "error",
1052
+ // disallow mixing regular variable and require declarations
1053
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-mixed-requires.md
1054
+ "n/no-mixed-requires": ["off", false],
1055
+ // disallow use of new operator with the require function
1056
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md
1057
+ "n/no-new-require": "error",
1058
+ // disallow string concatenation with __dirname and __filename
1059
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md
1060
+ "n/no-path-concat": "error",
1061
+ // disallow use of process.env
1062
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-env.md
1063
+ "n/no-process-env": "off",
1064
+ // disallow process.exit()
1065
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
1066
+ "n/no-process-exit": "off",
1067
+ // restrict usage of specified node modules
1068
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-modules.md
1069
+ "n/no-restricted-modules": "off",
1070
+ // disallow use of synchronous methods (off by default)
1071
+ // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-sync.md
1072
+ "n/no-sync": "off",
1073
+ // No Node.js builtin modules
1074
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-nodejs-modules.md
1075
+ "import-x/no-nodejs-modules": "off"
1076
+ }
1077
+ };
1078
+
1079
+ const strict = {
1080
+ name: "@rhyster/eslint-config/airbnb/strict",
1081
+ rules: {
1082
+ // babel inserts `'use strict';` for us
1083
+ strict: ["error", "never"]
1084
+ }
1085
+ };
1086
+
1087
+ const style = {
1088
+ name: "@rhyster/eslint-config/airbnb/style",
1089
+ rules: {
1090
+ // enforce line breaks after opening and before closing array brackets
1091
+ // https://eslint.style/rules/default/array-bracket-newline
1092
+ "@stylistic/array-bracket-newline": ["error", "consistent"],
1093
+ // object option alternative: { multiline: true, minItems: 3 }
1094
+ // enforce line breaks between array elements
1095
+ // https://eslint.style/rules/default/array-element-newline
1096
+ "@stylistic/array-element-newline": ["error", { consistent: true, multiline: true, minItems: 3 }],
1097
+ // enforce spacing inside array brackets
1098
+ // https://eslint.style/rules/default/array-bracket-spacing
1099
+ "@stylistic/array-bracket-spacing": ["error", "never"],
1100
+ // enforce spacing inside single-line blocks
1101
+ // https://eslint.style/rules/default/block-spacing
1102
+ "@stylistic/block-spacing": ["error", "always"],
1103
+ // enforce one true brace style
1104
+ // https://eslint.style/rules/default/brace-style
1105
+ "@stylistic/brace-style": [
1106
+ "error",
1107
+ "1tbs",
1108
+ { allowSingleLine: true }
1109
+ ],
1110
+ // require camel case names
1111
+ // https://eslint.org/docs/rules/camelcase
1112
+ camelcase: "error",
1113
+ // enforce or disallow capitalization of the first letter of a comment
1114
+ // https://eslint.org/docs/rules/capitalized-comments
1115
+ "capitalized-comments": [
1116
+ "off",
1117
+ "never",
1118
+ {
1119
+ line: {
1120
+ ignorePattern: ".*",
1121
+ ignoreInlineComments: true,
1122
+ ignoreConsecutiveComments: true
1123
+ },
1124
+ block: {
1125
+ ignorePattern: ".*",
1126
+ ignoreInlineComments: true,
1127
+ ignoreConsecutiveComments: true
1128
+ }
1129
+ }
1130
+ ],
1131
+ // require trailing commas in multiline object literals
1132
+ // https://eslint.style/rules/default/comma-dangle
1133
+ "@stylistic/comma-dangle": [
1134
+ "error",
1135
+ {
1136
+ arrays: "always-multiline",
1137
+ objects: "always-multiline",
1138
+ imports: "always-multiline",
1139
+ exports: "always-multiline",
1140
+ functions: "always-multiline",
1141
+ enums: "always-multiline",
1142
+ generics: "always-multiline",
1143
+ tuples: "always-multiline"
1144
+ }
1145
+ ],
1146
+ // enforce spacing before and after comma
1147
+ // https://eslint.style/rules/default/comma-spacing
1148
+ "@stylistic/comma-spacing": ["error", { before: false, after: true }],
1149
+ // enforce one true comma style
1150
+ // https://eslint.style/rules/default/comma-style
1151
+ "@stylistic/comma-style": [
1152
+ "error",
1153
+ "last",
1154
+ {
1155
+ exceptions: {
1156
+ ArrayExpression: false,
1157
+ ArrayPattern: false,
1158
+ ArrowFunctionExpression: false,
1159
+ CallExpression: false,
1160
+ FunctionDeclaration: false,
1161
+ FunctionExpression: false,
1162
+ ImportDeclaration: false,
1163
+ ObjectExpression: false,
1164
+ ObjectPattern: false,
1165
+ VariableDeclaration: false,
1166
+ NewExpression: false
1167
+ }
1168
+ }
1169
+ ],
1170
+ // disallow padding inside computed properties
1171
+ // https://eslint.style/rules/default/computed-property-spacing
1172
+ "@stylistic/computed-property-spacing": ["error", "never"],
1173
+ // enforces consistent naming when capturing the current execution context
1174
+ // https://eslint.org/docs/rules/consistent-this
1175
+ "consistent-this": "off",
1176
+ // enforce newline at the end of file, with no multiple empty lines
1177
+ // https://eslint.style/rules/default/eol-last
1178
+ "@stylistic/eol-last": ["error", "always"],
1179
+ // https://eslint.style/rules/default/function-call-argument-newline
1180
+ "@stylistic/function-call-argument-newline": ["error", "consistent"],
1181
+ // enforce spacing between functions and their invocations
1182
+ // https://eslint.style/rules/default/func-call-spacing
1183
+ "@stylistic/func-call-spacing": ["error", "never"],
1184
+ // requires function names to match the name of the variable or property to which they are
1185
+ // assigned
1186
+ // https://eslint.org/docs/rules/func-name-matching
1187
+ "func-name-matching": [
1188
+ "off",
1189
+ "always",
1190
+ {
1191
+ includeCommonJSModuleExports: false,
1192
+ considerPropertyDescriptor: true
1193
+ }
1194
+ ],
1195
+ // require function expressions to have a name
1196
+ // https://eslint.org/docs/rules/func-names
1197
+ "func-names": "error",
1198
+ // enforces use of function declarations or expressions
1199
+ // https://eslint.org/docs/rules/func-style
1200
+ "func-style": ["error", "expression"],
1201
+ // require line breaks inside function parentheses
1202
+ // if there are line breaks between parameters
1203
+ // https://eslint.style/rules/default/function-paren-newline
1204
+ "@stylistic/function-paren-newline": ["error", "multiline-arguments"],
1205
+ // disallow specified identifiers
1206
+ // https://eslint.org/docs/rules/id-denylist
1207
+ "id-denylist": "off",
1208
+ // this option enforces minimum and maximum identifier lengths
1209
+ // (variable names, property names etc.)
1210
+ // https://eslint.org/docs/rules/id-length
1211
+ "id-length": "off",
1212
+ // require identifiers to match the provided regular expression
1213
+ // https://eslint.org/docs/rules/id-match
1214
+ "id-match": "off",
1215
+ // Enforce the location of arrow function bodies with implicit returns
1216
+ // https://eslint.style/rules/default/implicit-arrow-linebreak
1217
+ "@stylistic/implicit-arrow-linebreak": ["error", "beside"],
1218
+ // this option sets a specific tab width for your code
1219
+ // https://eslint.style/rules/default/indent
1220
+ "@stylistic/indent": [
1221
+ "error",
1222
+ 4,
1223
+ {
1224
+ SwitchCase: 1,
1225
+ VariableDeclarator: 1,
1226
+ outerIIFEBody: 1,
1227
+ // MemberExpression: null,
1228
+ FunctionDeclaration: {
1229
+ parameters: 1,
1230
+ body: 1
1231
+ },
1232
+ FunctionExpression: {
1233
+ parameters: 1,
1234
+ body: 1
1235
+ },
1236
+ CallExpression: {
1237
+ arguments: 1
1238
+ },
1239
+ ArrayExpression: 1,
1240
+ ObjectExpression: 1,
1241
+ ImportDeclaration: 1,
1242
+ flatTernaryExpressions: false,
1243
+ ignoreComments: false
1244
+ }
1245
+ ],
1246
+ // specify whether double or single quotes should be used in JSX attributes
1247
+ // https://eslint.style/rules/default/jsx-quotes
1248
+ "@stylistic/jsx-quotes": ["off", "prefer-double"],
1249
+ // enforces spacing between keys and values in object literal properties
1250
+ // https://eslint.style/rules/default/key-spacing
1251
+ "@stylistic/key-spacing": ["error", { beforeColon: false, afterColon: true }],
1252
+ // require a space before & after certain keywords
1253
+ // https://eslint.style/rules/default/keyword-spacing
1254
+ "@stylistic/keyword-spacing": [
1255
+ "error",
1256
+ {
1257
+ before: true,
1258
+ after: true,
1259
+ overrides: {
1260
+ return: { after: true },
1261
+ throw: { after: true },
1262
+ case: { after: true }
1263
+ }
1264
+ }
1265
+ ],
1266
+ // enforce position of line comments
1267
+ // https://eslint.style/rules/default/line-comment-position
1268
+ "@stylistic/line-comment-position": [
1269
+ "off",
1270
+ {
1271
+ position: "above",
1272
+ ignorePattern: "",
1273
+ applyDefaultIgnorePatterns: true
1274
+ }
1275
+ ],
1276
+ // disallow mixed 'LF' and 'CRLF' as linebreaks
1277
+ // https://eslint.style/rules/default/linebreak-style
1278
+ "@stylistic/linebreak-style": ["error", "unix"],
1279
+ // require or disallow an empty line between class members
1280
+ // https://eslint.style/rules/default/lines-between-class-members
1281
+ "@stylistic/lines-between-class-members": [
1282
+ "error",
1283
+ "always",
1284
+ { exceptAfterSingleLine: false }
1285
+ ],
1286
+ // enforces empty lines around comments
1287
+ // https://eslint.style/rules/default/lines-around-comment
1288
+ "@stylistic/lines-around-comment": "off",
1289
+ // Require or disallow logical assignment logical operator shorthand
1290
+ // https://eslint.org/docs/rules/logical-assignment-operators
1291
+ "logical-assignment-operators": [
1292
+ "error",
1293
+ "always",
1294
+ {
1295
+ enforceForIfStatements: true
1296
+ }
1297
+ ],
1298
+ // specify the maximum depth that blocks can be nested
1299
+ // https://eslint.org/docs/rules/max-depth
1300
+ "max-depth": ["off", 4],
1301
+ // specify the maximum length of a line in your program
1302
+ // https://eslint.style/rules/default/max-len
1303
+ "@stylistic/max-len": [
1304
+ "error",
1305
+ 100,
1306
+ 4,
1307
+ {
1308
+ ignoreUrls: true,
1309
+ ignoreComments: false,
1310
+ ignoreRegExpLiterals: true,
1311
+ ignoreStrings: true,
1312
+ ignoreTemplateLiterals: true
1313
+ }
1314
+ ],
1315
+ // specify the max number of lines in a file
1316
+ // https://eslint.org/docs/rules/max-lines
1317
+ "max-lines": [
1318
+ "off",
1319
+ {
1320
+ max: 300,
1321
+ skipBlankLines: true,
1322
+ skipComments: true
1323
+ }
1324
+ ],
1325
+ // enforce a maximum function length
1326
+ // https://eslint.org/docs/rules/max-lines-per-function
1327
+ "max-lines-per-function": [
1328
+ "off",
1329
+ {
1330
+ max: 50,
1331
+ skipBlankLines: true,
1332
+ skipComments: true,
1333
+ IIFEs: true
1334
+ }
1335
+ ],
1336
+ // specify the maximum depth callbacks can be nested
1337
+ // https://eslint.org/docs/rules/max-nested-callbacks
1338
+ "max-nested-callbacks": "off",
1339
+ // limits the number of parameters that can be used in the function declaration.
1340
+ // https://eslint.org/docs/rules/max-params
1341
+ "max-params": ["off", 3],
1342
+ // specify the maximum number of statement allowed in a function
1343
+ // https://eslint.org/docs/rules/max-statements
1344
+ "max-statements": ["off", 10],
1345
+ // restrict the number of statements per line
1346
+ // https://eslint.style/rules/default/max-statements-per-line
1347
+ "@stylistic/max-statements-per-line": ["off", { max: 1 }],
1348
+ // enforce a particular style for multiline comments
1349
+ // https://eslint.style/rules/default/multiline-comment-style
1350
+ "@stylistic/multiline-comment-style": ["off", "starred-block"],
1351
+ // require multiline ternary
1352
+ // https://eslint.style/rules/default/multiline-ternary
1353
+ "@stylistic/multiline-ternary": ["error", "never"],
1354
+ // require a capital letter for constructors
1355
+ // https://eslint.org/docs/rules/new-cap
1356
+ "new-cap": [
1357
+ "error",
1358
+ {
1359
+ newIsCap: true,
1360
+ newIsCapExceptions: [],
1361
+ capIsNew: false,
1362
+ capIsNewExceptions: [
1363
+ "Immutable.Map",
1364
+ "Immutable.Set",
1365
+ "Immutable.List"
1366
+ ]
1367
+ }
1368
+ ],
1369
+ // disallow the omission of parentheses when invoking a constructor with no arguments
1370
+ // https://eslint.style/rules/default/new-parens
1371
+ "@stylistic/new-parens": "error",
1372
+ // enforces new line after each method call in the chain to make it
1373
+ // more readable and easy to maintain
1374
+ // https://eslint.style/rules/default/newline-per-chained-call
1375
+ "@stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
1376
+ // disallow use of the Array constructor
1377
+ // https://eslint.org/docs/rules/no-array-constructor
1378
+ "no-array-constructor": "error",
1379
+ // disallow use of bitwise operators
1380
+ // https://eslint.org/docs/rules/no-bitwise
1381
+ "no-bitwise": "error",
1382
+ // disallow use of the continue statement
1383
+ // https://eslint.org/docs/rules/no-continue
1384
+ "no-continue": "error",
1385
+ // disallow comments inline after code
1386
+ // https://eslint.org/docs/rules/no-inline-comments
1387
+ "no-inline-comments": "off",
1388
+ // disallow if as the only statement in an else block
1389
+ // https://eslint.org/docs/rules/no-lonely-if
1390
+ "no-lonely-if": "error",
1391
+ // disallow un-paren'd mixes of different operators
1392
+ // httphttps://eslint.style/rules/default/no-mixed-operators
1393
+ "@stylistic/no-mixed-operators": [
1394
+ "error",
1395
+ {
1396
+ // the list of arithmetic groups disallows mixing `%` and `**`
1397
+ // with other arithmetic operators.
1398
+ groups: [
1399
+ ["%", "**"],
1400
+ ["%", "+"],
1401
+ ["%", "-"],
1402
+ ["%", "*"],
1403
+ ["%", "/"],
1404
+ ["/", "*"],
1405
+ [
1406
+ "&",
1407
+ "|",
1408
+ "<<",
1409
+ ">>",
1410
+ ">>>"
1411
+ ],
1412
+ [
1413
+ "==",
1414
+ "!=",
1415
+ "===",
1416
+ "!=="
1417
+ ],
1418
+ ["&&", "||"]
1419
+ ],
1420
+ allowSamePrecedence: false
1421
+ }
1422
+ ],
1423
+ // disallow mixed spaces and tabs for indentation
1424
+ // https://eslint.style/rules/default/no-mixed-spaces-and-tabs
1425
+ "@stylistic/no-mixed-spaces-and-tabs": "error",
1426
+ // disallow use of chained assignment expressions
1427
+ // https://eslint.org/docs/rules/no-multi-assign
1428
+ "no-multi-assign": ["error"],
1429
+ // disallow multiple empty lines
1430
+ // only one newline at the end
1431
+ // and no new lines at the beginning
1432
+ // https://eslint.style/rules/default/no-multiple-empty-lines
1433
+ "@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
1434
+ // disallow negated conditions
1435
+ // https://eslint.org/docs/rules/no-negated-condition
1436
+ "no-negated-condition": "off",
1437
+ // disallow nested ternary expressions
1438
+ // https://eslint.org/docs/rules/no-nested-ternary
1439
+ "no-nested-ternary": "error",
1440
+ // disallow calls to the Object constructor without an argument
1441
+ // https://eslint.org/docs/rules/no-object-constructor
1442
+ "no-object-constructor": "error",
1443
+ // disallow use of unary operators, ++ and --
1444
+ // https://eslint.org/docs/rules/no-plusplus
1445
+ "no-plusplus": "error",
1446
+ // disallow certain syntax forms
1447
+ // https://eslint.org/docs/rules/no-restricted-syntax
1448
+ "no-restricted-syntax": [
1449
+ "error",
1450
+ {
1451
+ selector: "ForInStatement",
1452
+ message: "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."
1453
+ },
1454
+ // {
1455
+ // selector: 'ForOfStatement',
1456
+ // message:
1457
+ // 'iterators/generators require regenerator-runtime,
1458
+ // which is too heavyweight for this guide to allow them.
1459
+ // Separately, loops should be avoided in favor of array iterations.',
1460
+ // },
1461
+ {
1462
+ selector: "LabeledStatement",
1463
+ message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
1464
+ },
1465
+ {
1466
+ selector: "WithStatement",
1467
+ message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
1468
+ }
1469
+ ],
1470
+ // disallow tab characters entirely
1471
+ // https://eslint.style/rules/default/no-tabs
1472
+ "@stylistic/no-tabs": "error",
1473
+ // disallow the use of ternary operators
1474
+ // https://eslint.org/docs/rules/no-ternary
1475
+ "no-ternary": "off",
1476
+ // disallow trailing whitespace at the end of lines
1477
+ // https://eslint.style/rules/default/no-trailing-spaces
1478
+ "@stylistic/no-trailing-spaces": [
1479
+ "error",
1480
+ {
1481
+ skipBlankLines: false,
1482
+ ignoreComments: false
1483
+ }
1484
+ ],
1485
+ // disallow dangling underscores in identifiers
1486
+ // https://eslint.org/docs/rules/no-underscore-dangle
1487
+ "no-underscore-dangle": [
1488
+ "error",
1489
+ {
1490
+ allow: [],
1491
+ allowAfterThis: false,
1492
+ allowAfterSuper: false,
1493
+ enforceInMethodNames: true
1494
+ }
1495
+ ],
1496
+ // disallow the use of Boolean literals in conditional expressions
1497
+ // also, prefer `a || b` over `a ? a : b`
1498
+ // https://eslint.org/docs/rules/no-unneeded-ternary
1499
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1500
+ // disallow whitespace before properties
1501
+ // https://eslint.style/rules/default/no-whitespace-before-property
1502
+ "@stylistic/no-whitespace-before-property": "error",
1503
+ // enforce the location of single-line statements
1504
+ // https://eslint.style/rules/default/nonblock-statement-body-position
1505
+ "@stylistic/nonblock-statement-body-position": [
1506
+ "error",
1507
+ "beside",
1508
+ { overrides: {} }
1509
+ ],
1510
+ // require padding inside curly braces
1511
+ // https://eslint.style/rules/default/object-curly-spacing
1512
+ "@stylistic/object-curly-spacing": ["error", "always"],
1513
+ // enforce line breaks between braces
1514
+ // https://eslint.style/rules/default/object-curly-newline
1515
+ "@stylistic/object-curly-newline": [
1516
+ "error",
1517
+ {
1518
+ ObjectExpression: {
1519
+ minProperties: 4,
1520
+ multiline: true,
1521
+ consistent: true
1522
+ },
1523
+ ObjectPattern: {
1524
+ minProperties: 4,
1525
+ multiline: true,
1526
+ consistent: true
1527
+ },
1528
+ ImportDeclaration: {
1529
+ minProperties: 4,
1530
+ multiline: true,
1531
+ consistent: true
1532
+ },
1533
+ ExportDeclaration: {
1534
+ minProperties: 4,
1535
+ multiline: true,
1536
+ consistent: true
1537
+ }
1538
+ }
1539
+ ],
1540
+ // enforce "same line" or "multiple line" on object properties.
1541
+ // https://eslint.style/rules/default/object-property-newline
1542
+ "@stylistic/object-property-newline": [
1543
+ "error",
1544
+ {
1545
+ allowAllPropertiesOnSameLine: true
1546
+ }
1547
+ ],
1548
+ // allow just one var statement per function
1549
+ // https://eslint.org/docs/rules/one-var
1550
+ "one-var": ["error", "never"],
1551
+ // require a newline around variable declaration
1552
+ // https://eslint.style/rules/default/one-var-declaration-per-line
1553
+ "@stylistic/one-var-declaration-per-line": ["error", "always"],
1554
+ // require assignment operator shorthand where possible or prohibit it entirely
1555
+ // https://eslint.org/docs/rules/operator-assignment
1556
+ "operator-assignment": ["error", "always"],
1557
+ // Requires operator at the beginning of the line in multiline statements
1558
+ // https://eslint.style/rules/default/operator-linebreak
1559
+ "@stylistic/operator-linebreak": [
1560
+ "error",
1561
+ "before",
1562
+ { overrides: { "=": "none" } }
1563
+ ],
1564
+ // disallow padding within blocks
1565
+ // https://eslint.style/rules/default/padded-blocks
1566
+ "@stylistic/padded-blocks": [
1567
+ "error",
1568
+ {
1569
+ blocks: "never",
1570
+ classes: "never",
1571
+ switches: "never"
1572
+ },
1573
+ {
1574
+ allowSingleLineBlocks: true
1575
+ }
1576
+ ],
1577
+ // Require or disallow padding lines between statements
1578
+ // https://eslint.style/rules/default/padding-line-between-statements
1579
+ "@stylistic/padding-line-between-statements": "off",
1580
+ // Disallow the use of Math.pow in favor of the ** operator
1581
+ // https://eslint.org/docs/rules/prefer-exponentiation-operator
1582
+ "prefer-exponentiation-operator": "error",
1583
+ // Prefer use of an object spread over Object.assign
1584
+ // https://eslint.org/docs/rules/prefer-object-spread
1585
+ "prefer-object-spread": "error",
1586
+ // require quotes around object literal property names
1587
+ // https://eslint.style/rules/default/quote-props
1588
+ "@stylistic/quote-props": [
1589
+ "error",
1590
+ "as-needed",
1591
+ { keywords: false, unnecessary: true, numbers: false }
1592
+ ],
1593
+ // specify whether double or single quotes should be used
1594
+ // https://eslint.style/rules/default/quotes
1595
+ "@stylistic/quotes": [
1596
+ "error",
1597
+ "single",
1598
+ { avoidEscape: true }
1599
+ ],
1600
+ // require or disallow use of semicolons instead of ASI
1601
+ // https://eslint.style/rules/default/semi
1602
+ "@stylistic/semi": ["error", "always"],
1603
+ // enforce spacing before and after semicolons
1604
+ // https://eslint.style/rules/default/semi-spacing
1605
+ "@stylistic/semi-spacing": ["error", { before: false, after: true }],
1606
+ // Enforce location of semicolons
1607
+ // https://eslint.style/rules/default/semi-style
1608
+ "@stylistic/semi-style": ["error", "last"],
1609
+ // requires object keys to be sorted
1610
+ // https://eslint.org/docs/rules/sort-keys
1611
+ "sort-keys": [
1612
+ "off",
1613
+ "asc",
1614
+ { caseSensitive: false, natural: true }
1615
+ ],
1616
+ // sort variables within the same declaration block
1617
+ // https://eslint.org/docs/rules/sort-vars
1618
+ "sort-vars": "off",
1619
+ // require or disallow space before blocks
1620
+ // https://eslint.style/rules/default/space-before-blocks
1621
+ "@stylistic/space-before-blocks": "error",
1622
+ // require or disallow space before function opening parenthesis
1623
+ // https://eslint.style/rules/default/space-before-function-paren
1624
+ "@stylistic/space-before-function-paren": [
1625
+ "error",
1626
+ {
1627
+ anonymous: "always",
1628
+ named: "never",
1629
+ asyncArrow: "always"
1630
+ }
1631
+ ],
1632
+ // require or disallow spaces inside parentheses
1633
+ // https://eslint.style/rules/default/space-in-parens
1634
+ "@stylistic/space-in-parens": ["error", "never"],
1635
+ // require spaces around operators
1636
+ // https://eslint.style/rules/default/space-infix-ops
1637
+ "@stylistic/space-infix-ops": "error",
1638
+ // Require or disallow spaces before/after unary operators
1639
+ // https://eslint.style/rules/default/space-unary-ops
1640
+ "@stylistic/space-unary-ops": [
1641
+ "error",
1642
+ {
1643
+ words: true,
1644
+ nonwords: false,
1645
+ overrides: {}
1646
+ }
1647
+ ],
1648
+ // require or disallow a space immediately following the // or /* in a comment
1649
+ // https://eslint.style/rules/default/spaced-comment
1650
+ "@stylistic/spaced-comment": [
1651
+ "error",
1652
+ "always",
1653
+ {
1654
+ line: {
1655
+ exceptions: ["-", "+"],
1656
+ markers: [
1657
+ "=",
1658
+ "!",
1659
+ "/"
1660
+ ]
1661
+ // space here to support sprockets directives, slash for TS /// comments
1662
+ },
1663
+ block: {
1664
+ exceptions: ["-", "+"],
1665
+ markers: [
1666
+ "=",
1667
+ "!",
1668
+ ":",
1669
+ "::"
1670
+ ],
1671
+ // space here to support sprockets directives and flow comment types
1672
+ balanced: true
1673
+ }
1674
+ }
1675
+ ],
1676
+ // Enforce spacing around colons of switch statements
1677
+ // https://eslint.style/rules/default/switch-colon-spacing
1678
+ "@stylistic/switch-colon-spacing": ["error", { after: true, before: false }],
1679
+ // Require or disallow spacing between template tags and their literals
1680
+ // https://eslint.style/rules/default/template-tag-spacing
1681
+ "@stylistic/template-tag-spacing": ["error", "never"],
1682
+ // require or disallow the Unicode Byte Order Mark
1683
+ // https://eslint.org/docs/rules/unicode-bom
1684
+ "unicode-bom": ["error", "never"],
1685
+ // require regex literals to be wrapped in parentheses
1686
+ // https://eslint.style/rules/default/wrap-regex
1687
+ "@stylistic/wrap-regex": "off"
1688
+ }
1689
+ };
1690
+
1691
+ const variables = {
1692
+ name: "@rhyster/eslint-config/airbnb/variables",
1693
+ rules: {
1694
+ // enforce or disallow variable initializations at definition
1695
+ // https://eslint.org/docs/rules/init-declarations
1696
+ "init-declarations": "off",
1697
+ // disallow deletion of variables
1698
+ // https://eslint.org/docs/rules/no-delete-var
1699
+ "no-delete-var": "error",
1700
+ // disallow labels that share a name with a variable
1701
+ // https://eslint.org/docs/rules/no-label-var
1702
+ "no-label-var": "error",
1703
+ // disallow specific globals
1704
+ // https://eslint.org/docs/rules/no-restricted-globals
1705
+ "no-restricted-globals": [
1706
+ "error",
1707
+ {
1708
+ name: "isFinite",
1709
+ message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite"
1710
+ },
1711
+ {
1712
+ name: "isNaN",
1713
+ message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan"
1714
+ },
1715
+ ...confusingBrowserGlobals__default.map((g) => ({
1716
+ name: g,
1717
+ message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`
1718
+ }))
1719
+ ],
1720
+ // disallow declaration of variables already declared in the outer scope
1721
+ // https://eslint.org/docs/rules/no-shadow
1722
+ "no-shadow": "error",
1723
+ // disallow shadowing of names such as arguments
1724
+ // https://eslint.org/docs/rules/no-shadow-restricted-names
1725
+ "no-shadow-restricted-names": "error",
1726
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
1727
+ // https://eslint.org/docs/rules/no-undef
1728
+ "no-undef": "error",
1729
+ // disallow use of undefined when initializing variables
1730
+ // https://eslint.org/docs/rules/no-undef-init
1731
+ "no-undef-init": "error",
1732
+ // disallow use of undefined variable
1733
+ // https://eslint.org/docs/rules/no-undefined
1734
+ "no-undefined": "off",
1735
+ // disallow declaration of variables that are not used in the code
1736
+ // https://eslint.org/docs/rules/no-unused-vars
1737
+ "no-unused-vars": [
1738
+ "error",
1739
+ { vars: "all", args: "after-used", ignoreRestSiblings: true }
1740
+ ],
1741
+ // disallow use of variables before they are defined
1742
+ // https://eslint.org/docs/rules/no-use-before-define
1743
+ "no-use-before-define": [
1744
+ "error",
1745
+ { functions: true, classes: true, variables: true }
1746
+ ]
1747
+ }
1748
+ };
1749
+
1750
+ const typescript = {
1751
+ name: "@rhyster/eslint-config/typescript",
1752
+ rules: {
1753
+ // https://typescript-eslint.io/rules/naming-convention
1754
+ "@typescript-eslint/naming-convention": "error",
1755
+ camelcase: "off",
1756
+ // https://typescript-eslint.io/rules/default-param-last
1757
+ "@typescript-eslint/default-param-last": "error",
1758
+ "default-param-last": "off",
1759
+ // https://typescript-eslint.io/rules/dot-notation
1760
+ "@typescript-eslint/dot-notation": "error",
1761
+ "dot-notation": "off",
1762
+ // https://typescript-eslint.io/rules/no-array-constructor
1763
+ "@typescript-eslint/no-array-constructor": "error",
1764
+ "no-array-constructor": "off",
1765
+ // https://typescript-eslint.io/rules/no-empty-function
1766
+ "@typescript-eslint/no-empty-function": "error",
1767
+ "no-empty-function": "off",
1768
+ // https://typescript-eslint.io/rules/no-implied-eval
1769
+ "@typescript-eslint/no-implied-eval": "error",
1770
+ "no-implied-eval": "off",
1771
+ "no-new-func": "off",
1772
+ // https://typescript-eslint.io/rules/no-loop-func
1773
+ "@typescript-eslint/no-loop-func": "error",
1774
+ "no-loop-func": "off",
1775
+ // https://typescript-eslint.io/rules/no-magic-numbers
1776
+ "@typescript-eslint/no-magic-numbers": "off",
1777
+ "no-magic-numbers": "off",
1778
+ // https://typescript-eslint.io/rules/no-shadow
1779
+ "@typescript-eslint/no-shadow": "error",
1780
+ "no-shadow": "off",
1781
+ // https://typescript-eslint.io/rules/only-throw-error
1782
+ "@typescript-eslint/only-throw-error": "error",
1783
+ "no-throw-literal": "off",
1784
+ // https://typescript-eslint.io/rules/no-unused-expressions
1785
+ "@typescript-eslint/no-unused-expressions": "error",
1786
+ "no-unused-expressions": "off",
1787
+ // https://typescript-eslint.io/rules/no-unused-vars
1788
+ "@typescript-eslint/no-unused-vars": "error",
1789
+ "no-unused-vars": "off",
1790
+ // https://typescript-eslint.io/rules/no-use-before-define
1791
+ "@typescript-eslint/no-use-before-define": "error",
1792
+ "no-use-before-define": "off",
1793
+ // https://typescript-eslint.io/rules/no-useless-constructor
1794
+ "@typescript-eslint/no-useless-constructor": "error",
1795
+ "no-useless-constructor": "off",
1796
+ // https://typescript-eslint.io/rules/prefer-promise-reject-errors
1797
+ "@typescript-eslint/prefer-promise-reject-errors": "error",
1798
+ "prefer-promise-reject-errors": "off",
1799
+ // https://typescript-eslint.io/rules/require-await
1800
+ "@typescript-eslint/require-await": "off",
1801
+ "require-await": "off",
1802
+ // https://typescript-eslint.io/rules/return-await
1803
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
1804
+ "no-return-await": "off",
1805
+ // https://typescript-eslint.io/rules/no-dupe-class-members
1806
+ // checked by the TypeScript compiler
1807
+ "no-dupe-class-members": "off",
1808
+ // https://typescript-eslint.io/rules/no-redeclare
1809
+ // checked by the TypeScript compiler
1810
+ "no-redeclare": "off",
1811
+ // https://typescript-eslint.io/troubleshooting/typed-linting/performance/#eslint-plugin-import
1812
+ "import-x/named": "off",
1813
+ "import-x/namespace": "off",
1814
+ "import-x/default": "off",
1815
+ "import-x/no-named-as-default-member": "off",
1816
+ "import-x/no-unresolved": "off"
1817
+ }
1818
+ };
1819
+
1820
+ const general = {
1821
+ name: "@rhyster/eslint-config/airbnb/general",
1822
+ plugins: {
1823
+ "@typescript-eslint": tseslint__default.plugin,
1824
+ "@stylistic": stylistic__default,
1825
+ "import-x": importx__default
1826
+ },
1827
+ languageOptions: {
1828
+ parser: tseslint__default.parser,
1829
+ parserOptions: {
1830
+ projectService: true
1831
+ }
1832
+ },
1833
+ settings: {
1834
+ "import-x/parsers": {
1835
+ espree: [
1836
+ ".js",
1837
+ ".mjs"
1838
+ ],
1839
+ "@typescript-eslint/parser": [
1840
+ ".ts",
1841
+ ".d.ts"
1842
+ ]
1843
+ },
1844
+ "import-x/resolver": {
1845
+ node: {
1846
+ extensions: [
1847
+ ".mjs",
1848
+ ".js",
1849
+ ".json",
1850
+ ".ts",
1851
+ ".d.ts"
1852
+ ]
1853
+ }
1854
+ },
1855
+ "import-x/extensions": [
1856
+ ".js",
1857
+ ".mjs",
1858
+ ".ts",
1859
+ ".d.ts"
1860
+ ],
1861
+ "import-x/core-modules": [],
1862
+ "import-x/ignore": [
1863
+ "node_modules",
1864
+ "\\.(coffee|scss|css|less|hbs|svg|json)$"
1865
+ ],
1866
+ "import-x/external-module-folders": [
1867
+ "node_modules",
1868
+ "node_modules/@types"
1869
+ ]
1870
+ }
1871
+ };
1872
+ const core = [
1873
+ {
1874
+ name: "@rhyster/eslint-config/files-ts",
1875
+ files: ["**/*.ts"]
1876
+ },
1877
+ general,
1878
+ bestPractices,
1879
+ errors,
1880
+ style,
1881
+ variables,
1882
+ es6,
1883
+ imports,
1884
+ strict,
1885
+ typescript
1886
+ ];
1887
+ const node = [
1888
+ ...core,
1889
+ {
1890
+ languageOptions: {
1891
+ globals: globals__default.node
1892
+ },
1893
+ plugins: {
1894
+ n: nodePlugin__default
1895
+ },
1896
+ ...nodeRules
1897
+ }
1898
+ ];
1899
+ const browser = [
1900
+ ...core,
1901
+ {
1902
+ languageOptions: {
1903
+ globals: globals__default.browser
1904
+ }
1905
+ }
1906
+ ];
1907
+
1908
+ exports.browser = browser;
1909
+ exports.core = core;
1910
+ exports.node = node;
1911
+ //# sourceMappingURL=index.cjs.map