forked from gavinaiken/rbac2
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.json
797 lines (797 loc) · 15.5 KB
/
.eslintrc.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
// Refer to http://eslint.org/docs/rules/ for details on each rule and how to configure them
{
"env": {
"node": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 8 // support for async/await
},
"rules": {
// Possible errors
"no-await-in-loop": [
0
],
"no-compare-neg-zero": [
"error"
],
"no-cond-assign": [
"error"
],
"no-console": [
"error"
],
"no-constant-condition": [
"error"
],
"no-control-regex": [
"error"
],
"no-debugger": [
"error"
],
"no-dupe-args": [
"error"
],
"no-dupe-keys": [
"error"
],
"no-duplicate-case": [
"error"
],
"no-empty": [
"error"
],
"no-empty-character-class": [
"error"
],
"no-ex-assign": [
"error"
],
"no-extra-boolean-cast": [
"error"
],
"no-extra-parens": [
"error",
"all", {
"nestedBinaryExpressions": false
}
],
"no-extra-semi": [
"error"
],
"no-func-assign": [
"error"
],
"no-inner-declarations": [
"error"
],
"no-invalid-regexp": [
"error"
],
"no-irregular-whitespace": [
"error"
],
"no-obj-calls": [
"error"
],
"no-regex-spaces": [
"error"
],
"no-sparse-arrays": [
"error"
],
"no-template-curly-in-string": [
"error"
],
"no-unexpected-multiline": [
"error"
],
"no-unreachable": [
"error"
],
"no-unsafe-finally": [
"error"
],
"no-unsafe-negation": [
"error"
],
"use-isnan": [
"error"
],
"valid-jsdoc": [
"error"
],
"valid-typeof": [
"error"
],
// Best practices
"accessor-pairs": [
"error"
],
"array-callback-return": [
"error"
],
"block-scoped-var": [
"error"
],
"class-methods-use-this": [
"error"
],
"complexity": [
"error"
],
"consistent-return": [
"error"
],
"curly": [
"error",
"multi-line",
"consistent"
],
"default-case": [
"error"
],
"dot-location": [
"error",
"property"
],
"dot-notation": [
"error"
],
"eqeqeq": [
"error"
],
"guard-for-in": [
"error"
],
"no-alert": [
"error"
],
"no-caller": [
"error"
],
"no-case-declarations": [
"error"
],
"no-div-regex": [
"error"
],
"no-else-return": [
"error"
],
"no-empty-function": [
"error"
],
"no-empty-pattern": [
"error"
],
"no-eq-null": [
"error"
],
"no-eval": [
"error"
],
"no-extend-native": [
"error"
],
"no-extra-bind": [
"error"
],
"no-extra-label": [
"error"
],
"no-fallthrough": [
"error"
],
"no-floating-decimal": [
"error"
],
"no-global-assign": [
"error"
],
"no-implicit-coercion": [
"error"
],
"no-implicit-globals": [
"error"
],
"no-implied-eval": [
"error"
],
"no-invalid-this": [
"error"
],
"no-iterator": [
"error"
],
"no-labels": [
"error"
],
"no-lone-blocks": [
"error"
],
"no-loop-func": [
"error"
],
"no-magic-numbers": [
"error", {
"ignoreArrayIndexes": true,
"ignore": [-1,
0,
1
]
}
],
"no-multi-spaces": [
"error"
],
"no-multi-str": [
"error"
],
"no-new": [
"error"
],
"no-new-func": [
"error"
],
"no-new-wrappers": [
"error"
],
"no-octal": [
"error"
],
"no-octal-escape": [
"error"
],
"no-proto": [
"error"
],
"no-redeclare": [
"error"
],
"no-restricted-properties": [
"error", {
"object": "arguments",
"property": "callee",
"message": "arguments.callee is deprecated"
}, {
"property": "__defineGetter__",
"message": "Please use Object.defineProperty instead."
}, {
"property": "__defineSetter__",
"message": "Please use Object.defineProperty instead."
}, {
"object": "Math",
"property": "pow",
"message": "Use the exponentiation operator (**) instead."
}
],
"no-return-assign": [
"error"
],
"no-return-await": [
"error"
],
"no-script-url": [
"error"
],
"no-self-assign": [
"error"
],
"no-self-compare": [
"error"
],
"no-sequences": [
"error"
],
"no-throw-literal": [
"error"
],
"no-unmodified-loop-condition": [
"error"
],
"no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
],
"chai-friendly/no-unused-expressions": [
0
],
"no-unused-labels": [
"error"
],
"no-useless-call": [
"error"
],
"no-useless-concat": [
"error"
],
"no-useless-escape": [
"error"
],
"no-useless-return": [
"error"
],
"no-void": [
"error"
],
"no-with": [
"error"
],
"radix": [
"error"
],
"yoda": [
"error"
],
// Variables
"no-catch-shadow": [
"off"
],
"no-delete-var": [
"error"
],
"no-label-var": [
"error"
],
"no-restricted-globals": [
"error"
],
"no-shadow": [
"error"
],
"no-shadow-restricted-names": [
"error"
],
"no-undef": [
"error"
],
"no-undef-init": [
"error"
],
"no-undefined": [
"error"
],
// disallow declaration of variables that are used in the code
"no-unused-vars": [
"error", {
"vars": "all",
"args": "after-used"
}
],
"no-use-before-define": [
"error",
"nofunc"
],
// Stylistic Issues
"array-bracket-spacing": [
"error"
],
"block-spacing": [
"error"
],
"brace-style": [
"error"
],
"camelcase": [
"error", {
"properties": "never"
}
],
"comma-dangle": [
"error"
],
// enforce spacing before and after comma
"comma-spacing": [
"error", {
"before": false,
"after": true
}
],
// enforce one true comma style
"comma-style": [
"error",
"last"
],
"computed-property-spacing": [
"error"
],
"consistent-this": [
"error",
"self"
],
// enforce newline at the end of file, with no multiple empty lines
"eol-last": [
"error",
"always"
],
"func-call-spacing": [
"error"
],
"func-name-matching": [
"error"
],
"id-blacklist": [
"error"
],
"id-length": [ "off" ],
"id-match": [
"error"
],
"indent": [
"error",
2, {
"MemberExpression": 1,
"FunctionDeclaration": {
"parameters": "first"
},
"CallExpression": {
"arguments": 1
},
"ArrayExpression": 1,
"ObjectExpression": 1
}
],
// enforces spacing between keys and values in object literal properties
"key-spacing": [
"error", {
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"error"
],
"linebreak-style": [
"error",
"unix"
],
"lines-around-comment": [
"error"
],
"lines-around-directive": [
"error"
],
"max-depth": [
"error"
],
"max-len": [
"error", {
"code": 120
}
],
"max-nested-callbacks": [
"error"
],
"max-params": [
"error",
5
],
"max-statements": [
"error",
20
],
"max-statements-per-line": [
"error"
],
"new-cap": [
"error"
],
"new-parens": [
"error"
],
"newline-per-chained-call": [
"error"
],
"no-array-constructor": [
"error"
],
"no-bitwise": [
"error"
],
"no-continue": [
"error"
],
"no-lonely-if": [
"error"
],
"no-mixed-operators": [
"error"
],
"no-mixed-spaces-and-tabs": [
"error"
],
"no-multi-assign": [
"error"
],
// disallow multiple empty lines and only one newline at the end
"no-multiple-empty-lines": [
"error", {
"max": 2,
"maxEOF": 1
}
],
"no-negated-condition": [
"error"
],
"no-nested-ternary": [
"error"
],
"no-new-object": [
"error"
],
"no-restricted-syntax": [
"error", {
"selector": "ForInStatement",
"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."
}, {
"selector": "ForOfStatement",
"message": "iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations."
}, {
"selector": "LabeledStatement",
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
}, {
"selector": "WithStatement",
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
],
"no-tabs": [
"error"
],
"no-trailing-spaces": [
"error"
],
"no-unneeded-ternary": [
"error"
],
"no-whitespace-before-property": [
"error"
],
"nonblock-statement-body-position": [
"error"
],
"object-curly-newline": [
"error", {
"multiline": true,
"minProperties": 0,
"consistent": true
}
],
"object-curly-spacing": [
"error",
"always"
],
"object-property-newline": [
"error"
],
"one-var": [
"error",
"never"
],
"one-var-declaration-per-line": [
"error"
],
"operator-assignment": [
"error",
"always"
],
"operator-linebreak": [
"error",
"after"
],
"quote-props": [
"error",
"as-needed"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"semi-spacing": [
"error"
],
"space-before-blocks": [
"error"
],
"space-before-function-paren": [
"error", {
"anonymous": "always",
"named": "never"
}
],
"space-in-parens": [
"error"
],
"space-infix-ops": [
"error"
],
"space-unary-ops": [
"error"
],
"spaced-comment": [
"error",
"always", {
"line": {
"markers": [
"/"
],
"exceptions": [
"-",
"+"
]
},
"block": {
"markers": [
"!"
],
"exceptions": [
"*"
],
"balanced": true
}
}
],
"template-tag-spacing": [
"error"
],
"unicode-bom": [
"error"
],
"wrap-regex": [
"error"
],
// Node.js rules
"callback-return": [
"error"
],
"global-require": [
"error"
],
"handle-callback-err": [
"error"
],
"no-mixed-requires": [
"error"
],
"no-new-require": [
"error"
],
"no-path-concat": [
"error"
],
"no-process-exit": [
"error"
],
"no-restricted-modules": [
"error"
],
"no-sync": [
"error"
],
// require immediate function invocation to be wrapped in parentheses
// http://eslint.org/docs/rules/wrap-iife.html
"wrap-iife": [
"error",
"inside", {
"functionPrototypeMethods": false
}
],
// ES6 RULES
// enforces no braces where they can be omitted
// http://eslint.org/docs/rules/arrow-body-style
// TODO: enable requireReturnForObjectLiteral?
"arrow-body-style": [
"error",
"as-needed", {
"requireReturnForObjectLiteral": false
}
],
// require parens in arrow function arguments
// http://eslint.org/docs/rules/arrow-parens
"arrow-parens": [
"error",
"as-needed", {
"requireForBlockBody": true
}
],
// require space before/after arrow function"s arrow
// http://eslint.org/docs/rules/arrow-spacing
"arrow-spacing": [
"error", {
"before": true,
"after": true
}
],
// Allow "confusing arrows" since, well, we don't confuse them
// http://eslint.org/docs/rules/no-confusing-arrow
"no-confusing-arrow": "off",
// disallow modifying variables that are declared using const
"no-const-assign": "error",
// disallow renaming import, export, and destructured assignments to the same name
// http://eslint.org/docs/rules/no-useless-rename
"no-useless-rename": [
"error", {
"ignoreDestructuring": false,
"ignoreImport": false,
"ignoreExport": false
}
],
// require let or const instead of var
"no-var": "error",
// require method and property shorthand syntax for object literals
// http://eslint.org/docs/rules/object-shorthand
"object-shorthand": [
"error",
"always", {
"ignoreConstructors": false,
"avoidQuotes": true
}
],
// suggest using arrow functions as callbacks
"prefer-arrow-callback": [
"error", {
"allowNamedFunctions": false,
"allowUnboundThis": true
}
],
// suggest using of const declaration for variables that are never modified after declared
"prefer-const": [
"error", {
"destructuring": "any",
"ignoreReadBeforeAssign": true
}
],
// Prefer destructuring from arrays and objects
// http://eslint.org/docs/rules/prefer-destructuring
// TODO: enable
"prefer-destructuring": [
"off", {
"VariableDeclarator": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": true,
"object": true
}
}, {
"enforceForRenamedProperties": false
}
],
// disallow parseInt() in favor of binary, octal, and hexadecimal literals
// http://eslint.org/docs/rules/prefer-numeric-literals
"prefer-numeric-literals": "error",
// suggest using Reflect methods where applicable
// http://eslint.org/docs/rules/prefer-reflect
"prefer-reflect": "off",
// use rest parameters instead of arguments
// http://eslint.org/docs/rules/prefer-rest-params
"prefer-rest-params": "off",
// suggest using the spread operator instead of .apply()
// http://eslint.org/docs/rules/prefer-spread
"prefer-spread": "error",
// suggest using template literals instead of string concatenation
// http://eslint.org/docs/rules/prefer-template
"prefer-template": "error",
// disallow generator functions that do not have yield
// http://eslint.org/docs/rules/require-yield
"require-yield": "error",
// enforce spacing between object rest-spread
// http://eslint.org/docs/rules/rest-spread-spacing
"rest-spread-spacing": [
"error",
"never"
],
// enforce usage of spacing in template strings
// http://eslint.org/docs/rules/template-curly-spacing
"template-curly-spacing": "error"
}
}