@wistia/eslint-config 0.11.0 → 0.12.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.
@@ -14,16 +14,12 @@ module.exports = {
14
14
 
15
15
  env: {
16
16
  es2022: true,
17
- node: true,
18
17
  },
19
18
 
20
19
  extends: [
21
20
  '../../rules/eslint/best-practices',
22
21
  '../../rules/eslint/errors',
23
- '../../rules/eslint/es6',
24
22
  '../../rules/eslint/imports',
25
- '../../rules/eslint/node',
26
23
  '../../rules/eslint/style',
27
- '../../rules/eslint/variables',
28
24
  ].map(require.resolve),
29
25
  };
@@ -0,0 +1,9 @@
1
+ require('@rushstack/eslint-patch/modern-module-resolution');
2
+
3
+ module.exports = {
4
+ env: {
5
+ node: true,
6
+ },
7
+
8
+ extends: ['../../rules/eslint/node'].map(require.resolve),
9
+ };
@@ -10,17 +10,13 @@ module.exports = {
10
10
 
11
11
  env: {
12
12
  es2022: true,
13
- node: true,
14
13
  },
15
14
 
16
15
  extends: [
17
16
  '../../rules/eslint/best-practices',
18
17
  '../../rules/eslint/errors',
19
- '../../rules/eslint/es6',
20
- '../../rules/eslint/node',
21
18
  '../../rules/eslint/imports',
22
19
  '../../rules/eslint/style',
23
- '../../rules/eslint/variables',
24
20
  '../../rules/eslint/typescript',
25
21
  '../../rules/eslint/typescript-imports',
26
22
  ].map(require.resolve),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "main": "react.js",
6
6
  "exports": {
@@ -8,6 +8,7 @@
8
8
  ".": "./configs/eslint/default.js",
9
9
  "./cypress": "./configs/eslint/cypress.js",
10
10
  "./jest": "./configs/eslint/jest.js",
11
+ "./node": "./configs/eslint/node.js",
11
12
  "./prettier": "./configs/eslint/prettier.js",
12
13
  "./react": "./configs/eslint/react.js",
13
14
  "./strict": "./configs/eslint/strict.js",
@@ -43,6 +44,7 @@
43
44
  "eslint-plugin-jest-dom": "^4.0.2",
44
45
  "eslint-plugin-jest-formatting": "^3.1.0",
45
46
  "eslint-plugin-jsx-a11y": "^6.6.0",
47
+ "eslint-plugin-node": "^11.1.0",
46
48
  "eslint-plugin-prettier": "^4.2.1",
47
49
  "eslint-plugin-promise": "^6.0.0",
48
50
  "eslint-plugin-react": "^7.30.1",
@@ -31,6 +31,10 @@ module.exports = {
31
31
  // https://eslint.org/docs/rules/consistent-return
32
32
  'consistent-return': 'error',
33
33
 
34
+ // verify super() callings in constructors
35
+ // https://eslint.org/docs/rules/constructor-super
36
+ 'constructor-super': 'error',
37
+
34
38
  // specify curly brace conventions for all control statements
35
39
  // https://eslint.org/docs/rules/curly
36
40
  curly: ['error', 'multi-line'], // multiline
@@ -66,6 +70,10 @@ module.exports = {
66
70
  // https://eslint.org/docs/rules/guard-for-in
67
71
  'guard-for-in': 'error',
68
72
 
73
+ // enforce or disallow variable initializations at definition
74
+ // https://eslint.org/docs/rules/init-declarations
75
+ 'init-declarations': 'off',
76
+
69
77
  // enforce a maximum number of classes per file
70
78
  // https://eslint.org/docs/rules/max-classes-per-file
71
79
  'max-classes-per-file': ['error', 1],
@@ -82,6 +90,23 @@ module.exports = {
82
90
  // https://eslint.org/docs/rules/no-case-declarations
83
91
  'no-case-declarations': 'error',
84
92
 
93
+ // disallow modifying variables of class declarations
94
+ // https://eslint.org/docs/rules/no-class-assign
95
+ 'no-class-assign': 'error',
96
+
97
+ // disallow arrow functions where they could be confused with comparisons
98
+ // https://eslint.org/docs/rules/no-confusing-arrow
99
+ 'no-confusing-arrow': [
100
+ 'error',
101
+ {
102
+ allowParens: true,
103
+ },
104
+ ],
105
+
106
+ // disallow modifying variables that are declared using const
107
+ // https://eslint.org/docs/rules/no-const-assign
108
+ 'no-const-assign': 'error',
109
+
85
110
  // Disallow returning value in constructor
86
111
  // https://eslint.org/docs/rules/no-constructor-return
87
112
  'no-constructor-return': 'error',
@@ -90,6 +115,15 @@ module.exports = {
90
115
  // https://eslint.org/docs/rules/no-div-regex
91
116
  'no-div-regex': 'off',
92
117
 
118
+ // disallow duplicate class members
119
+ // https://eslint.org/docs/rules/no-dupe-class-members
120
+ 'no-dupe-class-members': 'error',
121
+
122
+ // disallow importing from the same path more than once
123
+ // https://eslint.org/docs/rules/no-duplicate-imports
124
+ // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
125
+ 'no-duplicate-imports': 'off',
126
+
93
127
  // disallow else after a return in an if
94
128
  // https://eslint.org/docs/rules/no-else-return
95
129
  'no-else-return': ['error', { allowElseIf: false }],
@@ -143,6 +177,10 @@ module.exports = {
143
177
  // https://eslint.org/docs/rules/no-native-reassign
144
178
  'no-native-reassign': 'off',
145
179
 
180
+ // disallow symbol constructor
181
+ // https://eslint.org/docs/rules/no-new-symbol
182
+ 'no-new-symbol': 'error',
183
+
146
184
  // disallow implicit type conversions
147
185
  // https://eslint.org/docs/rules/no-implicit-coercion
148
186
  'no-implicit-coercion': [
@@ -264,6 +302,18 @@ module.exports = {
264
302
  // https://eslint.org/docs/rules/no-redeclare
265
303
  'no-redeclare': 'error',
266
304
 
305
+ // Disallow specified names in exports
306
+ // https://eslint.org/docs/rules/no-restricted-exports
307
+ 'no-restricted-exports': [
308
+ 'error',
309
+ {
310
+ restrictedNamedExports: [
311
+ 'default', // use `export default` to provide a default export
312
+ 'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
313
+ ],
314
+ },
315
+ ],
316
+
267
317
  // browser globals that commonly cause confusion and are not recommended
268
318
  // to use without an explicit `window`.` qualifier
269
319
  // https://eslint.org/docs/rules/no-restricted-globals
@@ -281,6 +331,16 @@ module.exports = {
281
331
  },
282
332
  ].concat(confusingBrowserGlobals),
283
333
 
334
+ // disallow specific imports
335
+ // https://eslint.org/docs/rules/no-restricted-imports
336
+ 'no-restricted-imports': [
337
+ 'off',
338
+ {
339
+ paths: [],
340
+ patterns: [],
341
+ },
342
+ ],
343
+
284
344
  // disallow certain object properties
285
345
  // https://eslint.org/docs/rules/no-restricted-properties
286
346
  'no-restricted-properties': [
@@ -364,6 +424,10 @@ module.exports = {
364
424
  // https://eslint.org/docs/rules/no-sequences
365
425
  'no-sequences': 'error',
366
426
 
427
+ // disallow to use this/super before super() calling in constructors.
428
+ // https://eslint.org/docs/rules/no-this-before-super
429
+ 'no-this-before-super': 'error',
430
+
367
431
  // restrict what can be thrown as an exception
368
432
  // https://eslint.org/docs/rules/no-throw-literal
369
433
  'no-throw-literal': 'error',
@@ -399,6 +463,14 @@ module.exports = {
399
463
  // https://eslint.org/docs/rules/no-useless-concat
400
464
  'no-useless-concat': 'error',
401
465
 
466
+ // disallow useless computed property keys
467
+ // https://eslint.org/docs/rules/no-useless-computed-key
468
+ 'no-useless-computed-key': 'error',
469
+
470
+ // disallow unnecessary constructor
471
+ // https://eslint.org/docs/rules/no-useless-constructor
472
+ 'no-useless-constructor': 'error',
473
+
402
474
  // disallow unnecessary string escaping
403
475
  // https://eslint.org/docs/rules/no-useless-escape
404
476
  'no-useless-escape': 'error',
@@ -407,6 +479,21 @@ module.exports = {
407
479
  // https://eslint.org/docs/rules/no-useless-return
408
480
  'no-useless-return': 'error',
409
481
 
482
+ // disallow renaming import, export, and destructured assignments to the same name
483
+ // https://eslint.org/docs/rules/no-useless-rename
484
+ 'no-useless-rename': [
485
+ 'error',
486
+ {
487
+ ignoreDestructuring: false,
488
+ ignoreImport: false,
489
+ ignoreExport: false,
490
+ },
491
+ ],
492
+
493
+ // require let or const instead of var
494
+ // https://eslint.org/docs/rules/no-var
495
+ 'no-var': 'error',
496
+
410
497
  // disallow use of void operator
411
498
  // https://eslint.org/docs/rules/no-void
412
499
  'no-void': 'error',
@@ -419,18 +506,112 @@ module.exports = {
419
506
  // https://eslint.org/docs/rules/no-with
420
507
  'no-with': 'error',
421
508
 
422
- // require using Error objects as Promise rejection reasons
423
- // https://eslint.org/docs/rules/prefer-promise-reject-errors
424
- 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
509
+ // disallow the catch clause parameter name being the same as a variable in the outer scope
510
+ // https://eslint.org/docs/rules/no-catch-shadow
511
+ 'no-catch-shadow': 'off',
512
+
513
+ // disallow deletion of variables
514
+ // https://eslint.org/docs/rules/no-delete-var
515
+ 'no-delete-var': 'error',
516
+
517
+ // disallow labels that share a name with a variable
518
+ // https://eslint.org/docs/rules/no-label-var
519
+ 'no-label-var': 'error',
520
+
521
+ // disallow declaration of variables already declared in the outer scope
522
+ // https://eslint.org/docs/rules/no-shadow
523
+ 'no-shadow': 'error',
524
+
525
+ // disallow shadowing of names such as arguments
526
+ // https://eslint.org/docs/rules/no-shadow-restricted-names
527
+ 'no-shadow-restricted-names': 'error',
528
+
529
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
530
+ // https://eslint.org/docs/rules/no-undef
531
+ 'no-undef': 'error',
532
+
533
+ // disallow use of undefined when initializing variables
534
+ // https://eslint.org/docs/rules/no-undef-init
535
+ 'no-undef-init': 'error',
536
+
537
+ // disallow use of undefined variable
538
+ // https://eslint.org/docs/rules/no-undefined
539
+ 'no-undefined': 'off',
540
+
541
+ // disallow declaration of variables that are not used in the code
542
+ // https://eslint.org/docs/rules/no-unused-vars
543
+ 'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
544
+
545
+ // disallow use of variables before they are defined
546
+ // https://eslint.org/docs/rules/no-use-before-define
547
+ 'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
548
+
549
+ // require method and property shorthand syntax for object literals
550
+ // https://eslint.org/docs/rules/object-shorthand
551
+ 'object-shorthand': [
552
+ 'error',
553
+ 'always',
554
+ {
555
+ ignoreConstructors: false,
556
+ avoidQuotes: true,
557
+ },
558
+ ],
559
+
560
+ // suggest using arrow functions as callbacks
561
+ // https://eslint.org/docs/rules/prefer-arrow-callback
562
+ 'prefer-arrow-callback': [
563
+ 'error',
564
+ {
565
+ allowNamedFunctions: false,
566
+ allowUnboundThis: true,
567
+ },
568
+ ],
569
+
570
+ // suggest using of const declaration for variables that are never modified after declared
571
+ // https://eslint.org/docs/rules/prefer-const
572
+ 'prefer-const': [
573
+ 'error',
574
+ {
575
+ destructuring: 'any',
576
+ ignoreReadBeforeAssign: true,
577
+ },
578
+ ],
579
+
580
+ // Prefer destructuring from arrays and objects
581
+ // https://eslint.org/docs/rules/prefer-destructuring
582
+ 'prefer-destructuring': [
583
+ 'error',
584
+ {
585
+ VariableDeclarator: {
586
+ array: false,
587
+ object: true,
588
+ },
589
+ AssignmentExpression: {
590
+ array: true,
591
+ object: false,
592
+ },
593
+ },
594
+ {
595
+ enforceForRenamedProperties: false,
596
+ },
597
+ ],
425
598
 
426
599
  // Suggest using named capture group in regular expression
427
600
  // https://eslint.org/docs/rules/prefer-named-capture-group
428
601
  'prefer-named-capture-group': 'off',
429
602
 
603
+ // disallow parseInt() in favor of binary, octal, and hexadecimal literals
604
+ // https://eslint.org/docs/rules/prefer-numeric-literals
605
+ 'prefer-numeric-literals': 'error',
606
+
430
607
  // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
431
608
  // https://eslint.org/docs/rules/prefer-object-has-own
432
609
  'prefer-object-has-own': 'error',
433
610
 
611
+ // require using Error objects as Promise rejection reasons
612
+ // https://eslint.org/docs/rules/prefer-promise-reject-errors
613
+ 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
614
+
434
615
  // https://eslint.org/docs/rules/prefer-regex-literals
435
616
  'prefer-regex-literals': [
436
617
  'error',
@@ -439,6 +620,22 @@ module.exports = {
439
620
  },
440
621
  ],
441
622
 
623
+ // suggest using Reflect methods where applicable
624
+ // https://eslint.org/docs/rules/prefer-reflect
625
+ 'prefer-reflect': 'off',
626
+
627
+ // use rest parameters instead of arguments
628
+ // https://eslint.org/docs/rules/prefer-rest-params
629
+ 'prefer-rest-params': 'error',
630
+
631
+ // suggest using the spread syntax instead of .apply()
632
+ // https://eslint.org/docs/rules/prefer-spread
633
+ 'prefer-spread': 'error',
634
+
635
+ // suggest using template literals instead of string concatenation
636
+ // https://eslint.org/docs/rules/prefer-template
637
+ 'prefer-template': 'error',
638
+
442
639
  // require use of the second argument for parseInt()
443
640
  // https://eslint.org/docs/rules/radix
444
641
  radix: 'error',
@@ -451,9 +648,29 @@ module.exports = {
451
648
  // https://eslint.org/docs/rules/require-unicode-regexp
452
649
  'require-unicode-regexp': 'off',
453
650
 
651
+ // disallow generator functions that do not have yield
652
+ // https://eslint.org/docs/rules/require-yield
653
+ 'require-yield': 'error',
654
+
655
+ // import sorting
656
+ // https://eslint.org/docs/rules/sort-imports
657
+ 'sort-imports': [
658
+ 'off',
659
+ {
660
+ ignoreCase: false,
661
+ ignoreDeclarationSort: false,
662
+ ignoreMemberSort: false,
663
+ memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
664
+ },
665
+ ],
666
+
454
667
  // compiler/transpiler inserts `'use strict';` for us
455
668
  strict: ['error', 'never'],
456
669
 
670
+ // require a Symbol description
671
+ // https://eslint.org/docs/rules/symbol-description
672
+ 'symbol-description': 'error',
673
+
457
674
  // requires to declare all vars on top of their containing scope
458
675
  // https://eslint.org/docs/rules/vars-on-top
459
676
  'vars-on-top': 'error',
@@ -1,4 +1,9 @@
1
+ // only add node rules
2
+ // see: https://github.com/mysticatea/eslint-plugin-node#-rules
3
+
1
4
  module.exports = {
5
+ plugins: ['eslint-plugin-node'],
6
+
2
7
  rules: {
3
8
  // enforce return after a callback
4
9
  // https://eslint.org/docs/rules/callback-return
@@ -38,10 +43,161 @@ module.exports = {
38
43
 
39
44
  // restrict usage of specified node modules
40
45
  // https://eslint.org/docs/rules/no-restricted-modules
46
+ // deprecated in eslint 7
41
47
  'no-restricted-modules': 'off',
42
48
 
43
49
  // disallow use of synchronous methods
44
50
  // https://eslint.org/docs/rules/no-sync
45
51
  'no-sync': 'off',
52
+
53
+ // require error handling in callbacks
54
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/handle-callback-err
55
+ 'node/handle-callback-err': 'error',
56
+
57
+ // ensure Node.js-style error-first callback pattern is followed
58
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-callback-literal
59
+ 'node/no-callback-literal': 'error',
60
+
61
+ // disallow the assignment to exports
62
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-exports-assign
63
+ 'node/no-exports-assign': 'error',
64
+
65
+ // disallow import declarations which import extraneous modules
66
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-extraneous-import
67
+ 'node/no-extraneous-import': 'error',
68
+
69
+ // disallow require() expressions which import extraneous modules
70
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-extraneous-require
71
+ 'node/no-extraneous-require': 'error',
72
+
73
+ // disallow import declarations which import non-existence modules
74
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-missing-import
75
+ 'node/no-missing-import': 'error',
76
+
77
+ // disallow require() expressions which import non-existence modules
78
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-missing-require
79
+ 'node/no-missing-require': 'error',
80
+
81
+ // disallow new operators with calls to require
82
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-new-require
83
+ 'node/no-new-require': 'error',
84
+
85
+ // disallow string concatenation with __dirname and __filename
86
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-path-concat
87
+ 'node/no-path-concat': 'error',
88
+
89
+ // disallow the use of process.exit()
90
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-exit
91
+ 'node/no-process-exit': 'error',
92
+
93
+ // disallow bin files that npm ignores
94
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unpublished-bin
95
+ 'node/no-unpublished-bin': 'error',
96
+
97
+ // disallow import declarations which import private modules
98
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unpublished-import
99
+ 'node/no-unpublished-import': 'error',
100
+
101
+ // disallow require() expressions which import private modules
102
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unpublished-require
103
+ 'node/no-unpublished-require': 'error',
104
+
105
+ // disallow unsupported ECMAScript built-ins on the specified version
106
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features/es-builtins
107
+ 'node/no-unsupported-features/es-builtins': 'error',
108
+
109
+ // disallow unsupported ECMAScript syntax on the specified version
110
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features/es-syntax
111
+ 'node/no-unsupported-features/es-syntax': ['error', { ignores: ['modules'] }],
112
+
113
+ // disallow unsupported Node.js built-in APIs on the specified version
114
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features/node-builtins
115
+ 'node/no-unsupported-features/node-builtins': 'error',
116
+
117
+ // make process.exit() expressions the same code path as throw
118
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/process-exit-as-throw
119
+ 'node/process-exit-as-throw': 'error',
120
+
121
+ // suggest correct usage of shebang
122
+ // decision: turned this off because it expects files to be listed under `bin` in package.json
123
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/shebang
124
+ 'node/shebang': 'off',
125
+
126
+ // disallow deprecated APIs
127
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api
128
+ 'node/no-deprecated-api': 'error',
129
+
130
+ // require return statements after callbacks
131
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/callback-return
132
+ 'node/callback-return': 'error',
133
+
134
+ // enforce either module.exports or exports
135
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/exports-style
136
+ 'node/exports-style': 'error',
137
+
138
+ // enforce the style of file extensions in import declarations
139
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/file-extension-in-import
140
+ 'node/file-extension-in-import': 'error',
141
+
142
+ // require require() calls to be placed at top-level module scope
143
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/global-require
144
+ 'node/global-require': 'error',
145
+
146
+ // disallow require calls to be mixed with regular variable declarations
147
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-mixed-requires
148
+ 'node/no-mixed-requires': 'error',
149
+
150
+ // disallow the use of process.env
151
+ // decision: process.env is used by dotenv
152
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-env
153
+ 'node/no-process-env': 'off',
154
+
155
+ // disallow specified modules when loaded by import declarations
156
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-restricted-import
157
+ 'node/no-restricted-import': 'error',
158
+
159
+ // disallow specified modules when loaded by require
160
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-restricted-require
161
+ 'node/no-restricted-require': 'error',
162
+
163
+ // disallow synchronous methods
164
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-sync
165
+ 'node/no-sync': 'error',
166
+
167
+ // enforce either Buffer or require("buffer").Buffer
168
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/buffer
169
+ 'node/prefer-global/buffer': 'error',
170
+
171
+ // enforce either console or require("console")
172
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/console
173
+ 'node/prefer-global/console': 'error',
174
+
175
+ // enforce either process or require("process")
176
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/process
177
+ 'node/prefer-global/process': 'error',
178
+
179
+ // enforce either TextDecoder or require("util").TextDecoder
180
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/text-decoder
181
+ 'node/prefer-global/text-decoder': 'error',
182
+
183
+ // enforce either TextEncoder or require("util").TextEncoder
184
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/text-encoder
185
+ 'node/prefer-global/text-encoder': 'error',
186
+
187
+ // enforce either URLSearchParams or require("url").URLSearchParams
188
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/url-search-params
189
+ 'node/prefer-global/url-search-params': 'error',
190
+
191
+ // enforce either URL or require("url").URL
192
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/url
193
+ 'node/prefer-global/url': 'error',
194
+
195
+ // enforce require("dns").promises
196
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-promises/dns
197
+ 'node/prefer-promises/dns': 'error',
198
+
199
+ // enforce require("fs").promises
200
+ // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-promises/fs
201
+ 'node/prefer-promises/fs': 'error',
46
202
  },
47
203
  };
@@ -14,6 +14,24 @@ module.exports = {
14
14
  // https://eslint.org/docs/rules/array-bracket-spacing
15
15
  'array-bracket-spacing': ['error', 'never'],
16
16
 
17
+ // enforces no braces where they can be omitted
18
+ // https://eslint.org/docs/rules/arrow-body-style
19
+ 'arrow-body-style': [
20
+ 'error',
21
+ 'as-needed',
22
+ {
23
+ requireReturnForObjectLiteral: false,
24
+ },
25
+ ],
26
+
27
+ // require parens in arrow function arguments
28
+ // https://eslint.org/docs/rules/arrow-parens
29
+ 'arrow-parens': ['error', 'always'],
30
+
31
+ // require space before/after arrow function's arrow
32
+ // https://eslint.org/docs/rules/arrow-spacing
33
+ 'arrow-spacing': ['error', { before: true, after: true }],
34
+
17
35
  // enforce spacing inside single-line blocks
18
36
  // https://eslint.org/docs/rules/block-spacing
19
37
  'block-spacing': ['error', 'always'],
@@ -128,6 +146,10 @@ module.exports = {
128
146
  // https://eslint.org/docs/rules/function-paren-newline
129
147
  'function-paren-newline': ['error', 'multiline-arguments'],
130
148
 
149
+ // enforce the spacing around the * in generator functions
150
+ // https://eslint.org/docs/rules/generator-star-spacing
151
+ 'generator-star-spacing': ['error', { before: false, after: true }],
152
+
131
153
  // disallow specified identifiers
132
154
  // https://eslint.org/docs/rules/id-denylist
133
155
  'id-denylist': 'off',
@@ -563,6 +585,10 @@ module.exports = {
563
585
  // https://eslint.org/docs/rules/quotes
564
586
  quotes: ['error', 'single', { avoidEscape: true }],
565
587
 
588
+ // enforce spacing between object rest-spread
589
+ // https://eslint.org/docs/rules/rest-spread-spacing
590
+ 'rest-spread-spacing': ['error', 'never'],
591
+
566
592
  // do not require jsdoc
567
593
  // https://eslint.org/docs/rules/require-jsdoc
568
594
  'require-jsdoc': 'off',
@@ -643,6 +669,10 @@ module.exports = {
643
669
  // https://eslint.org/docs/rules/switch-colon-spacing
644
670
  'switch-colon-spacing': ['error', { after: true, before: false }],
645
671
 
672
+ // enforce usage of spacing in template strings
673
+ // https://eslint.org/docs/rules/template-curly-spacing
674
+ 'template-curly-spacing': 'error',
675
+
646
676
  // Require or disallow spacing between template tags and their literals
647
677
  // https://eslint.org/docs/rules/template-tag-spacing
648
678
  'template-tag-spacing': ['error', 'never'],
@@ -654,5 +684,9 @@ module.exports = {
654
684
  // require regex literals to be wrapped in parentheses
655
685
  // https://eslint.org/docs/rules/wrap-regex
656
686
  'wrap-regex': 'off',
687
+
688
+ // enforce spacing around the * in yield* expressions
689
+ // https://eslint.org/docs/rules/yield-star-spacing
690
+ 'yield-star-spacing': ['error', 'after'],
657
691
  },
658
692
  };
@@ -1,210 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // enforces no braces where they can be omitted
4
- // https://eslint.org/docs/rules/arrow-body-style
5
- 'arrow-body-style': [
6
- 'error',
7
- 'as-needed',
8
- {
9
- requireReturnForObjectLiteral: false,
10
- },
11
- ],
12
-
13
- // require parens in arrow function arguments
14
- // https://eslint.org/docs/rules/arrow-parens
15
- 'arrow-parens': ['error', 'always'],
16
-
17
- // require space before/after arrow function's arrow
18
- // https://eslint.org/docs/rules/arrow-spacing
19
- 'arrow-spacing': ['error', { before: true, after: true }],
20
-
21
- // verify super() callings in constructors
22
- // https://eslint.org/docs/rules/constructor-super
23
- 'constructor-super': 'error',
24
-
25
- // enforce the spacing around the * in generator functions
26
- // https://eslint.org/docs/rules/generator-star-spacing
27
- 'generator-star-spacing': ['error', { before: false, after: true }],
28
-
29
- // disallow modifying variables of class declarations
30
- // https://eslint.org/docs/rules/no-class-assign
31
- 'no-class-assign': 'error',
32
-
33
- // disallow arrow functions where they could be confused with comparisons
34
- // https://eslint.org/docs/rules/no-confusing-arrow
35
- 'no-confusing-arrow': [
36
- 'error',
37
- {
38
- allowParens: true,
39
- },
40
- ],
41
-
42
- // disallow modifying variables that are declared using const
43
- // https://eslint.org/docs/rules/no-const-assign
44
- 'no-const-assign': 'error',
45
-
46
- // disallow duplicate class members
47
- // https://eslint.org/docs/rules/no-dupe-class-members
48
- 'no-dupe-class-members': 'error',
49
-
50
- // disallow importing from the same path more than once
51
- // https://eslint.org/docs/rules/no-duplicate-imports
52
- // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
53
- 'no-duplicate-imports': 'off',
54
-
55
- // disallow symbol constructor
56
- // https://eslint.org/docs/rules/no-new-symbol
57
- 'no-new-symbol': 'error',
58
-
59
- // Disallow specified names in exports
60
- // https://eslint.org/docs/rules/no-restricted-exports
61
- 'no-restricted-exports': [
62
- 'error',
63
- {
64
- restrictedNamedExports: [
65
- 'default', // use `export default` to provide a default export
66
- 'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
67
- ],
68
- },
69
- ],
70
-
71
- // disallow specific imports
72
- // https://eslint.org/docs/rules/no-restricted-imports
73
- 'no-restricted-imports': [
74
- 'off',
75
- {
76
- paths: [],
77
- patterns: [],
78
- },
79
- ],
80
-
81
- // disallow to use this/super before super() calling in constructors.
82
- // https://eslint.org/docs/rules/no-this-before-super
83
- 'no-this-before-super': 'error',
84
-
85
- // disallow useless computed property keys
86
- // https://eslint.org/docs/rules/no-useless-computed-key
87
- 'no-useless-computed-key': 'error',
88
-
89
- // disallow unnecessary constructor
90
- // https://eslint.org/docs/rules/no-useless-constructor
91
- 'no-useless-constructor': 'error',
92
-
93
- // disallow renaming import, export, and destructured assignments to the same name
94
- // https://eslint.org/docs/rules/no-useless-rename
95
- 'no-useless-rename': [
96
- 'error',
97
- {
98
- ignoreDestructuring: false,
99
- ignoreImport: false,
100
- ignoreExport: false,
101
- },
102
- ],
103
-
104
- // require let or const instead of var
105
- // https://eslint.org/docs/rules/no-var
106
- 'no-var': 'error',
107
-
108
- // require method and property shorthand syntax for object literals
109
- // https://eslint.org/docs/rules/object-shorthand
110
- 'object-shorthand': [
111
- 'error',
112
- 'always',
113
- {
114
- ignoreConstructors: false,
115
- avoidQuotes: true,
116
- },
117
- ],
118
-
119
- // suggest using arrow functions as callbacks
120
- // https://eslint.org/docs/rules/prefer-arrow-callback
121
- 'prefer-arrow-callback': [
122
- 'error',
123
- {
124
- allowNamedFunctions: false,
125
- allowUnboundThis: true,
126
- },
127
- ],
128
-
129
- // suggest using of const declaration for variables that are never modified after declared
130
- // https://eslint.org/docs/rules/prefer-const
131
- 'prefer-const': [
132
- 'error',
133
- {
134
- destructuring: 'any',
135
- ignoreReadBeforeAssign: true,
136
- },
137
- ],
138
-
139
- // Prefer destructuring from arrays and objects
140
- // https://eslint.org/docs/rules/prefer-destructuring
141
- 'prefer-destructuring': [
142
- 'error',
143
- {
144
- VariableDeclarator: {
145
- array: false,
146
- object: true,
147
- },
148
- AssignmentExpression: {
149
- array: true,
150
- object: false,
151
- },
152
- },
153
- {
154
- enforceForRenamedProperties: false,
155
- },
156
- ],
157
-
158
- // disallow parseInt() in favor of binary, octal, and hexadecimal literals
159
- // https://eslint.org/docs/rules/prefer-numeric-literals
160
- 'prefer-numeric-literals': 'error',
161
-
162
- // suggest using Reflect methods where applicable
163
- // https://eslint.org/docs/rules/prefer-reflect
164
- 'prefer-reflect': 'off',
165
-
166
- // use rest parameters instead of arguments
167
- // https://eslint.org/docs/rules/prefer-rest-params
168
- 'prefer-rest-params': 'error',
169
-
170
- // suggest using the spread syntax instead of .apply()
171
- // https://eslint.org/docs/rules/prefer-spread
172
- 'prefer-spread': 'error',
173
-
174
- // suggest using template literals instead of string concatenation
175
- // https://eslint.org/docs/rules/prefer-template
176
- 'prefer-template': 'error',
177
-
178
- // disallow generator functions that do not have yield
179
- // https://eslint.org/docs/rules/require-yield
180
- 'require-yield': 'error',
181
-
182
- // enforce spacing between object rest-spread
183
- // https://eslint.org/docs/rules/rest-spread-spacing
184
- 'rest-spread-spacing': ['error', 'never'],
185
-
186
- // import sorting
187
- // https://eslint.org/docs/rules/sort-imports
188
- 'sort-imports': [
189
- 'off',
190
- {
191
- ignoreCase: false,
192
- ignoreDeclarationSort: false,
193
- ignoreMemberSort: false,
194
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
195
- },
196
- ],
197
-
198
- // require a Symbol description
199
- // https://eslint.org/docs/rules/symbol-description
200
- 'symbol-description': 'error',
201
-
202
- // enforce usage of spacing in template strings
203
- // https://eslint.org/docs/rules/template-curly-spacing
204
- 'template-curly-spacing': 'error',
205
-
206
- // enforce spacing around the * in yield* expressions
207
- // https://eslint.org/docs/rules/yield-star-spacing
208
- 'yield-star-spacing': ['error', 'after'],
209
- },
210
- };
@@ -1,47 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // enforce or disallow variable initializations at definition
4
- // https://eslint.org/docs/rules/init-declarations
5
- 'init-declarations': 'off',
6
-
7
- // disallow the catch clause parameter name being the same as a variable in the outer scope
8
- // https://eslint.org/docs/rules/no-catch-shadow
9
- 'no-catch-shadow': 'off',
10
-
11
- // disallow deletion of variables
12
- // https://eslint.org/docs/rules/no-delete-var
13
- 'no-delete-var': 'error',
14
-
15
- // disallow labels that share a name with a variable
16
- // https://eslint.org/docs/rules/no-label-var
17
- 'no-label-var': 'error',
18
-
19
- // disallow declaration of variables already declared in the outer scope
20
- // https://eslint.org/docs/rules/no-shadow
21
- 'no-shadow': 'error',
22
-
23
- // disallow shadowing of names such as arguments
24
- // https://eslint.org/docs/rules/no-shadow-restricted-names
25
- 'no-shadow-restricted-names': 'error',
26
-
27
- // disallow use of undeclared variables unless mentioned in a /*global */ block
28
- // https://eslint.org/docs/rules/no-undef
29
- 'no-undef': 'error',
30
-
31
- // disallow use of undefined when initializing variables
32
- // https://eslint.org/docs/rules/no-undef-init
33
- 'no-undef-init': 'error',
34
-
35
- // disallow use of undefined variable
36
- // https://eslint.org/docs/rules/no-undefined
37
- 'no-undefined': 'off',
38
-
39
- // disallow declaration of variables that are not used in the code
40
- // https://eslint.org/docs/rules/no-unused-vars
41
- 'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
42
-
43
- // disallow use of variables before they are defined
44
- // https://eslint.org/docs/rules/no-use-before-define
45
- 'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
46
- },
47
- };