@enormora/eslint-config-base 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base.js ADDED
@@ -0,0 +1,578 @@
1
+ import importPlugin from 'eslint-plugin-import';
2
+ import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
3
+ import noSecretsPlugin from 'eslint-plugin-no-secrets';
4
+ import { stylisticRuleSet } from './rule-sets/stylistic.js';
5
+ import { bestPracticesRuleSet } from './rule-sets/best-practices.js';
6
+ import { ecmaVersion, indentSize, javascriptExtensions } from './constants.js';
7
+
8
+ export const baseConfig = {
9
+ languageOptions: {
10
+ ecmaVersion,
11
+ sourceType: 'module',
12
+ parserOptions: {
13
+ ecmaVersion,
14
+ ecmaFeatures: {
15
+ jsx: false,
16
+ globalReturn: false,
17
+ impliedStrict: false
18
+ }
19
+ }
20
+ },
21
+ linterOptions: {
22
+ noInlineConfig: false,
23
+ reportUnusedDisableDirectives: true
24
+ },
25
+ plugins: {
26
+ ...stylisticRuleSet.plugins,
27
+ ...bestPracticesRuleSet.plugins,
28
+ import: importPlugin,
29
+ 'eslint-comments': eslintCommentsPlugin,
30
+ 'no-secrets': noSecretsPlugin
31
+ },
32
+ settings: {
33
+ ...stylisticRuleSet.settings,
34
+ ...bestPracticesRuleSet.settings,
35
+ 'import/parsers': {
36
+ espree: javascriptExtensions
37
+ }
38
+ },
39
+ rules: {
40
+ ...stylisticRuleSet.rules,
41
+ ...bestPracticesRuleSet.rules,
42
+
43
+ 'array-callback-return': 'error',
44
+ 'no-array-constructor': 'error',
45
+ 'no-bitwise': 'error',
46
+ 'no-caller': 'error',
47
+ 'no-case-declarations': 'error',
48
+ 'no-class-assign': 'error',
49
+ 'no-cond-assign': 'error',
50
+ 'no-confusing-arrow': 'error',
51
+ 'no-console': 'error',
52
+ 'no-const-assign': 'error',
53
+ 'no-constant-condition': 'error',
54
+ 'no-continue': 'error',
55
+ 'no-control-regex': 'error',
56
+ 'no-debugger': 'error',
57
+ 'no-delete-var': 'error',
58
+ 'no-div-regex': 'error',
59
+ 'no-dupe-class-members': 'error',
60
+ 'no-dupe-keys': 'error',
61
+ 'no-dupe-args': 'error',
62
+ 'no-duplicate-case': 'error',
63
+ 'no-duplicate-imports': 'error',
64
+ 'no-else-return': ['error', { allowElseIf: false }],
65
+ 'no-empty': ['error', { allowEmptyCatch: true }],
66
+ 'no-empty-character-class': 'error',
67
+ 'no-empty-function': 'off',
68
+ 'no-empty-pattern': 'error',
69
+ 'no-empty-static-block': 'error',
70
+ 'no-eq-null': 'error',
71
+ 'no-eval': 'error',
72
+ 'no-ex-assign': 'error',
73
+ 'no-extend-native': 'error',
74
+ 'no-extra-bind': 'error',
75
+ 'no-extra-boolean-cast': 'error',
76
+ 'no-extra-label': 'error',
77
+ 'no-extra-parens': 'error',
78
+ 'no-extra-semi': 'error',
79
+ 'no-fallthrough': 'error',
80
+ 'no-floating-decimal': 'error',
81
+ 'no-func-assign': 'error',
82
+ 'no-implicit-coercion': 'error',
83
+ 'no-implicit-globals': 'error',
84
+ 'no-implied-eval': 'error',
85
+ 'no-inline-comments': 'off',
86
+ 'no-inner-declarations': ['error', 'functions'],
87
+ 'no-invalid-regexp': 'error',
88
+ 'no-invalid-this': 'off',
89
+ 'no-irregular-whitespace': 'error',
90
+ 'no-iterator': 'error',
91
+ 'no-label-var': 'error',
92
+ 'no-labels': 'error',
93
+ 'no-lone-blocks': 'error',
94
+ 'no-lonely-if': 'error',
95
+ 'no-loop-func': 'error',
96
+ 'no-mixed-spaces-and-tabs': 'error',
97
+ 'no-new-native-nonconstructor': 'error',
98
+ 'linebreak-style': ['error', 'unix'],
99
+ 'no-multi-spaces': 'error',
100
+ 'no-multi-str': 'error',
101
+ 'no-multiple-empty-lines': ['error', { max: 1 }],
102
+ 'no-global-assign': 'error',
103
+ 'no-negated-condition': 'off',
104
+ 'no-nested-ternary': 'error',
105
+ 'no-new': 'error',
106
+ 'no-new-func': 'error',
107
+ 'no-new-object': 'error',
108
+ 'no-new-symbol': 'error',
109
+ 'no-new-wrappers': 'error',
110
+ 'no-obj-calls': 'error',
111
+ 'no-octal': 'error',
112
+ 'no-octal-escape': 'error',
113
+ 'no-param-reassign': ['error', { props: true }],
114
+ 'no-plusplus': 'error',
115
+ 'no-proto': 'error',
116
+ 'no-prototype-builtins': 'error',
117
+ 'no-redeclare': ['error', { builtinGlobals: true }],
118
+ 'no-regex-spaces': 'error',
119
+ 'no-restricted-syntax': 'off',
120
+ 'no-return-assign': ['error', 'always'],
121
+ 'no-self-assign': ['error', { props: true }],
122
+ 'no-self-compare': 'error',
123
+ 'no-sequences': 'error',
124
+ 'no-shadow': ['error', { builtinGlobals: true }],
125
+ 'no-shadow-restricted-names': 'error',
126
+ 'no-sparse-arrays': 'error',
127
+ 'no-tabs': 'error',
128
+ 'no-ternary': 'off',
129
+ 'no-trailing-spaces': 'error',
130
+ 'no-this-before-super': 'error',
131
+ 'no-throw-literal': 'error',
132
+ 'no-undef': ['error', { typeof: true }],
133
+ 'no-undef-init': 'error',
134
+ 'no-undefined': 'off',
135
+ 'no-unexpected-multiline': 'error',
136
+ 'no-underscore-dangle': 'error',
137
+ 'no-unmodified-loop-condition': 'error',
138
+ 'no-unneeded-ternary': 'error',
139
+ 'no-unreachable': 'error',
140
+ 'no-unsafe-finally': 'error',
141
+ 'no-unused-expressions': 'error',
142
+ 'no-unused-labels': 'error',
143
+ 'no-unused-vars': [
144
+ 'error',
145
+ {
146
+ vars: 'all',
147
+ args: 'after-used',
148
+ ignoreRestSiblings: true,
149
+ argsIgnorePattern: '^_$',
150
+ caughtErrors: 'all',
151
+ caughtErrorsIgnorePattern: '^_$'
152
+ }
153
+ ],
154
+ 'no-use-before-define': 'error',
155
+ 'no-useless-call': 'error',
156
+ 'no-useless-computed-key': 'error',
157
+ 'no-useless-concat': 'error',
158
+ 'no-useless-constructor': 'error',
159
+ 'no-useless-escape': 'error',
160
+ 'no-useless-rename': 'error',
161
+ 'no-whitespace-before-property': 'error',
162
+ 'no-void': 'error',
163
+ 'prefer-const': [
164
+ 'error',
165
+ {
166
+ destructuring: 'all'
167
+ }
168
+ ],
169
+ 'prefer-spread': 'error',
170
+ 'prefer-template': 'error',
171
+ 'no-var': 'error',
172
+ 'no-warning-comments': [
173
+ 'error',
174
+ {
175
+ terms: ['todo', 'fixme', 'wtf', 'falls through', 'istanbul', 'c8'],
176
+ location: 'anywhere'
177
+ }
178
+ ],
179
+ 'no-with': 'error',
180
+ 'no-magic-numbers': [
181
+ 'error',
182
+ {
183
+ ignoreDefaultValues: true,
184
+ ignoreArrayIndexes: false,
185
+ detectObjects: false,
186
+ enforceConst: false,
187
+ ignoreClassFieldInitialValues: false,
188
+ ignore: [-1, 0, 1]
189
+ }
190
+ ],
191
+ 'no-mixed-operators': 'off',
192
+ 'array-bracket-spacing': ['error', 'never'],
193
+ 'array-bracket-newline': ['error', 'consistent'],
194
+ 'array-element-newline': ['error', 'consistent'],
195
+ 'arrow-body-style': ['error', 'always'],
196
+ 'arrow-parens': ['error', 'always'],
197
+ 'arrow-spacing': [
198
+ 'error',
199
+ {
200
+ before: true,
201
+ after: true
202
+ }
203
+ ],
204
+ 'accessor-pairs': [
205
+ 'error',
206
+ {
207
+ enforceForClassMembers: true
208
+ }
209
+ ],
210
+ 'block-scoped-var': 'off',
211
+ 'block-spacing': 'off',
212
+ 'brace-style': ['error', '1tbs', { allowSingleLine: false }],
213
+ camelcase: 'error',
214
+ 'comma-dangle': ['error', 'never'],
215
+ 'comma-spacing': [
216
+ 'error',
217
+ {
218
+ before: false,
219
+ after: true
220
+ }
221
+ ],
222
+ 'comma-style': ['error', 'last'],
223
+ complexity: ['error', { max: 6 }],
224
+ 'computed-property-spacing': [
225
+ 'error',
226
+ 'never',
227
+ {
228
+ enforceForClassMembers: true
229
+ }
230
+ ],
231
+ 'consistent-return': 'error',
232
+ 'consistent-this': ['error', 'self'],
233
+ 'constructor-super': 'error',
234
+ 'generator-star-spacing': ['error', { before: false, after: true }],
235
+ curly: ['error', 'all'],
236
+ 'default-case': 'error',
237
+ 'dot-location': ['error', 'property'],
238
+ 'dot-notation': 'error',
239
+ 'eol-last': 'error',
240
+ eqeqeq: 'error',
241
+ 'func-names': 'off',
242
+ 'func-style': 'off',
243
+ 'guard-for-in': 'error',
244
+ 'id-length': ['error', { min: 2, properties: 'never' }],
245
+ indent: [
246
+ 'error',
247
+ indentSize,
248
+ {
249
+ SwitchCase: 1,
250
+ VariableDeclarator: 1,
251
+ MemberExpression: 1
252
+ }
253
+ ],
254
+ 'init-declarations': ['error', 'always'],
255
+ 'jsx-quotes': 'off',
256
+ 'key-spacing': [
257
+ 'error',
258
+ {
259
+ beforeColon: false,
260
+ afterColon: true
261
+ }
262
+ ],
263
+ 'lines-around-comment': 'off',
264
+ 'max-depth': ['error', { max: 5 }],
265
+ 'max-lines': ['error', { max: 500, skipBlankLines: true, skipComments: false }],
266
+ 'max-nested-callbacks': ['error', { max: 4 }],
267
+ 'max-params': ['error', { max: 4 }],
268
+ 'max-statements': ['error', { max: 10 }],
269
+ 'multiline-ternary': 'off',
270
+ 'max-statements-per-line': ['error', { max: 1 }],
271
+ 'new-cap': [
272
+ 'error',
273
+ {
274
+ newIsCap: true,
275
+ capIsNew: true
276
+ }
277
+ ],
278
+ 'new-parens': 'error',
279
+ 'newline-per-chained-call': 'off',
280
+ 'object-curly-newline': 'off',
281
+ 'object-curly-spacing': ['error', 'always'],
282
+ 'object-property-newline': 'off',
283
+ 'object-shorthand': ['error', 'always'],
284
+ 'one-var': ['error', 'never'],
285
+ 'one-var-declaration-per-line': 'error',
286
+ 'operator-assignment': ['error', 'always'],
287
+ 'operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
288
+ 'padded-blocks': [
289
+ 'error',
290
+ 'never',
291
+ {
292
+ allowSingleLineBlocks: false
293
+ }
294
+ ],
295
+ 'prefer-arrow-callback': [
296
+ 'error',
297
+ {
298
+ allowNamedFunctions: true
299
+ }
300
+ ],
301
+ 'prefer-rest-params': 'error',
302
+ 'quote-props': ['error', 'as-needed'],
303
+ quotes: ['error', 'single', { avoidEscape: true }],
304
+ radix: 'error',
305
+ 'id-match': 'off',
306
+ 'require-yield': 'error',
307
+ 'rest-spread-spacing': ['error', 'never'],
308
+ semi: ['error', 'always'],
309
+ 'semi-spacing': [
310
+ 'error',
311
+ {
312
+ before: false,
313
+ after: true
314
+ }
315
+ ],
316
+ 'sort-vars': 'off',
317
+ 'keyword-spacing': [
318
+ 'error',
319
+ {
320
+ before: true,
321
+ after: true
322
+ }
323
+ ],
324
+ 'space-before-blocks': ['error', 'always'],
325
+ 'space-before-function-paren': [
326
+ 'error',
327
+ {
328
+ anonymous: 'always',
329
+ named: 'never',
330
+ asyncArrow: 'always'
331
+ }
332
+ ],
333
+ 'space-in-parens': ['error', 'never'],
334
+ 'space-infix-ops': 'error',
335
+ 'space-unary-ops': 'error',
336
+ 'spaced-comment': [
337
+ 'error',
338
+ 'always',
339
+ {
340
+ line: {
341
+ exceptions: ['-', '+', '*'],
342
+ markers: ['!', '/', '=>']
343
+ },
344
+ block: {
345
+ exceptions: ['-', '+', '*'],
346
+ markers: ['!', '*'],
347
+ balanced: true
348
+ }
349
+ }
350
+ ],
351
+ 'sort-imports': 'off',
352
+ strict: ['error', 'safe'],
353
+ 'template-curly-spacing': 'error',
354
+ 'unicode-bom': ['error', 'never'],
355
+ 'use-isnan': 'error',
356
+ 'valid-typeof': 'error',
357
+ 'vars-on-top': 'error',
358
+ 'wrap-iife': ['error', 'inside'],
359
+ 'wrap-regex': 'off',
360
+ 'yield-star-spacing': ['error', { before: false, after: true }],
361
+ yoda: ['error', 'never'],
362
+ 'capitalized-comments': 'off',
363
+ 'class-methods-use-this': 'error',
364
+ 'func-call-spacing': ['error', 'never'],
365
+ 'func-name-matching': 'off',
366
+ 'line-comment-position': 'off',
367
+ 'no-await-in-loop': 'off',
368
+ 'no-compare-neg-zero': 'error',
369
+ 'no-multi-assign': 'error',
370
+ 'no-restricted-properties': 'off',
371
+ 'no-template-curly-in-string': 'error',
372
+ 'no-unsafe-negation': 'error',
373
+ 'no-useless-return': 'error',
374
+ 'nonblock-statement-body-position': 'off',
375
+ 'prefer-destructuring': [
376
+ 'error',
377
+ {
378
+ VariableDeclarator: {
379
+ array: false,
380
+ object: true
381
+ },
382
+ AssignmentExpression: {
383
+ array: false,
384
+ object: false
385
+ }
386
+ },
387
+ {
388
+ enforceForRenamedProperties: false
389
+ }
390
+ ],
391
+ 'prefer-numeric-literals': 'error',
392
+ 'prefer-promise-reject-errors': [
393
+ 'error',
394
+ {
395
+ allowEmptyReject: false
396
+ }
397
+ ],
398
+ 'require-await': 'off',
399
+ 'sort-keys': 'off',
400
+ 'symbol-description': 'error',
401
+ 'template-tag-spacing': ['error', 'never'],
402
+ 'for-direction': 'off',
403
+ 'padding-line-between-statements': [
404
+ 'error',
405
+ {
406
+ blankLine: 'always',
407
+ prev: 'directive',
408
+ next: '*'
409
+ },
410
+ {
411
+ blankLine: 'any',
412
+ prev: 'directive',
413
+ next: 'directive'
414
+ }
415
+ ],
416
+ 'semi-style': ['error', 'last'],
417
+ 'switch-colon-spacing': [
418
+ 'error',
419
+ {
420
+ after: true,
421
+ before: false
422
+ }
423
+ ],
424
+ 'function-paren-newline': 'off',
425
+ 'getter-return': [
426
+ 'error',
427
+ {
428
+ allowImplicit: false
429
+ }
430
+ ],
431
+ 'implicit-arrow-linebreak': 'off',
432
+ 'lines-between-class-members': [
433
+ 'error',
434
+ 'always',
435
+ {
436
+ exceptAfterSingleLine: true
437
+ }
438
+ ],
439
+ 'multiline-comment-style': 'off',
440
+ 'max-classes-per-file': 'off',
441
+ 'max-lines-per-function': ['error', { max: 50 }],
442
+ 'prefer-object-spread': 'error',
443
+ 'no-async-promise-executor': 'error',
444
+ 'no-misleading-character-class': 'error',
445
+ 'default-param-last': 'error',
446
+ 'prefer-regex-literals': 'error',
447
+ 'require-unicode-regexp': 'off',
448
+ 'function-call-argument-newline': ['error', 'consistent'],
449
+ 'no-useless-catch': 'error',
450
+ 'prefer-named-capture-group': 'error',
451
+ 'no-import-assign': 'error',
452
+ 'require-atomic-updates': 'error',
453
+
454
+ 'no-restricted-imports': 'off',
455
+
456
+ 'no-alert': 'off',
457
+ 'no-script-url': 'off',
458
+ 'no-restricted-globals': 'off',
459
+ 'max-len': [
460
+ 'error',
461
+ {
462
+ code: 120,
463
+ tabWidth: indentSize,
464
+ ignoreComments: true,
465
+ ignoreTrailingComments: true,
466
+ ignoreUrls: true,
467
+ ignoreStrings: false,
468
+ ignoreTemplateLiterals: false,
469
+ ignoreRegExpLiterals: true
470
+ }
471
+ ],
472
+
473
+ 'grouped-accessor-pairs': 'off',
474
+ 'no-constructor-return': 'error',
475
+ 'no-dupe-else-if': 'error',
476
+ 'no-setter-return': 'error',
477
+ 'prefer-exponentiation-operator': 'error',
478
+
479
+ 'default-case-last': 'error',
480
+ 'no-restricted-exports': 'off',
481
+ 'no-useless-backreference': 'error',
482
+ 'id-denylist': 'off',
483
+ 'no-loss-of-precision': 'off',
484
+ 'no-promise-executor-return': 'error',
485
+ 'no-unreachable-loop': 'error',
486
+ 'no-nonoctal-decimal-escape': 'error',
487
+ 'no-unsafe-optional-chaining': 'error',
488
+ 'no-unused-private-class-members': 'error',
489
+ 'no-constant-binary-expression': 'error',
490
+ 'logical-assignment-operators': ['error', 'never'],
491
+ 'prefer-object-has-own': 'error',
492
+
493
+ 'no-secrets/no-secrets': ['error', { tolerance: 5 }],
494
+
495
+ 'eslint-comments/disable-enable-pair': [
496
+ 'error',
497
+ {
498
+ allowWholeFile: true
499
+ }
500
+ ],
501
+ 'eslint-comments/no-aggregating-enable': 'error',
502
+ 'eslint-comments/no-duplicate-disable': 'error',
503
+ 'eslint-comments/no-unused-disable': 'error',
504
+ 'eslint-comments/no-unused-enable': 'error',
505
+ 'eslint-comments/no-restricted-disable': 'off',
506
+ 'eslint-comments/no-unlimited-disable': 'error',
507
+ 'eslint-comments/no-use': 'off',
508
+ 'eslint-comments/require-description': 'error',
509
+
510
+ 'import/no-deprecated': 'error',
511
+ 'import/exports-last': 'off',
512
+ 'import/dynamic-import-chunkname': 'off',
513
+ 'import/unambiguous': 'off',
514
+ 'import/no-dynamic-require': 'error',
515
+ 'import/no-named-export': 'off',
516
+ 'import/no-default-export': 'error',
517
+ 'import/prefer-default-export': 'off',
518
+ 'import/newline-after-import': 'error',
519
+ 'import/no-nodejs-modules': 'off',
520
+ 'import/max-dependencies': ['error', { max: 8 }],
521
+ 'import/first': 'error',
522
+ 'import/no-unused-modules': 'error',
523
+ 'import/no-anonymous-default-export': 'off',
524
+ 'import/no-named-default': 'off',
525
+ 'import/no-cycle': 'error',
526
+ 'import/no-relative-parent-imports': 'off',
527
+ 'import/group-exports': 'off',
528
+ 'import/no-internal-modules': 'off',
529
+ 'import/no-restricted-paths': 'off',
530
+ 'import/named': 'off',
531
+ 'import/no-namespace': 'off',
532
+ 'import/default': 'error',
533
+ 'import/export': 'error',
534
+ 'import/extensions': [
535
+ 'error',
536
+ {
537
+ js: 'always',
538
+ jsx: 'always',
539
+ json: 'always'
540
+ }
541
+ ],
542
+ 'import/namespace': [
543
+ 'error',
544
+ {
545
+ allowComputed: true
546
+ }
547
+ ],
548
+ 'import/no-absolute-path': 'error',
549
+ 'import/no-webpack-loader-syntax': 'error',
550
+ 'import/no-self-import': 'error',
551
+ 'import/no-useless-path-segments': [
552
+ 'error',
553
+ {
554
+ noUselessIndex: true
555
+ }
556
+ ],
557
+ 'import/no-amd': 'error',
558
+ 'import/no-commonjs': 'error',
559
+ 'import/no-duplicates': 'error',
560
+ 'import/no-extraneous-dependencies': 'error',
561
+ 'import/no-mutable-exports': 'error',
562
+ 'import/no-named-as-default-member': 'error',
563
+ 'import/no-named-as-default': 'error',
564
+ 'import/order': 'error',
565
+ 'import/no-unassigned-import': [
566
+ 'error',
567
+ {
568
+ allow: []
569
+ }
570
+ ],
571
+ // this rule doesn’t work correctly for ESM modules which use the exports field in package.json instead of main, see also https://github.com/import-js/eslint-plugin-import/issues/2703
572
+ 'import/no-unresolved': 'off',
573
+ 'import/no-relative-packages': 'off',
574
+ 'import/no-import-module-exports': 'off',
575
+ 'import/no-empty-named-blocks': 'error',
576
+ 'import/consistent-type-specifier-style': 'off'
577
+ }
578
+ };
package/constants.js ADDED
@@ -0,0 +1,4 @@
1
+ export const ecmaVersion = 2022;
2
+ export const indentSize = 4;
3
+ export const javascriptExtensions = ['.js', '.cjs', '.mjs'];
4
+ export const typescriptExtensions = ['.ts', '.cts', '.mts'];
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@enormora/eslint-config-base",
3
+ "version": "0.0.1",
4
+ "dependencies": {
5
+ "eslint-plugin-array-func": "4.0.0",
6
+ "eslint-plugin-destructuring": "2.2.1",
7
+ "eslint-plugin-eslint-comments": "3.2.0",
8
+ "eslint-plugin-import": "2.28.1",
9
+ "eslint-plugin-no-secrets": "0.8.9",
10
+ "eslint-plugin-prettier": "5.0.0",
11
+ "eslint-plugin-promise": "6.1.1",
12
+ "eslint-plugin-sonarjs": "0.21.0",
13
+ "eslint-plugin-unicorn": "^48.0.1"
14
+ },
15
+ "main": "base.js"
16
+ }
@@ -0,0 +1,188 @@
1
+ import unicornPlugin from 'eslint-plugin-unicorn';
2
+ import promisePlugin from 'eslint-plugin-promise';
3
+ import arrayFunctionPlugin from 'eslint-plugin-array-func';
4
+ import sonarjsPlugin from 'eslint-plugin-sonarjs';
5
+
6
+ const maxSwitchCases = 6;
7
+
8
+ export const bestPracticesRuleSet = {
9
+ plugins: {
10
+ unicorn: unicornPlugin,
11
+ promise: promisePlugin,
12
+ 'array-func': arrayFunctionPlugin,
13
+ sonarjs: sonarjsPlugin
14
+ },
15
+ settings: {},
16
+ rules: {
17
+ 'unicorn/string-content': 'off',
18
+ 'unicorn/prefer-string-trim-start-end': 'error',
19
+ 'unicorn/prefer-set-has': 'error',
20
+ 'unicorn/prefer-string-replace-all': 'error',
21
+ 'unicorn/prefer-number-properties': 'error',
22
+ 'unicorn/prefer-negative-index': 'error',
23
+ 'unicorn/prefer-modern-dom-apis': 'off',
24
+ 'unicorn/no-null': 'off',
25
+ 'unicorn/catch-error-name': 'error',
26
+ 'unicorn/consistent-function-scoping': 'off',
27
+ 'unicorn/custom-error-definition': 'off',
28
+ 'unicorn/error-message': 'error',
29
+ 'unicorn/escape-case': 'error',
30
+ 'unicorn/expiring-todo-comments': 'error',
31
+ 'unicorn/explicit-length-check': 'error',
32
+ 'unicorn/no-useless-length-check': 'error',
33
+ 'unicorn/filename-case': 'off',
34
+ 'unicorn/new-for-builtins': 'error',
35
+ 'unicorn/no-abusive-eslint-disable': 'error',
36
+ 'unicorn/no-instanceof-array': 'error',
37
+ 'unicorn/no-console-spaces': 'error',
38
+ 'unicorn/no-array-callback-reference': 'off',
39
+ 'unicorn/no-for-loop': 'error',
40
+ 'unicorn/no-hex-escape': 'error',
41
+ 'unicorn/no-keyword-prefix': 'off',
42
+ 'unicorn/no-nested-ternary': 'off',
43
+ 'unicorn/no-new-buffer': 'error',
44
+ 'unicorn/no-process-exit': 'error',
45
+ 'unicorn/no-unreadable-array-destructuring': 'error',
46
+ 'unicorn/no-unused-properties': 'off',
47
+ 'unicorn/no-zero-fractions': 'error',
48
+ 'unicorn/number-literal-case': 'error',
49
+ 'unicorn/prefer-add-event-listener': 'error',
50
+ 'unicorn/prefer-dom-node-dataset': 'error',
51
+ 'unicorn/prefer-keyboard-event-key': 'error',
52
+ 'unicorn/prefer-array-flat-map': 'error',
53
+ 'unicorn/prefer-includes': 'error',
54
+ 'unicorn/prefer-dom-node-append': 'error',
55
+ 'unicorn/prefer-dom-node-remove': 'error',
56
+ 'unicorn/prefer-query-selector': 'error',
57
+ 'unicorn/prefer-reflect-apply': 'error',
58
+ 'unicorn/prefer-spread': 'off',
59
+ 'unicorn/prefer-string-starts-ends-with': 'error',
60
+ 'unicorn/prefer-string-slice': 'error',
61
+ 'unicorn/prefer-dom-node-text-content': 'error',
62
+ 'unicorn/prefer-type-error': 'error',
63
+ 'unicorn/prevent-abbreviations': 'off',
64
+ 'unicorn/better-regex': 'error',
65
+ 'unicorn/throw-new-error': 'error',
66
+ 'unicorn/no-array-reduce': 'off',
67
+ 'unicorn/no-useless-undefined': 'off',
68
+ 'unicorn/prefer-optional-catch-binding': 'error',
69
+ 'unicorn/no-object-as-default-parameter': 'off',
70
+ 'unicorn/prefer-array-find': 'error',
71
+ 'unicorn/import-style': 'off',
72
+ 'unicorn/numeric-separators-style': 'error',
73
+ 'unicorn/prefer-math-trunc': 'error',
74
+ 'unicorn/prefer-ternary': 'error',
75
+ 'unicorn/prefer-array-some': 'error',
76
+ 'unicorn/prefer-default-parameters': 'error',
77
+ 'unicorn/no-lonely-if': 'error',
78
+ 'unicorn/empty-brace-spaces': 'off',
79
+ 'unicorn/prefer-date-now': 'error',
80
+ 'unicorn/consistent-destructuring': 'off',
81
+ 'unicorn/no-array-for-each': 'off',
82
+ 'unicorn/no-array-push-push': 'error',
83
+ 'unicorn/no-new-array': 'error',
84
+ 'unicorn/no-this-assignment': 'error',
85
+ 'unicorn/prefer-array-index-of': 'error',
86
+ 'unicorn/prefer-regexp-test': 'error',
87
+ 'unicorn/no-static-only-class': 'error',
88
+ 'unicorn/prefer-array-flat': 'error',
89
+ 'unicorn/prefer-module': 'off',
90
+ 'unicorn/prefer-node-protocol': 'error',
91
+ 'unicorn/prefer-switch': 'off',
92
+ 'unicorn/no-document-cookie': 'off',
93
+ 'unicorn/require-array-join-separator': 'off',
94
+ 'unicorn/require-number-to-fixed-digits-argument': 'off',
95
+ 'unicorn/prefer-prototype-methods': 'off',
96
+ 'unicorn/no-array-method-this-argument': 'off',
97
+ 'unicorn/require-post-message-target-origin': 'error',
98
+ 'unicorn/no-useless-spread': 'error',
99
+ 'unicorn/prefer-object-from-entries': 'error',
100
+ 'unicorn/no-useless-fallback-in-spread': 'error',
101
+ 'unicorn/no-invalid-remove-event-listener': 'off',
102
+ 'unicorn/template-indent': 'error',
103
+ 'unicorn/no-empty-file': 'error',
104
+ 'unicorn/prefer-export-from': 'error',
105
+ 'unicorn/no-await-expression-member': 'error',
106
+ 'unicorn/prefer-code-point': 'error',
107
+ 'unicorn/no-thenable': 'off',
108
+ 'unicorn/no-useless-promise-resolve-reject': 'error',
109
+ 'unicorn/prefer-json-parse-buffer': 'off',
110
+ 'unicorn/relative-url-style': 'off',
111
+ 'unicorn/text-encoding-identifier-case': 'off',
112
+ 'unicorn/no-useless-switch-case': 'error',
113
+ 'unicorn/prefer-modern-math-apis': 'error',
114
+ 'unicorn/no-unreadable-iife': 'error',
115
+ 'unicorn/prefer-native-coercion-functions': 'error',
116
+ 'unicorn/prefer-event-target': 'off',
117
+ 'unicorn/prefer-logical-operator-over-ternary': 'off',
118
+ 'unicorn/no-unnecessary-await': 'error',
119
+ 'unicorn/switch-case-braces': 'off',
120
+ 'unicorn/no-negated-condition': 'error',
121
+ 'unicorn/no-typeof-undefined': 'error',
122
+ 'unicorn/prefer-set-size': 'error',
123
+ 'unicorn/prefer-blob-reading-methods': 'error',
124
+ 'unicorn/prefer-top-level-await': 'off',
125
+ 'unicorn/prefer-at': 'error',
126
+
127
+ 'array-func/from-map': 'error',
128
+ 'array-func/no-unnecessary-this-arg': 'error',
129
+ 'array-func/prefer-array-from': 'error',
130
+ 'array-func/avoid-reverse': 'error',
131
+ 'array-func/prefer-flat-map': 'error',
132
+ 'array-func/prefer-flat': 'error',
133
+
134
+ 'sonarjs/cognitive-complexity': 'off',
135
+ 'sonarjs/elseif-without-else': 'off',
136
+ 'sonarjs/max-switch-cases': ['error', maxSwitchCases],
137
+ 'sonarjs/no-all-duplicated-branches': 'error',
138
+ 'sonarjs/no-collapsible-if': 'error',
139
+ 'sonarjs/no-collection-size-mischeck': 'error',
140
+ 'sonarjs/no-duplicate-string': 'off',
141
+ 'sonarjs/no-duplicated-branches': 'error',
142
+ 'sonarjs/no-element-overwrite': 'error',
143
+ 'sonarjs/no-empty-collection': 'error',
144
+ 'sonarjs/no-extra-arguments': 'off',
145
+ 'sonarjs/no-gratuitous-expressions': 'error',
146
+ 'sonarjs/no-identical-conditions': 'error',
147
+ 'sonarjs/no-identical-expressions': 'error',
148
+ 'sonarjs/no-identical-functions': 'error',
149
+ 'sonarjs/no-ignored-return': 'error',
150
+ 'sonarjs/no-inverted-boolean-check': 'error',
151
+ 'sonarjs/no-nested-switch': 'error',
152
+ 'sonarjs/no-nested-template-literals': 'error',
153
+ 'sonarjs/no-one-iteration-loop': 'error',
154
+ 'sonarjs/no-redundant-boolean': 'off',
155
+ 'sonarjs/no-redundant-jump': 'off',
156
+ 'sonarjs/no-same-line-conditional': 'error',
157
+ 'sonarjs/no-small-switch': 'error',
158
+ 'sonarjs/no-unused-collection': 'error',
159
+ 'sonarjs/no-use-of-empty-return-value': 'error',
160
+ 'sonarjs/no-useless-catch': 'error',
161
+ 'sonarjs/non-existent-operator': 'error',
162
+ 'sonarjs/prefer-immediate-return': 'off',
163
+ 'sonarjs/prefer-object-literal': 'error',
164
+ 'sonarjs/prefer-single-boolean-return': 'error',
165
+ 'sonarjs/prefer-while': 'error',
166
+
167
+ 'promise/avoid-new': 'off',
168
+ 'promise/no-nesting': 'error',
169
+ 'promise/no-promise-in-callback': 'error',
170
+ 'promise/no-callback-in-promise': 'error',
171
+ 'promise/no-native': 'off',
172
+ 'promise/prefer-await-to-callbacks': 'off',
173
+ 'promise/catch-or-return': 'error',
174
+ 'promise/always-return': 'off',
175
+ 'promise/param-names': 'error',
176
+ 'promise/no-return-wrap': [
177
+ 'error',
178
+ {
179
+ allowReject: true
180
+ }
181
+ ],
182
+ 'promise/no-new-statics': 'error',
183
+ 'promise/no-return-in-finally': 'error',
184
+ 'promise/valid-params': 'error',
185
+ 'promise/prefer-await-to-then': 'error',
186
+ 'promise/no-multiple-resolved': 'error'
187
+ }
188
+ };
@@ -0,0 +1,19 @@
1
+ import prettierPlugin from 'eslint-plugin-prettier';
2
+ import destructuringPlugin from 'eslint-plugin-destructuring';
3
+
4
+ export const stylisticRuleSet = {
5
+ plugins: {
6
+ prettier: prettierPlugin,
7
+ destructuring: destructuringPlugin
8
+ },
9
+
10
+ settings: {},
11
+
12
+ rules: {
13
+ 'prettier/prettier': 'error',
14
+
15
+ 'destructuring/in-methods-params': 'error',
16
+ 'destructuring/in-params': ['error', { 'max-params': 0 }],
17
+ 'destructuring/no-rename': 'off'
18
+ }
19
+ };