@storm-software/eslint 0.80.0 → 0.81.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.
package/dist/preset.mjs CHANGED
@@ -10,7 +10,7 @@ import nxPlugin from '@nx/eslint-plugin';
10
10
  import json from 'eslint-plugin-json';
11
11
  import markdown from 'eslint-plugin-markdown';
12
12
  import prettierConfig from 'eslint-plugin-prettier/recommended';
13
- import react from 'eslint-plugin-react';
13
+ import reactPlugin from 'eslint-plugin-react';
14
14
  import reactCompiler from 'eslint-plugin-react-compiler';
15
15
  import reactHooks from 'eslint-plugin-react-hooks';
16
16
  import tsdoc from 'eslint-plugin-tsdoc';
@@ -345,1025 +345,1034 @@ var src = {
345
345
 
346
346
  const eslint = /*@__PURE__*/getDefaultExportFromCjs(src);
347
347
 
348
- const config$1 = {
349
- /*************************************************************
350
- *
351
- * Base Rules - The core rules that lint for common problems
352
- *
353
- **************************************************************/
354
- /**
355
- * Require return statements in array methods callbacks.
356
- *
357
- * 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
358
- */
359
- "array-callback-return": ["error", { allowImplicit: true }],
360
- /**
361
- * Treat `var` statements as if they were block scoped.
362
- *
363
- * 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
364
- */
365
- "block-scoped-var": "error",
366
- /**
367
- * Require curly braces for multiline blocks.
368
- *
369
- * 🔧 Fixable - https://eslint.org/docs/rules/curly
370
- */
371
- curly: ["warn", "multi-line"],
372
- /**
373
- * Require default clauses in switch statements to be last (if used).
374
- *
375
- * 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
376
- */
377
- "default-case-last": "error",
378
- /**
379
- * Require triple equals (`===` and `!==`).
380
- *
381
- * 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
382
- */
383
- eqeqeq: "error",
384
- /**
385
- * Require grouped accessor pairs in object literals and classes.
386
- *
387
- * 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
388
- */
389
- "grouped-accessor-pairs": "error",
390
- /**
391
- * Disallow use of `alert()`.
392
- *
393
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
394
- */
395
- "no-alert": "error",
396
- /**
397
- * Disallow use of `caller`/`callee`.
398
- *
399
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
400
- */
401
- "no-caller": "error",
402
- /**
403
- * Disallow returning value in constructor.
404
- *
405
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
406
- */
407
- "no-constructor-return": "error",
408
- /**
409
- * Disallow using an `else` if the `if` block contains a return.
410
- *
411
- * 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
412
- */
413
- "no-else-return": "warn",
414
- /**
415
- * Disallow `eval()`.
416
- *
417
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
418
- */
419
- "no-eval": "error",
420
- /**
421
- * Disallow extending native objects.
422
- *
423
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
424
- */
425
- "no-extend-native": "error",
426
- /**
427
- * Disallow unnecessary function binding.
428
- *
429
- * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
430
- */
431
- "no-extra-bind": "error",
432
- /**
433
- * Disallow unnecessary labels.
434
- *
435
- * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
436
- */
437
- "no-extra-label": "error",
438
- /**
439
- * Disallow floating decimals.
440
- *
441
- * 🔧 Fixable - https://eslint.org/docs/rules/no-floating-decimal
442
- */
443
- "no-floating-decimal": "error",
444
- /**
445
- * Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
446
- *
447
- * 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
448
- */
449
- "no-implicit-coercion": "error",
450
- /**
451
- * Disallow use of `eval()`-like methods.
452
- *
453
- * https://eslint.org/docs/rules/no-implied-eval
454
- */
455
- "no-implied-eval": "error",
456
- /**
457
- * Disallow usage of `__iterator__` property.
458
- *
459
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
460
- */
461
- "no-iterator": "error",
462
- /**
463
- * Disallow use of labels for anything other than loops and switches.
464
- *
465
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
466
- */
467
- "no-labels": ["error"],
468
- /**
469
- * Disallow unnecessary nested blocks.
470
- *
471
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
472
- */
473
- "no-lone-blocks": "error",
474
- /**
475
- * Disallow `new` for side effects.
476
- *
477
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-new
478
- */
479
- "no-new": "error",
480
- /**
481
- * Disallow function constructors.
482
- *
483
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
484
- */
485
- "no-new-func": "error",
486
- /**
487
- * Disallow base types wrapper instances, such as `new String('foo')`.
488
- *
489
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
490
- */
491
- "no-new-wrappers": "error",
492
- /**
493
- * Disallow use of octal escape sequences in string literals.
494
- *
495
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
496
- */
497
- "no-octal-escape": "error",
498
- /**
499
- * Disallow reassignment of function parameters.
500
- *
501
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
502
- */
503
- "no-param-reassign": "error",
504
- /**
505
- * Disallow usage of the deprecated `__proto__` property.
506
- *
507
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
508
- */
509
- "no-proto": "error",
510
- /**
511
- * Disallow assignment in `return` statement.
512
- *
513
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
514
- */
515
- "no-return-assign": "error",
516
- /**
517
- * Disallows unnecessary `return await`.
518
- *
519
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-await
520
- */
521
- "no-return-await": "error",
522
- /**
523
- * Disallow use of `javascript:` urls.
524
- *
525
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
526
- */
527
- "no-script-url": "error",
528
- /**
529
- * Disallow comparisons where both sides are exactly the same.
530
- *
531
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
532
- */
533
- "no-self-compare": "error",
534
- /**
535
- * Disallow use of comma operator.
536
- *
537
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
538
- */
539
- "no-sequences": "error",
540
- /**
541
- * Disallow unnecessary `.call()` and `.apply()`.
542
- *
543
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
544
- */
545
- "no-useless-call": "error",
546
- /**
547
- * Disallow unnecessary concatenation of strings.
548
- *
549
- * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-concat
550
- */
551
- "no-useless-concat": "error",
552
- /**
553
- * Disallow redundant return statements.
554
- *
555
- * 🔧 Fixable - https://eslint.org/docs/rules/no-useless-return
556
- */
557
- "no-useless-return": "warn",
558
- /**
559
- * Require using named capture groups in regular expressions.
560
- *
561
- * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
562
- */
563
- "prefer-named-capture-group": "error",
564
- /**
565
- * Require using Error objects as Promise rejection reasons.
566
- *
567
- * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-promise-reject-errors
568
- */
569
- "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
570
- /**
571
- * Disallow use of the RegExp constructor in favor of regular expression
572
- * literals.
573
- *
574
- * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
575
- */
576
- "prefer-regex-literals": "error",
577
- /**
578
- * Disallow "Yoda conditions", ensuring the comparison.
579
- *
580
- * 🔧 Fixable - https://eslint.org/docs/rules/yoda
581
- */
582
- yoda: "warn",
583
- // Enforce “for” loop update clause moving the counter in the right direction
584
- // https://eslint.org/docs/rules/for-direction
585
- "for-direction": "error",
586
- // Enforces that a return statement is present in property getters
587
- // https://eslint.org/docs/rules/getter-return
588
- "getter-return": ["error", { allowImplicit: true }],
589
- // disallow using an async function as a Promise executor
590
- // https://eslint.org/docs/rules/no-async-promise-executor
591
- "no-async-promise-executor": "error",
592
- // Disallow await inside of loops
593
- // https://eslint.org/docs/rules/no-await-in-loop
594
- "no-await-in-loop": "error",
595
- // Disallow comparisons to negative zero
596
- // https://eslint.org/docs/rules/no-compare-neg-zero
597
- "no-compare-neg-zero": "error",
598
- // disallow assignment in conditional expressions
599
- "no-cond-assign": ["error", "always"],
600
- // disallow use of console
601
- "no-console": "error",
602
- // Disallows expressions where the operation doesn't affect the value
603
- // https://eslint.org/docs/rules/no-constant-binary-expression
604
- // TODO: semver-major, enable
605
- "no-constant-binary-expression": "off",
606
- // disallow use of constant expressions in conditions
607
- "no-constant-condition": "warn",
608
- // disallow control characters in regular expressions
609
- "no-control-regex": "error",
610
- // disallow use of debugger
611
- "no-debugger": "warn",
612
- // disallow duplicate arguments in functions
613
- "no-dupe-args": "error",
614
- // Disallow duplicate conditions in if-else-if chains
615
- // https://eslint.org/docs/rules/no-dupe-else-if
616
- "no-dupe-else-if": "error",
617
- // disallow duplicate keys when creating object literals
618
- "no-dupe-keys": "error",
619
- // disallow a duplicate case label.
620
- "no-duplicate-case": "error",
621
- // disallow empty statements
622
- "no-empty": "error",
623
- // disallow the use of empty character classes in regular expressions
624
- "no-empty-character-class": "error",
625
- // disallow assigning to the exception in a catch block
626
- "no-ex-assign": "error",
627
- // disallow double-negation boolean casts in a boolean context
628
- // https://eslint.org/docs/rules/no-extra-boolean-cast
629
- "no-extra-boolean-cast": "error",
630
- // disallow unnecessary parentheses
631
- // https://eslint.org/docs/rules/no-extra-parens
632
- "no-extra-parens": [
633
- "off",
634
- "all",
635
- {
636
- conditionalAssign: true,
637
- nestedBinaryExpressions: false,
638
- returnAssign: false,
639
- ignoreJSX: "all",
640
- // delegate to eslint-plugin-react
641
- enforceForArrowConditionals: false
642
- }
643
- ],
644
- // disallow unnecessary semicolons
645
- "no-extra-semi": "error",
646
- // disallow overwriting functions written as function declarations
647
- "no-func-assign": "off",
648
- // https://eslint.org/docs/rules/no-import-assign
649
- "no-import-assign": "error",
650
- // disallow function or variable declarations in nested blocks
651
- "no-inner-declarations": "warn",
652
- // disallow invalid regular expression strings in the RegExp constructor
653
- "no-invalid-regexp": "error",
654
- // disallow irregular whitespace outside of strings and comments
655
- "no-irregular-whitespace": "error",
656
- // Disallow Number Literals That Lose Precision
657
- // https://eslint.org/docs/rules/no-loss-of-precision
658
- "no-loss-of-precision": "error",
659
- // Disallow characters which are made with multiple code points in character class syntax
660
- // https://eslint.org/docs/rules/no-misleading-character-class
661
- "no-misleading-character-class": "error",
662
- // disallow the use of object properties of the global object (Math and JSON) as functions
663
- "no-obj-calls": "error",
664
- // Disallow new operators with global non-constructor functions
665
- // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
666
- // TODO: semver-major, enable
667
- "no-new-native-nonconstructor": "off",
668
- // Disallow returning values from Promise executor functions
669
- // https://eslint.org/docs/rules/no-promise-executor-return
670
- "no-promise-executor-return": "error",
671
- // disallow use of Object.prototypes builtins directly
672
- // https://eslint.org/docs/rules/no-prototype-builtins
673
- "no-prototype-builtins": "error",
674
- // disallow multiple spaces in a regular expression literal
675
- "no-regex-spaces": "error",
676
- // Disallow returning values from setters
677
- // https://eslint.org/docs/rules/no-setter-return
678
- "no-setter-return": "error",
679
- // disallow sparse arrays
680
- "no-sparse-arrays": "error",
681
- // Disallow template literal placeholder syntax in regular strings
682
- // https://eslint.org/docs/rules/no-template-curly-in-string
683
- "no-template-curly-in-string": "error",
684
- // Avoid code that looks like two expressions but is actually one
685
- // https://eslint.org/docs/rules/no-unexpected-multiline
686
- "no-unexpected-multiline": "error",
687
- // disallow unreachable statements after a return, throw, continue, or break statement
688
- "no-unreachable": "error",
689
- // Disallow loops with a body that allows only one iteration
690
- // https://eslint.org/docs/rules/no-unreachable-loop
691
- "no-unreachable-loop": [
692
- "error",
693
- {
694
- ignore: []
695
- // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
696
- }
697
- ],
698
- // disallow return/throw/break/continue inside finally blocks
699
- // https://eslint.org/docs/rules/no-unsafe-finally
700
- "no-unsafe-finally": "error",
701
- // disallow negating the left operand of relational operators
702
- // https://eslint.org/docs/rules/no-unsafe-negation
703
- "no-unsafe-negation": "error",
704
- // disallow use of optional chaining in contexts where the undefined value is not allowed
705
- // https://eslint.org/docs/rules/no-unsafe-optional-chaining
706
- "no-unsafe-optional-chaining": [
707
- "error",
708
- { disallowArithmeticOperators: true }
709
- ],
710
- // Disallow Unused Private Class Members
711
- // https://eslint.org/docs/rules/no-unused-private-class-members
712
- // TODO: enable once eslint 7 is dropped (which is semver-major)
713
- "no-unused-private-class-members": "off",
714
- // Disallow useless backreferences in regular expressions
715
- // https://eslint.org/docs/rules/no-useless-backreference
716
- "no-useless-backreference": "error",
717
- // disallow negation of the left operand of an in expression
718
- // deprecated in favor of no-unsafe-negation
719
- "no-negated-in-lhs": "off",
720
- // Disallow assignments that can lead to race conditions due to usage of await or yield
721
- // https://eslint.org/docs/rules/require-atomic-updates
722
- // note: not enabled because it is very buggy
723
- "require-atomic-updates": "off",
724
- // disallow comparisons with the value NaN
725
- "use-isnan": "error",
726
- // ensure JSDoc comments are valid
727
- // https://eslint.org/docs/rules/valid-jsdoc
728
- "valid-jsdoc": "off",
729
- // ensure that the results of typeof are compared against a valid string
730
- // https://eslint.org/docs/rules/valid-typeof
731
- "valid-typeof": ["error", { requireStringLiterals: true }],
732
- /*************************************************************
733
- *
734
- * Stylistic Rules - These rules relate to style guidelines
735
- *
736
- **************************************************************/
737
- // enforce line breaks after opening and before closing array brackets
738
- // https://eslint.org/docs/rules/array-bracket-newline
739
- // TODO: enable? semver-major
740
- "array-bracket-newline": ["off", "consistent"],
741
- // object option alternative: { multiline: true, minItems: 3 }
742
- // enforce line breaks between array elements
743
- // https://eslint.org/docs/rules/array-element-newline
744
- // TODO: enable? semver-major
745
- "array-element-newline": ["off", { multiline: true, minItems: 3 }],
746
- // enforce spacing inside array brackets
747
- "array-bracket-spacing": ["error", "never"],
748
- // enforce spacing inside single-line blocks
749
- // https://eslint.org/docs/rules/block-spacing
750
- "block-spacing": ["error", "always"],
751
- // enforce one true brace style
752
- "brace-style": ["error", "1tbs", { allowSingleLine: true }],
753
- // require camel case names
754
- camelcase: ["error", { properties: "never", ignoreDestructuring: false }],
755
- // enforce or disallow capitalization of the first letter of a comment
756
- // https://eslint.org/docs/rules/capitalized-comments
757
- "capitalized-comments": [
758
- "off",
759
- "never",
760
- {
761
- line: {
762
- ignorePattern: ".*",
763
- ignoreInlineComments: true,
764
- ignoreConsecutiveComments: true
765
- },
766
- block: {
767
- ignorePattern: ".*",
768
- ignoreInlineComments: true,
769
- ignoreConsecutiveComments: true
348
+ const getStormRulesConfig = (options) => {
349
+ let rules = {
350
+ /*************************************************************
351
+ *
352
+ * Base Rules - The core rules that lint for common problems
353
+ *
354
+ **************************************************************/
355
+ /**
356
+ * Require return statements in array methods callbacks.
357
+ *
358
+ * 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
359
+ */
360
+ "array-callback-return": ["error", { allowImplicit: true }],
361
+ /**
362
+ * Treat `var` statements as if they were block scoped.
363
+ *
364
+ * 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
365
+ */
366
+ "block-scoped-var": "error",
367
+ /**
368
+ * Require curly braces for multiline blocks.
369
+ *
370
+ * 🔧 Fixable - https://eslint.org/docs/rules/curly
371
+ */
372
+ curly: ["warn", "multi-line"],
373
+ /**
374
+ * Require default clauses in switch statements to be last (if used).
375
+ *
376
+ * 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
377
+ */
378
+ "default-case-last": "error",
379
+ /**
380
+ * Require triple equals (`===` and `!==`).
381
+ *
382
+ * 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
383
+ */
384
+ eqeqeq: "error",
385
+ /**
386
+ * Require grouped accessor pairs in object literals and classes.
387
+ *
388
+ * 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
389
+ */
390
+ "grouped-accessor-pairs": "error",
391
+ /**
392
+ * Disallow use of `alert()`.
393
+ *
394
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
395
+ */
396
+ "no-alert": "error",
397
+ /**
398
+ * Disallow use of `caller`/`callee`.
399
+ *
400
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
401
+ */
402
+ "no-caller": "error",
403
+ /**
404
+ * Disallow returning value in constructor.
405
+ *
406
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
407
+ */
408
+ "no-constructor-return": "error",
409
+ /**
410
+ * Disallow using an `else` if the `if` block contains a return.
411
+ *
412
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
413
+ */
414
+ "no-else-return": "warn",
415
+ /**
416
+ * Disallow `eval()`.
417
+ *
418
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
419
+ */
420
+ "no-eval": "error",
421
+ /**
422
+ * Disallow extending native objects.
423
+ *
424
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
425
+ */
426
+ "no-extend-native": "error",
427
+ /**
428
+ * Disallow unnecessary function binding.
429
+ *
430
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
431
+ */
432
+ "no-extra-bind": "error",
433
+ /**
434
+ * Disallow unnecessary labels.
435
+ *
436
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
437
+ */
438
+ "no-extra-label": "error",
439
+ /**
440
+ * Disallow floating decimals.
441
+ *
442
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-floating-decimal
443
+ */
444
+ "no-floating-decimal": "error",
445
+ /**
446
+ * Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
447
+ *
448
+ * 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
449
+ */
450
+ "no-implicit-coercion": "error",
451
+ /**
452
+ * Disallow use of `eval()`-like methods.
453
+ *
454
+ * https://eslint.org/docs/rules/no-implied-eval
455
+ */
456
+ "no-implied-eval": "error",
457
+ /**
458
+ * Disallow usage of `__iterator__` property.
459
+ *
460
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
461
+ */
462
+ "no-iterator": "error",
463
+ /**
464
+ * Disallow use of labels for anything other than loops and switches.
465
+ *
466
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
467
+ */
468
+ "no-labels": ["error"],
469
+ /**
470
+ * Disallow unnecessary nested blocks.
471
+ *
472
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
473
+ */
474
+ "no-lone-blocks": "error",
475
+ /**
476
+ * Disallow `new` for side effects.
477
+ *
478
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new
479
+ */
480
+ "no-new": "error",
481
+ /**
482
+ * Disallow function constructors.
483
+ *
484
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
485
+ */
486
+ "no-new-func": "error",
487
+ /**
488
+ * Disallow base types wrapper instances, such as `new String('foo')`.
489
+ *
490
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
491
+ */
492
+ "no-new-wrappers": "error",
493
+ /**
494
+ * Disallow use of octal escape sequences in string literals.
495
+ *
496
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
497
+ */
498
+ "no-octal-escape": "error",
499
+ /**
500
+ * Disallow reassignment of function parameters.
501
+ *
502
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
503
+ */
504
+ "no-param-reassign": "error",
505
+ /**
506
+ * Disallow usage of the deprecated `__proto__` property.
507
+ *
508
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
509
+ */
510
+ "no-proto": "error",
511
+ /**
512
+ * Disallow assignment in `return` statement.
513
+ *
514
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
515
+ */
516
+ "no-return-assign": "error",
517
+ /**
518
+ * Disallows unnecessary `return await`.
519
+ *
520
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-return-await
521
+ */
522
+ "no-return-await": "error",
523
+ /**
524
+ * Disallow use of `javascript:` urls.
525
+ *
526
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
527
+ */
528
+ "no-script-url": "error",
529
+ /**
530
+ * Disallow comparisons where both sides are exactly the same.
531
+ *
532
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
533
+ */
534
+ "no-self-compare": "error",
535
+ /**
536
+ * Disallow use of comma operator.
537
+ *
538
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
539
+ */
540
+ "no-sequences": "error",
541
+ /**
542
+ * Disallow unnecessary `.call()` and `.apply()`.
543
+ *
544
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
545
+ */
546
+ "no-useless-call": "error",
547
+ /**
548
+ * Disallow unnecessary concatenation of strings.
549
+ *
550
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-concat
551
+ */
552
+ "no-useless-concat": "error",
553
+ /**
554
+ * Disallow redundant return statements.
555
+ *
556
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-useless-return
557
+ */
558
+ "no-useless-return": "warn",
559
+ /**
560
+ * Require using named capture groups in regular expressions.
561
+ *
562
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
563
+ */
564
+ "prefer-named-capture-group": "error",
565
+ /**
566
+ * Require using Error objects as Promise rejection reasons.
567
+ *
568
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-promise-reject-errors
569
+ */
570
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
571
+ /**
572
+ * Disallow use of the RegExp constructor in favor of regular expression
573
+ * literals.
574
+ *
575
+ * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
576
+ */
577
+ "prefer-regex-literals": "error",
578
+ /**
579
+ * Disallow "Yoda conditions", ensuring the comparison.
580
+ *
581
+ * 🔧 Fixable - https://eslint.org/docs/rules/yoda
582
+ */
583
+ yoda: "warn",
584
+ // Enforce “for” loop update clause moving the counter in the right direction
585
+ // https://eslint.org/docs/rules/for-direction
586
+ "for-direction": "error",
587
+ // Enforces that a return statement is present in property getters
588
+ // https://eslint.org/docs/rules/getter-return
589
+ "getter-return": ["error", { allowImplicit: true }],
590
+ // disallow using an async function as a Promise executor
591
+ // https://eslint.org/docs/rules/no-async-promise-executor
592
+ "no-async-promise-executor": "error",
593
+ // Disallow await inside of loops
594
+ // https://eslint.org/docs/rules/no-await-in-loop
595
+ "no-await-in-loop": "error",
596
+ // Disallow comparisons to negative zero
597
+ // https://eslint.org/docs/rules/no-compare-neg-zero
598
+ "no-compare-neg-zero": "error",
599
+ // disallow assignment in conditional expressions
600
+ "no-cond-assign": ["error", "always"],
601
+ // disallow use of console
602
+ "no-console": "error",
603
+ // Disallows expressions where the operation doesn't affect the value
604
+ // https://eslint.org/docs/rules/no-constant-binary-expression
605
+ // TODO: semver-major, enable
606
+ "no-constant-binary-expression": "off",
607
+ // disallow use of constant expressions in conditions
608
+ "no-constant-condition": "warn",
609
+ // disallow control characters in regular expressions
610
+ "no-control-regex": "error",
611
+ // disallow use of debugger
612
+ "no-debugger": "warn",
613
+ // disallow duplicate arguments in functions
614
+ "no-dupe-args": "error",
615
+ // Disallow duplicate conditions in if-else-if chains
616
+ // https://eslint.org/docs/rules/no-dupe-else-if
617
+ "no-dupe-else-if": "error",
618
+ // disallow duplicate keys when creating object literals
619
+ "no-dupe-keys": "error",
620
+ // disallow a duplicate case label.
621
+ "no-duplicate-case": "error",
622
+ // disallow empty statements
623
+ "no-empty": "error",
624
+ // disallow the use of empty character classes in regular expressions
625
+ "no-empty-character-class": "error",
626
+ // disallow assigning to the exception in a catch block
627
+ "no-ex-assign": "error",
628
+ // disallow double-negation boolean casts in a boolean context
629
+ // https://eslint.org/docs/rules/no-extra-boolean-cast
630
+ "no-extra-boolean-cast": "error",
631
+ // disallow unnecessary parentheses
632
+ // https://eslint.org/docs/rules/no-extra-parens
633
+ "no-extra-parens": [
634
+ "off",
635
+ "all",
636
+ {
637
+ conditionalAssign: true,
638
+ nestedBinaryExpressions: false,
639
+ returnAssign: false,
640
+ ignoreJSX: "all",
641
+ // delegate to eslint-plugin-react
642
+ enforceForArrowConditionals: false
770
643
  }
771
- }
772
- ],
773
- // require trailing commas in multiline object literals
774
- "comma-dangle": ["error", "never"],
775
- // enforce spacing before and after comma
776
- "comma-spacing": ["error", { before: false, after: true }],
777
- // enforce one true comma style
778
- "comma-style": [
779
- "error",
780
- "last",
781
- {
782
- exceptions: {
783
- ArrayExpression: false,
784
- ArrayPattern: false,
785
- ArrowFunctionExpression: false,
786
- CallExpression: false,
787
- FunctionDeclaration: false,
788
- FunctionExpression: false,
789
- ImportDeclaration: false,
790
- ObjectExpression: false,
791
- ObjectPattern: false,
792
- VariableDeclaration: false,
793
- NewExpression: false
644
+ ],
645
+ // disallow unnecessary semicolons
646
+ "no-extra-semi": "error",
647
+ // disallow overwriting functions written as function declarations
648
+ "no-func-assign": "off",
649
+ // https://eslint.org/docs/rules/no-import-assign
650
+ "no-import-assign": "error",
651
+ // disallow function or variable declarations in nested blocks
652
+ "no-inner-declarations": "warn",
653
+ // disallow invalid regular expression strings in the RegExp constructor
654
+ "no-invalid-regexp": "error",
655
+ // disallow irregular whitespace outside of strings and comments
656
+ "no-irregular-whitespace": "error",
657
+ // Disallow Number Literals That Lose Precision
658
+ // https://eslint.org/docs/rules/no-loss-of-precision
659
+ "no-loss-of-precision": "error",
660
+ // Disallow characters which are made with multiple code points in character class syntax
661
+ // https://eslint.org/docs/rules/no-misleading-character-class
662
+ "no-misleading-character-class": "error",
663
+ // disallow the use of object properties of the global object (Math and JSON) as functions
664
+ "no-obj-calls": "error",
665
+ // Disallow new operators with global non-constructor functions
666
+ // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
667
+ // TODO: semver-major, enable
668
+ "no-new-native-nonconstructor": "off",
669
+ // Disallow returning values from Promise executor functions
670
+ // https://eslint.org/docs/rules/no-promise-executor-return
671
+ "no-promise-executor-return": "error",
672
+ // disallow use of Object.prototypes builtins directly
673
+ // https://eslint.org/docs/rules/no-prototype-builtins
674
+ "no-prototype-builtins": "error",
675
+ // disallow multiple spaces in a regular expression literal
676
+ "no-regex-spaces": "error",
677
+ // Disallow returning values from setters
678
+ // https://eslint.org/docs/rules/no-setter-return
679
+ "no-setter-return": "error",
680
+ // disallow sparse arrays
681
+ "no-sparse-arrays": "error",
682
+ // Disallow template literal placeholder syntax in regular strings
683
+ // https://eslint.org/docs/rules/no-template-curly-in-string
684
+ "no-template-curly-in-string": "error",
685
+ // Avoid code that looks like two expressions but is actually one
686
+ // https://eslint.org/docs/rules/no-unexpected-multiline
687
+ "no-unexpected-multiline": "error",
688
+ // disallow unreachable statements after a return, throw, continue, or break statement
689
+ "no-unreachable": "error",
690
+ // Disallow loops with a body that allows only one iteration
691
+ // https://eslint.org/docs/rules/no-unreachable-loop
692
+ "no-unreachable-loop": [
693
+ "error",
694
+ {
695
+ ignore: []
696
+ // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
794
697
  }
795
- }
796
- ],
797
- // disallow padding inside computed properties
798
- "computed-property-spacing": ["error", "never"],
799
- // enforces consistent naming when capturing the current execution context
800
- "consistent-this": "off",
801
- // enforce newline at the end of file, with no multiple empty lines
802
- "eol-last": ["error", "always"],
803
- // https://eslint.org/docs/rules/function-call-argument-newline
804
- "function-call-argument-newline": ["error", "consistent"],
805
- // enforce spacing between functions and their invocations
806
- // https://eslint.org/docs/rules/func-call-spacing
807
- "func-call-spacing": ["error", "never"],
808
- // requires function names to match the name of the variable or property to which they are
809
- // assigned
810
- // https://eslint.org/docs/rules/func-name-matching
811
- "func-name-matching": [
812
- "off",
813
- "always",
814
- {
815
- includeCommonJSModuleExports: false,
816
- considerPropertyDescriptor: true
817
- }
818
- ],
819
- // require function expressions to have a name
820
- // https://eslint.org/docs/rules/func-names
821
- "func-names": "warn",
822
- // enforces use of function declarations or expressions
823
- // https://eslint.org/docs/rules/func-style
824
- // TODO: enable
825
- "func-style": ["off", "expression"],
826
- // require line breaks inside function parentheses if there are line breaks between parameters
827
- // https://eslint.org/docs/rules/function-paren-newline
828
- "function-paren-newline": "off",
829
- // ["error", "multiline-arguments"],
830
- // disallow specified identifiers
831
- // https://eslint.org/docs/rules/id-denylist
832
- "id-denylist": "off",
833
- // this option enforces minimum and maximum identifier lengths
834
- // (variable names, property names etc.)
835
- "id-length": "off",
836
- // require identifiers to match the provided regular expression
837
- "id-match": "off",
838
- // Enforce the location of arrow function bodies with implicit returns
839
- // https://eslint.org/docs/rules/implicit-arrow-linebreak
840
- "implicit-arrow-linebreak": "off",
841
- // this option sets a specific tab width for your code
842
- // https://eslint.org/docs/rules/indent
843
- indent: "off",
844
- // [
845
- // "error",
846
- // 2,
847
- // {
848
- // SwitchCase: 1,
849
- // VariableDeclarator: 1,
850
- // outerIIFEBody: 1,
851
- // // MemberExpression: null,
852
- // FunctionDeclaration: {
853
- // parameters: 1,
854
- // body: 1
855
- // },
856
- // FunctionExpression: {
857
- // parameters: 1,
858
- // body: 1
859
- // },
860
- // CallExpression: {
861
- // arguments: 1
862
- // },
863
- // ArrayExpression: 1,
864
- // ObjectExpression: 1,
865
- // ImportDeclaration: 1,
866
- // flatTernaryExpressions: false,
867
- // // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
868
- // ignoredNodes: [
869
- // "JSXElement",
870
- // "JSXElement > *",
871
- // "JSXAttribute",
872
- // "JSXIdentifier",
873
- // "JSXNamespacedName",
874
- // "JSXMemberExpression",
875
- // "JSXSpreadAttribute",
876
- // "JSXExpressionContainer",
877
- // "JSXOpeningElement",
878
- // "JSXClosingElement",
879
- // "JSXFragment",
880
- // "JSXOpeningFragment",
881
- // "JSXClosingFragment",
882
- // "JSXText",
883
- // "JSXEmptyExpression",
884
- // "JSXSpreadChild"
885
- // ],
886
- // ignoreComments: false
887
- // }
888
- // ],
889
- // specify whether double or single quotes should be used in JSX attributes
890
- // https://eslint.org/docs/rules/jsx-quotes
891
- "jsx-quotes": ["off", "prefer-double"],
892
- // enforces spacing between keys and values in object literal properties
893
- "key-spacing": ["error", { beforeColon: false, afterColon: true }],
894
- // require a space before & after certain keywords
895
- "keyword-spacing": [
896
- "error",
897
- {
898
- before: true,
899
- after: true,
900
- overrides: {
901
- return: { after: true },
902
- throw: { after: true },
903
- case: { after: true }
698
+ ],
699
+ // disallow return/throw/break/continue inside finally blocks
700
+ // https://eslint.org/docs/rules/no-unsafe-finally
701
+ "no-unsafe-finally": "error",
702
+ // disallow negating the left operand of relational operators
703
+ // https://eslint.org/docs/rules/no-unsafe-negation
704
+ "no-unsafe-negation": "error",
705
+ // disallow use of optional chaining in contexts where the undefined value is not allowed
706
+ // https://eslint.org/docs/rules/no-unsafe-optional-chaining
707
+ "no-unsafe-optional-chaining": [
708
+ "error",
709
+ { disallowArithmeticOperators: true }
710
+ ],
711
+ // Disallow Unused Private Class Members
712
+ // https://eslint.org/docs/rules/no-unused-private-class-members
713
+ // TODO: enable once eslint 7 is dropped (which is semver-major)
714
+ "no-unused-private-class-members": "off",
715
+ // Disallow useless backreferences in regular expressions
716
+ // https://eslint.org/docs/rules/no-useless-backreference
717
+ "no-useless-backreference": "error",
718
+ // disallow negation of the left operand of an in expression
719
+ // deprecated in favor of no-unsafe-negation
720
+ "no-negated-in-lhs": "off",
721
+ // Disallow assignments that can lead to race conditions due to usage of await or yield
722
+ // https://eslint.org/docs/rules/require-atomic-updates
723
+ // note: not enabled because it is very buggy
724
+ "require-atomic-updates": "off",
725
+ // disallow comparisons with the value NaN
726
+ "use-isnan": "error",
727
+ // ensure JSDoc comments are valid
728
+ // https://eslint.org/docs/rules/valid-jsdoc
729
+ "valid-jsdoc": "off",
730
+ // ensure that the results of typeof are compared against a valid string
731
+ // https://eslint.org/docs/rules/valid-typeof
732
+ "valid-typeof": ["error", { requireStringLiterals: true }],
733
+ /*************************************************************
734
+ *
735
+ * Stylistic Rules - These rules relate to style guidelines
736
+ *
737
+ **************************************************************/
738
+ // enforce line breaks after opening and before closing array brackets
739
+ // https://eslint.org/docs/rules/array-bracket-newline
740
+ // TODO: enable? semver-major
741
+ "array-bracket-newline": ["off", "consistent"],
742
+ // object option alternative: { multiline: true, minItems: 3 }
743
+ // enforce line breaks between array elements
744
+ // https://eslint.org/docs/rules/array-element-newline
745
+ // TODO: enable? semver-major
746
+ "array-element-newline": ["off", { multiline: true, minItems: 3 }],
747
+ // enforce spacing inside array brackets
748
+ "array-bracket-spacing": ["error", "never"],
749
+ // enforce spacing inside single-line blocks
750
+ // https://eslint.org/docs/rules/block-spacing
751
+ "block-spacing": ["error", "always"],
752
+ // enforce one true brace style
753
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
754
+ // require camel case names
755
+ camelcase: ["error", { properties: "never", ignoreDestructuring: false }],
756
+ // enforce or disallow capitalization of the first letter of a comment
757
+ // https://eslint.org/docs/rules/capitalized-comments
758
+ "capitalized-comments": [
759
+ "off",
760
+ "never",
761
+ {
762
+ line: {
763
+ ignorePattern: ".*",
764
+ ignoreInlineComments: true,
765
+ ignoreConsecutiveComments: true
766
+ },
767
+ block: {
768
+ ignorePattern: ".*",
769
+ ignoreInlineComments: true,
770
+ ignoreConsecutiveComments: true
771
+ }
904
772
  }
905
- }
906
- ],
907
- // enforce position of line comments
908
- // https://eslint.org/docs/rules/line-comment-position
909
- // TODO: enable?
910
- "line-comment-position": [
911
- "off",
912
- {
913
- position: "above",
914
- ignorePattern: "",
915
- applyDefaultPatterns: true
916
- }
917
- ],
918
- // disallow mixed 'LF' and 'CRLF' as linebreaks
919
- // https://eslint.org/docs/rules/linebreak-style
920
- "linebreak-style": ["error", "unix"],
921
- // require or disallow an empty line between class members
922
- // https://eslint.org/docs/rules/lines-between-class-members
923
- "lines-between-class-members": [
924
- "error",
925
- "always",
926
- { exceptAfterSingleLine: false }
927
- ],
928
- // enforces empty lines around comments
929
- "lines-around-comment": "off",
930
- // require or disallow newlines around directives
931
- // https://eslint.org/docs/rules/lines-around-directive
932
- "lines-around-directive": [
933
- "error",
934
- {
935
- before: "always",
936
- after: "always"
937
- }
938
- ],
939
- // Require or disallow logical assignment logical operator shorthand
940
- // https://eslint.org/docs/latest/rules/logical-assignment-operators
941
- // TODO, semver-major: enable
942
- "logical-assignment-operators": [
943
- "off",
944
- "always",
945
- {
946
- enforceForIfStatements: true
947
- }
948
- ],
949
- // specify the maximum depth that blocks can be nested
950
- "max-depth": ["off", 4],
951
- // specify the maximum length of a line in your program
952
- // https://eslint.org/docs/rules/max-len
953
- "max-len": [
954
- "error",
955
- 100,
956
- 2,
957
- {
958
- ignoreUrls: true,
959
- ignoreComments: true,
960
- ignoreRegExpLiterals: true,
961
- ignoreStrings: true,
962
- ignoreTemplateLiterals: true
963
- }
964
- ],
965
- // specify the max number of lines in a file
966
- // https://eslint.org/docs/rules/max-lines
967
- "max-lines": [
968
- "off",
969
- {
970
- max: 300,
971
- skipBlankLines: true,
972
- skipComments: true
973
- }
974
- ],
975
- // enforce a maximum function length
976
- // https://eslint.org/docs/rules/max-lines-per-function
977
- "max-lines-per-function": [
978
- "off",
979
- {
980
- max: 50,
981
- skipBlankLines: true,
982
- skipComments: true,
983
- IIFEs: true
984
- }
985
- ],
986
- // specify the maximum depth callbacks can be nested
987
- "max-nested-callbacks": "off",
988
- // limits the number of parameters that can be used in the function declaration.
989
- "max-params": ["off", 3],
990
- // specify the maximum number of statement allowed in a function
991
- "max-statements": ["off", 10],
992
- // restrict the number of statements per line
993
- // https://eslint.org/docs/rules/max-statements-per-line
994
- "max-statements-per-line": ["off", { max: 1 }],
995
- // enforce a particular style for multiline comments
996
- // https://eslint.org/docs/rules/multiline-comment-style
997
- "multiline-comment-style": ["off", "starred-block"],
998
- // require multiline ternary
999
- // https://eslint.org/docs/rules/multiline-ternary
1000
- // TODO: enable?
1001
- "multiline-ternary": ["off", "never"],
1002
- // require a capital letter for constructors
1003
- "new-cap": [
1004
- "error",
1005
- {
1006
- newIsCap: true,
1007
- newIsCapExceptions: [],
1008
- capIsNew: false,
1009
- capIsNewExceptions: ["Immutable.Map", "Immutable.Set", "Immutable.List"]
1010
- }
1011
- ],
1012
- // disallow the omission of parentheses when invoking a constructor with no arguments
1013
- // https://eslint.org/docs/rules/new-parens
1014
- "new-parens": "error",
1015
- // allow/disallow an empty newline after var statement
1016
- "newline-after-var": "off",
1017
- // https://eslint.org/docs/rules/newline-before-return
1018
- "newline-before-return": "off",
1019
- // enforces new line after each method call in the chain to make it
1020
- // more readable and easy to maintain
1021
- // https://eslint.org/docs/rules/newline-per-chained-call
1022
- "newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
1023
- // disallow use of the Array constructor
1024
- "no-array-constructor": "error",
1025
- // disallow use of bitwise operators
1026
- // https://eslint.org/docs/rules/no-bitwise
1027
- "no-bitwise": "off",
1028
- // disallow use of the continue statement
1029
- // https://eslint.org/docs/rules/no-continue
1030
- "no-continue": "error",
1031
- // disallow comments inline after code
1032
- "no-inline-comments": "off",
1033
- // disallow if as the only statement in an else block
1034
- // https://eslint.org/docs/rules/no-lonely-if
1035
- "no-lonely-if": "error",
1036
- // disallow un-paren'd mixes of different operators
1037
- // https://eslint.org/docs/rules/no-mixed-operators
1038
- "no-mixed-operators": [
1039
- "error",
1040
- {
1041
- // the list of arithmetic groups disallows mixing `%` and `**`
1042
- // with other arithmetic operators.
1043
- groups: [
1044
- ["%", "**"],
1045
- ["%", "+"],
1046
- ["%", "-"],
1047
- ["%", "*"],
1048
- ["%", "/"],
1049
- ["/", "*"],
1050
- ["&", "|", "<<", ">>", ">>>"],
1051
- ["==", "!=", "===", "!=="],
1052
- ["&&", "||"]
1053
- ],
1054
- allowSamePrecedence: false
1055
- }
1056
- ],
1057
- // disallow mixed spaces and tabs for indentation
1058
- "no-mixed-spaces-and-tabs": "error",
1059
- // disallow use of chained assignment expressions
1060
- // https://eslint.org/docs/rules/no-multi-assign
1061
- "no-multi-assign": ["error"],
1062
- // disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
1063
- // https://eslint.org/docs/rules/no-multiple-empty-lines
1064
- "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
1065
- // disallow negated conditions
1066
- // https://eslint.org/docs/rules/no-negated-condition
1067
- "no-negated-condition": "off",
1068
- // disallow nested ternary expressions
1069
- "no-nested-ternary": "off",
1070
- // disallow use of the Object constructor
1071
- "no-new-object": "error",
1072
- // disallow use of unary operators, ++ and --
1073
- // https://eslint.org/docs/rules/no-plusplus
1074
- "no-plusplus": "off",
1075
- // disallow certain syntax forms
1076
- // https://eslint.org/docs/rules/no-restricted-syntax
1077
- "no-restricted-syntax": [
1078
- "error",
1079
- {
1080
- selector: "ForInStatement",
1081
- 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."
1082
- },
1083
- {
1084
- selector: "ForOfStatement",
1085
- 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."
1086
- },
1087
- {
1088
- selector: "LabeledStatement",
1089
- message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
1090
- },
1091
- {
1092
- selector: "WithStatement",
1093
- message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
1094
- }
1095
- ],
1096
- // disallow space between function identifier and application
1097
- // deprecated in favor of func-call-spacing
1098
- "no-spaced-func": "off",
1099
- // disallow tab characters entirely
1100
- "no-tabs": "error",
1101
- // disallow the use of ternary operators
1102
- "no-ternary": "off",
1103
- // disallow trailing whitespace at the end of lines
1104
- "no-trailing-spaces": [
1105
- "error",
1106
- {
1107
- skipBlankLines: false,
1108
- ignoreComments: false
1109
- }
1110
- ],
1111
- // disallow dangling underscores in identifiers
1112
- // https://eslint.org/docs/rules/no-underscore-dangle
1113
- "no-underscore-dangle": [
1114
- "off",
1115
- {
1116
- allow: [],
1117
- allowAfterThis: false,
1118
- allowAfterSuper: false,
1119
- enforceInMethodNames: true
1120
- }
1121
- ],
1122
- // disallow the use of Boolean literals in conditional expressions
1123
- // also, prefer `a || b` over `a ? a : b`
1124
- // https://eslint.org/docs/rules/no-unneeded-ternary
1125
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1126
- // disallow whitespace before properties
1127
- // https://eslint.org/docs/rules/no-whitespace-before-property
1128
- "no-whitespace-before-property": "error",
1129
- // enforce the location of single-line statements
1130
- // https://eslint.org/docs/rules/nonblock-statement-body-position
1131
- "nonblock-statement-body-position": ["error", "beside", { overrides: {} }],
1132
- // require padding inside curly braces
1133
- "object-curly-spacing": ["error", "always"],
1134
- // enforce line breaks between braces
1135
- // https://eslint.org/docs/rules/object-curly-newline
1136
- "object-curly-newline": [
1137
- "error",
1138
- {
1139
- ObjectExpression: {
1140
- minProperties: 5,
1141
- multiline: true,
1142
- consistent: true
773
+ ],
774
+ // require trailing commas in multiline object literals
775
+ "comma-dangle": ["error", "never"],
776
+ // enforce spacing before and after comma
777
+ "comma-spacing": ["error", { before: false, after: true }],
778
+ // enforce one true comma style
779
+ "comma-style": [
780
+ "error",
781
+ "last",
782
+ {
783
+ exceptions: {
784
+ ArrayExpression: false,
785
+ ArrayPattern: false,
786
+ ArrowFunctionExpression: false,
787
+ CallExpression: false,
788
+ FunctionDeclaration: false,
789
+ FunctionExpression: false,
790
+ ImportDeclaration: false,
791
+ ObjectExpression: false,
792
+ ObjectPattern: false,
793
+ VariableDeclaration: false,
794
+ NewExpression: false
795
+ }
796
+ }
797
+ ],
798
+ // disallow padding inside computed properties
799
+ "computed-property-spacing": ["error", "never"],
800
+ // enforces consistent naming when capturing the current execution context
801
+ "consistent-this": "off",
802
+ // enforce newline at the end of file, with no multiple empty lines
803
+ "eol-last": ["error", "always"],
804
+ // https://eslint.org/docs/rules/function-call-argument-newline
805
+ "function-call-argument-newline": ["error", "consistent"],
806
+ // enforce spacing between functions and their invocations
807
+ // https://eslint.org/docs/rules/func-call-spacing
808
+ "func-call-spacing": ["error", "never"],
809
+ // requires function names to match the name of the variable or property to which they are
810
+ // assigned
811
+ // https://eslint.org/docs/rules/func-name-matching
812
+ "func-name-matching": [
813
+ "off",
814
+ "always",
815
+ {
816
+ includeCommonJSModuleExports: false,
817
+ considerPropertyDescriptor: true
818
+ }
819
+ ],
820
+ // require function expressions to have a name
821
+ // https://eslint.org/docs/rules/func-names
822
+ "func-names": "warn",
823
+ // enforces use of function declarations or expressions
824
+ // https://eslint.org/docs/rules/func-style
825
+ // TODO: enable
826
+ "func-style": ["off", "expression"],
827
+ // require line breaks inside function parentheses if there are line breaks between parameters
828
+ // https://eslint.org/docs/rules/function-paren-newline
829
+ "function-paren-newline": "off",
830
+ // ["error", "multiline-arguments"],
831
+ // disallow specified identifiers
832
+ // https://eslint.org/docs/rules/id-denylist
833
+ "id-denylist": "off",
834
+ // this option enforces minimum and maximum identifier lengths
835
+ // (variable names, property names etc.)
836
+ "id-length": "off",
837
+ // require identifiers to match the provided regular expression
838
+ "id-match": "off",
839
+ // Enforce the location of arrow function bodies with implicit returns
840
+ // https://eslint.org/docs/rules/implicit-arrow-linebreak
841
+ "implicit-arrow-linebreak": "off",
842
+ // this option sets a specific tab width for your code
843
+ // https://eslint.org/docs/rules/indent
844
+ indent: "off",
845
+ // [
846
+ // "error",
847
+ // 2,
848
+ // {
849
+ // SwitchCase: 1,
850
+ // VariableDeclarator: 1,
851
+ // outerIIFEBody: 1,
852
+ // // MemberExpression: null,
853
+ // FunctionDeclaration: {
854
+ // parameters: 1,
855
+ // body: 1
856
+ // },
857
+ // FunctionExpression: {
858
+ // parameters: 1,
859
+ // body: 1
860
+ // },
861
+ // CallExpression: {
862
+ // arguments: 1
863
+ // },
864
+ // ArrayExpression: 1,
865
+ // ObjectExpression: 1,
866
+ // ImportDeclaration: 1,
867
+ // flatTernaryExpressions: false,
868
+ // // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
869
+ // ignoredNodes: [
870
+ // "JSXElement",
871
+ // "JSXElement > *",
872
+ // "JSXAttribute",
873
+ // "JSXIdentifier",
874
+ // "JSXNamespacedName",
875
+ // "JSXMemberExpression",
876
+ // "JSXSpreadAttribute",
877
+ // "JSXExpressionContainer",
878
+ // "JSXOpeningElement",
879
+ // "JSXClosingElement",
880
+ // "JSXFragment",
881
+ // "JSXOpeningFragment",
882
+ // "JSXClosingFragment",
883
+ // "JSXText",
884
+ // "JSXEmptyExpression",
885
+ // "JSXSpreadChild"
886
+ // ],
887
+ // ignoreComments: false
888
+ // }
889
+ // ],
890
+ // specify whether double or single quotes should be used in JSX attributes
891
+ // https://eslint.org/docs/rules/jsx-quotes
892
+ "jsx-quotes": ["off", "prefer-double"],
893
+ // enforces spacing between keys and values in object literal properties
894
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
895
+ // require a space before & after certain keywords
896
+ "keyword-spacing": [
897
+ "error",
898
+ {
899
+ before: true,
900
+ after: true,
901
+ overrides: {
902
+ return: { after: true },
903
+ throw: { after: true },
904
+ case: { after: true }
905
+ }
906
+ }
907
+ ],
908
+ // enforce position of line comments
909
+ // https://eslint.org/docs/rules/line-comment-position
910
+ // TODO: enable?
911
+ "line-comment-position": [
912
+ "off",
913
+ {
914
+ position: "above",
915
+ ignorePattern: "",
916
+ applyDefaultPatterns: true
917
+ }
918
+ ],
919
+ // disallow mixed 'LF' and 'CRLF' as linebreaks
920
+ // https://eslint.org/docs/rules/linebreak-style
921
+ "linebreak-style": ["error", "unix"],
922
+ // require or disallow an empty line between class members
923
+ // https://eslint.org/docs/rules/lines-between-class-members
924
+ "lines-between-class-members": [
925
+ "error",
926
+ "always",
927
+ { exceptAfterSingleLine: false }
928
+ ],
929
+ // enforces empty lines around comments
930
+ "lines-around-comment": "off",
931
+ // require or disallow newlines around directives
932
+ // https://eslint.org/docs/rules/lines-around-directive
933
+ "lines-around-directive": [
934
+ "error",
935
+ {
936
+ before: "always",
937
+ after: "always"
938
+ }
939
+ ],
940
+ // Require or disallow logical assignment logical operator shorthand
941
+ // https://eslint.org/docs/latest/rules/logical-assignment-operators
942
+ // TODO, semver-major: enable
943
+ "logical-assignment-operators": [
944
+ "off",
945
+ "always",
946
+ {
947
+ enforceForIfStatements: true
948
+ }
949
+ ],
950
+ // specify the maximum depth that blocks can be nested
951
+ "max-depth": ["off", 4],
952
+ // specify the maximum length of a line in your program
953
+ // https://eslint.org/docs/rules/max-len
954
+ "max-len": [
955
+ "error",
956
+ 100,
957
+ 2,
958
+ {
959
+ ignoreUrls: true,
960
+ ignoreComments: true,
961
+ ignoreRegExpLiterals: true,
962
+ ignoreStrings: true,
963
+ ignoreTemplateLiterals: true
964
+ }
965
+ ],
966
+ // specify the max number of lines in a file
967
+ // https://eslint.org/docs/rules/max-lines
968
+ "max-lines": [
969
+ "off",
970
+ {
971
+ max: 300,
972
+ skipBlankLines: true,
973
+ skipComments: true
974
+ }
975
+ ],
976
+ // enforce a maximum function length
977
+ // https://eslint.org/docs/rules/max-lines-per-function
978
+ "max-lines-per-function": [
979
+ "off",
980
+ {
981
+ max: 50,
982
+ skipBlankLines: true,
983
+ skipComments: true,
984
+ IIFEs: true
985
+ }
986
+ ],
987
+ // specify the maximum depth callbacks can be nested
988
+ "max-nested-callbacks": "off",
989
+ // limits the number of parameters that can be used in the function declaration.
990
+ "max-params": ["off", 3],
991
+ // specify the maximum number of statement allowed in a function
992
+ "max-statements": ["off", 10],
993
+ // restrict the number of statements per line
994
+ // https://eslint.org/docs/rules/max-statements-per-line
995
+ "max-statements-per-line": ["off", { max: 1 }],
996
+ // enforce a particular style for multiline comments
997
+ // https://eslint.org/docs/rules/multiline-comment-style
998
+ "multiline-comment-style": ["off", "starred-block"],
999
+ // require multiline ternary
1000
+ // https://eslint.org/docs/rules/multiline-ternary
1001
+ // TODO: enable?
1002
+ "multiline-ternary": ["off", "never"],
1003
+ // require a capital letter for constructors
1004
+ "new-cap": [
1005
+ "error",
1006
+ {
1007
+ newIsCap: true,
1008
+ newIsCapExceptions: [],
1009
+ capIsNew: false,
1010
+ capIsNewExceptions: ["Immutable.Map", "Immutable.Set", "Immutable.List"]
1011
+ }
1012
+ ],
1013
+ // disallow the omission of parentheses when invoking a constructor with no arguments
1014
+ // https://eslint.org/docs/rules/new-parens
1015
+ "new-parens": "error",
1016
+ // allow/disallow an empty newline after var statement
1017
+ "newline-after-var": "off",
1018
+ // https://eslint.org/docs/rules/newline-before-return
1019
+ "newline-before-return": "off",
1020
+ // enforces new line after each method call in the chain to make it
1021
+ // more readable and easy to maintain
1022
+ // https://eslint.org/docs/rules/newline-per-chained-call
1023
+ "newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
1024
+ // disallow use of the Array constructor
1025
+ "no-array-constructor": "error",
1026
+ // disallow use of bitwise operators
1027
+ // https://eslint.org/docs/rules/no-bitwise
1028
+ "no-bitwise": "off",
1029
+ // disallow use of the continue statement
1030
+ // https://eslint.org/docs/rules/no-continue
1031
+ "no-continue": "error",
1032
+ // disallow comments inline after code
1033
+ "no-inline-comments": "off",
1034
+ // disallow if as the only statement in an else block
1035
+ // https://eslint.org/docs/rules/no-lonely-if
1036
+ "no-lonely-if": "error",
1037
+ // disallow un-paren'd mixes of different operators
1038
+ // https://eslint.org/docs/rules/no-mixed-operators
1039
+ "no-mixed-operators": [
1040
+ "error",
1041
+ {
1042
+ // the list of arithmetic groups disallows mixing `%` and `**`
1043
+ // with other arithmetic operators.
1044
+ groups: [
1045
+ ["%", "**"],
1046
+ ["%", "+"],
1047
+ ["%", "-"],
1048
+ ["%", "*"],
1049
+ ["%", "/"],
1050
+ ["/", "*"],
1051
+ ["&", "|", "<<", ">>", ">>>"],
1052
+ ["==", "!=", "===", "!=="],
1053
+ ["&&", "||"]
1054
+ ],
1055
+ allowSamePrecedence: false
1056
+ }
1057
+ ],
1058
+ // disallow mixed spaces and tabs for indentation
1059
+ "no-mixed-spaces-and-tabs": "error",
1060
+ // disallow use of chained assignment expressions
1061
+ // https://eslint.org/docs/rules/no-multi-assign
1062
+ "no-multi-assign": ["error"],
1063
+ // disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
1064
+ // https://eslint.org/docs/rules/no-multiple-empty-lines
1065
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
1066
+ // disallow negated conditions
1067
+ // https://eslint.org/docs/rules/no-negated-condition
1068
+ "no-negated-condition": "off",
1069
+ // disallow nested ternary expressions
1070
+ "no-nested-ternary": "off",
1071
+ // disallow use of the Object constructor
1072
+ "no-new-object": "error",
1073
+ // disallow use of unary operators, ++ and --
1074
+ // https://eslint.org/docs/rules/no-plusplus
1075
+ "no-plusplus": "off",
1076
+ // disallow certain syntax forms
1077
+ // https://eslint.org/docs/rules/no-restricted-syntax
1078
+ "no-restricted-syntax": [
1079
+ "error",
1080
+ {
1081
+ selector: "ForInStatement",
1082
+ 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."
1083
+ },
1084
+ {
1085
+ selector: "ForOfStatement",
1086
+ 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."
1143
1087
  },
1144
- ObjectPattern: { minProperties: 5, multiline: true, consistent: true },
1145
- ImportDeclaration: {
1146
- minProperties: 5,
1147
- multiline: true,
1148
- consistent: true
1088
+ {
1089
+ selector: "LabeledStatement",
1090
+ message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
1149
1091
  },
1150
- ExportDeclaration: {
1151
- minProperties: 5,
1152
- multiline: true,
1153
- consistent: true
1092
+ {
1093
+ selector: "WithStatement",
1094
+ message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
1154
1095
  }
1155
- }
1156
- ],
1157
- // enforce "same line" or "multiple line" on object properties.
1158
- // https://eslint.org/docs/rules/object-property-newline
1159
- "object-property-newline": [
1160
- "error",
1161
- {
1162
- allowAllPropertiesOnSameLine: true
1163
- }
1164
- ],
1165
- // allow just one var statement per function
1166
- "one-var": ["error", "never"],
1167
- // require a newline around variable declaration
1168
- // https://eslint.org/docs/rules/one-var-declaration-per-line
1169
- "one-var-declaration-per-line": ["error", "always"],
1170
- // require assignment operator shorthand where possible or prohibit it entirely
1171
- // https://eslint.org/docs/rules/operator-assignment
1172
- "operator-assignment": ["error", "always"],
1173
- // Requires operator at the beginning of the line in multiline statements
1174
- // https://eslint.org/docs/rules/operator-linebreak
1175
- "operator-linebreak": ["error", "after", { overrides: { "=": "none" } }],
1176
- // disallow padding within blocks
1177
- "padded-blocks": [
1178
- "error",
1179
- {
1180
- blocks: "never",
1181
- classes: "never",
1182
- switches: "never"
1183
- },
1184
- {
1185
- allowSingleLineBlocks: true
1186
- }
1187
- ],
1188
- // Require or disallow padding lines between statements
1189
- // https://eslint.org/docs/rules/padding-line-between-statements
1190
- "padding-line-between-statements": "off",
1191
- // Disallow the use of Math.pow in favor of the ** operator
1192
- // https://eslint.org/docs/rules/prefer-exponentiation-operator
1193
- "prefer-exponentiation-operator": "error",
1194
- // Prefer use of an object spread over Object.assign
1195
- // https://eslint.org/docs/rules/prefer-object-spread
1196
- "prefer-object-spread": "error",
1197
- // require quotes around object literal property names
1198
- // https://eslint.org/docs/rules/quote-props.html
1199
- "quote-props": [
1200
- "error",
1201
- "as-needed",
1202
- { keywords: false, unnecessary: true, numbers: false }
1203
- ],
1204
- // specify whether double or single quotes should be used
1205
- quotes: ["error", "double", { avoidEscape: true }],
1206
- // do not require jsdoc
1207
- // https://eslint.org/docs/rules/require-jsdoc
1208
- "require-jsdoc": "off",
1209
- // require or disallow use of semicolons instead of ASI
1210
- semi: ["error", "always"],
1211
- // enforce spacing before and after semicolons
1212
- "semi-spacing": ["error", { before: false, after: true }],
1213
- // Enforce location of semicolons
1214
- // https://eslint.org/docs/rules/semi-style
1215
- "semi-style": ["error", "last"],
1216
- // requires object keys to be sorted
1217
- "sort-keys": ["off", "asc", { caseSensitive: false, natural: true }],
1218
- // sort variables within the same declaration block
1219
- "sort-vars": "off",
1220
- // require or disallow space before blocks
1221
- "space-before-blocks": "error",
1222
- // require or disallow space before function opening parenthesis
1223
- // https://eslint.org/docs/rules/space-before-function-paren
1224
- "space-before-function-paren": "off",
1225
- //[
1226
- // "error",
1227
- // {
1228
- // anonymous: "always",
1229
- // named: "never",
1230
- // asyncArrow: "always"
1231
- // }
1232
- // ],
1233
- // require or disallow spaces inside parentheses
1234
- "space-in-parens": ["error", "never"],
1235
- // require spaces around operators
1236
- "space-infix-ops": "error",
1237
- // Require or disallow spaces before/after unary operators
1238
- // https://eslint.org/docs/rules/space-unary-ops
1239
- "space-unary-ops": [
1240
- "error",
1241
- {
1242
- words: true,
1243
- nonwords: false,
1244
- overrides: {}
1245
- }
1246
- ],
1247
- // require or disallow a space immediately following the // or /* in a comment
1248
- // https://eslint.org/docs/rules/spaced-comment
1249
- "spaced-comment": [
1250
- "error",
1251
- "always",
1252
- {
1253
- line: {
1254
- exceptions: ["-", "+"],
1255
- markers: ["=", "!", "/"]
1256
- // space here to support sprockets directives, slash for TS /// comments
1096
+ ],
1097
+ // disallow space between function identifier and application
1098
+ // deprecated in favor of func-call-spacing
1099
+ "no-spaced-func": "off",
1100
+ // disallow tab characters entirely
1101
+ "no-tabs": "error",
1102
+ // disallow the use of ternary operators
1103
+ "no-ternary": "off",
1104
+ // disallow trailing whitespace at the end of lines
1105
+ "no-trailing-spaces": [
1106
+ "error",
1107
+ {
1108
+ skipBlankLines: false,
1109
+ ignoreComments: false
1110
+ }
1111
+ ],
1112
+ // disallow dangling underscores in identifiers
1113
+ // https://eslint.org/docs/rules/no-underscore-dangle
1114
+ "no-underscore-dangle": [
1115
+ "off",
1116
+ {
1117
+ allow: [],
1118
+ allowAfterThis: false,
1119
+ allowAfterSuper: false,
1120
+ enforceInMethodNames: true
1121
+ }
1122
+ ],
1123
+ // disallow the use of Boolean literals in conditional expressions
1124
+ // also, prefer `a || b` over `a ? a : b`
1125
+ // https://eslint.org/docs/rules/no-unneeded-ternary
1126
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1127
+ // disallow whitespace before properties
1128
+ // https://eslint.org/docs/rules/no-whitespace-before-property
1129
+ "no-whitespace-before-property": "error",
1130
+ // enforce the location of single-line statements
1131
+ // https://eslint.org/docs/rules/nonblock-statement-body-position
1132
+ "nonblock-statement-body-position": ["error", "beside", { overrides: {} }],
1133
+ // require padding inside curly braces
1134
+ "object-curly-spacing": ["error", "always"],
1135
+ // enforce line breaks between braces
1136
+ // https://eslint.org/docs/rules/object-curly-newline
1137
+ "object-curly-newline": [
1138
+ "error",
1139
+ {
1140
+ ObjectExpression: {
1141
+ minProperties: 5,
1142
+ multiline: true,
1143
+ consistent: true
1144
+ },
1145
+ ObjectPattern: { minProperties: 5, multiline: true, consistent: true },
1146
+ ImportDeclaration: {
1147
+ minProperties: 5,
1148
+ multiline: true,
1149
+ consistent: true
1150
+ },
1151
+ ExportDeclaration: {
1152
+ minProperties: 5,
1153
+ multiline: true,
1154
+ consistent: true
1155
+ }
1156
+ }
1157
+ ],
1158
+ // enforce "same line" or "multiple line" on object properties.
1159
+ // https://eslint.org/docs/rules/object-property-newline
1160
+ "object-property-newline": [
1161
+ "error",
1162
+ {
1163
+ allowAllPropertiesOnSameLine: true
1164
+ }
1165
+ ],
1166
+ // allow just one var statement per function
1167
+ "one-var": ["error", "never"],
1168
+ // require a newline around variable declaration
1169
+ // https://eslint.org/docs/rules/one-var-declaration-per-line
1170
+ "one-var-declaration-per-line": ["error", "always"],
1171
+ // require assignment operator shorthand where possible or prohibit it entirely
1172
+ // https://eslint.org/docs/rules/operator-assignment
1173
+ "operator-assignment": ["error", "always"],
1174
+ // Requires operator at the beginning of the line in multiline statements
1175
+ // https://eslint.org/docs/rules/operator-linebreak
1176
+ "operator-linebreak": ["error", "after", { overrides: { "=": "none" } }],
1177
+ // disallow padding within blocks
1178
+ "padded-blocks": [
1179
+ "error",
1180
+ {
1181
+ blocks: "never",
1182
+ classes: "never",
1183
+ switches: "never"
1257
1184
  },
1258
- block: {
1259
- exceptions: ["-", "+"],
1260
- markers: ["=", "!", ":", "::"],
1261
- // space here to support sprockets directives and flow comment types
1262
- balanced: true
1185
+ {
1186
+ allowSingleLineBlocks: true
1263
1187
  }
1264
- }
1265
- ],
1266
- // Enforce spacing around colons of switch statements
1267
- // https://eslint.org/docs/rules/switch-colon-spacing
1268
- "switch-colon-spacing": ["error", { after: true, before: false }],
1269
- // Require or disallow spacing between template tags and their literals
1270
- // https://eslint.org/docs/rules/template-tag-spacing
1271
- "template-tag-spacing": ["error", "never"],
1272
- // require or disallow the Unicode Byte Order Mark
1273
- // https://eslint.org/docs/rules/unicode-bom
1274
- "unicode-bom": ["error", "never"],
1275
- // require regex literals to be wrapped in parentheses
1276
- "wrap-regex": "off",
1277
- "class-methods-use-this": "off",
1278
- /*************************************************************
1279
- *
1280
- * TypeScript Rules - The following rules are specific to the TypeScript plugin
1281
- *
1282
- **************************************************************/
1283
- // "@typescript-eslint/no-explicit-any": "off",
1284
- // "@typescript-eslint/no-empty-function": "off",
1285
- // "@typescript-eslint/no-var-requires": "off",
1286
- // "@typescript-eslint/ban-ts-comment": "off",
1287
- // "@typescript-eslint/no-empty-interface": "off",
1288
- // "@typescript-eslint/explicit-module-boundary-types": "off",
1289
- // "@typescript-eslint/explicit-function-return-type": "off",
1290
- // "@typescript-eslint/no-unused-vars": [
1291
- // "warn",
1292
- // { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }
1293
- // ],
1294
- // "@typescript-eslint/prefer-nullish-coalescing": [
1295
- // "error",
1296
- // {
1297
- // ignorePrimitives: {
1298
- // string: true
1299
- // }
1300
- // }
1301
- // ],
1302
- // "@typescript-eslint/no-restricted-imports": [
1303
- // "error",
1304
- // {
1305
- // "patterns": [
1306
- // {
1307
- // "group": ["nx/src/plugins/js*"],
1308
- // "message":
1309
- // "Imports from 'nx/src/plugins/js' are not allowed. Use '@nx/js' instead"
1310
- // },
1311
- // {
1312
- // "group": ["**/native-bindings", "**/native-bindings.js"],
1313
- // "message":
1314
- // "Direct imports from native-bindings.js are not allowed. Import from index.js instead."
1315
- // },
1316
- // {
1317
- // "group": ["create-storm-workspace"],
1318
- // "message":
1319
- // "Direct imports from `create-storm-workspace` are not allowed. Instead install this package globally (example: 'npm i create-storm-workspace -g')."
1320
- // },
1321
- // {
1322
- // "group": ["create-nx-workspace"],
1323
- // "message":
1324
- // "Direct imports from `create-nx-workspace` are not allowed. Instead install this package globally (example: 'npm i create-nx-workspace -g')."
1325
- // }
1326
- // ]
1327
- // }
1328
- // ],
1329
- /*************************************************************
1330
- *
1331
- * Unicorn Rules - The following rules are specific to the Unicorn plugin
1332
- *
1333
- **************************************************************/
1334
- "unicorn/number-literal-case": "off",
1335
- "unicorn/template-indent": "off",
1336
- "unicorn/prevent-abbreviations": "off",
1337
- "unicorn/no-await-expression-member": "off",
1338
- "unicorn/no-useless-undefined": "off",
1339
- "unicorn/no-array-push-push": "off",
1340
- "unicorn/no-array-reduce": "off",
1341
- "unicorn/no-useless-switch-case": "off",
1342
- "unicorn/prefer-string-replace-all": "off",
1343
- "unicorn/no-abusive-eslint-disable": "off",
1344
- "unicorn/import-style": "off",
1345
- "unicorn/prefer-module": "off",
1346
- "unicorn/consistent-function-scoping": "off",
1347
- "unicorn/no-nested-ternary": "off",
1348
- /*************************************************************
1349
- *
1350
- * Nx Rules - The following rules are specific to the Nx plugin
1351
- *
1352
- **************************************************************/
1353
- "@nx/enforce-module-boundaries": [
1354
- "error",
1355
- {
1356
- enforceBuildableLibDependency: true,
1357
- checkDynamicDependenciesExceptions: [".*"],
1358
- allow: [],
1359
- depConstraints: [
1188
+ ],
1189
+ // Require or disallow padding lines between statements
1190
+ // https://eslint.org/docs/rules/padding-line-between-statements
1191
+ "padding-line-between-statements": "off",
1192
+ // Disallow the use of Math.pow in favor of the ** operator
1193
+ // https://eslint.org/docs/rules/prefer-exponentiation-operator
1194
+ "prefer-exponentiation-operator": "error",
1195
+ // Prefer use of an object spread over Object.assign
1196
+ // https://eslint.org/docs/rules/prefer-object-spread
1197
+ "prefer-object-spread": "error",
1198
+ // require quotes around object literal property names
1199
+ // https://eslint.org/docs/rules/quote-props.html
1200
+ "quote-props": [
1201
+ "error",
1202
+ "as-needed",
1203
+ { keywords: false, unnecessary: true, numbers: false }
1204
+ ],
1205
+ // specify whether double or single quotes should be used
1206
+ quotes: ["error", "double", { avoidEscape: true }],
1207
+ // do not require jsdoc
1208
+ // https://eslint.org/docs/rules/require-jsdoc
1209
+ "require-jsdoc": "off",
1210
+ // require or disallow use of semicolons instead of ASI
1211
+ semi: ["error", "always"],
1212
+ // enforce spacing before and after semicolons
1213
+ "semi-spacing": ["error", { before: false, after: true }],
1214
+ // Enforce location of semicolons
1215
+ // https://eslint.org/docs/rules/semi-style
1216
+ "semi-style": ["error", "last"],
1217
+ // requires object keys to be sorted
1218
+ "sort-keys": ["off", "asc", { caseSensitive: false, natural: true }],
1219
+ // sort variables within the same declaration block
1220
+ "sort-vars": "off",
1221
+ // require or disallow space before blocks
1222
+ "space-before-blocks": "error",
1223
+ // require or disallow space before function opening parenthesis
1224
+ // https://eslint.org/docs/rules/space-before-function-paren
1225
+ "space-before-function-paren": "off",
1226
+ //[
1227
+ // "error",
1228
+ // {
1229
+ // anonymous: "always",
1230
+ // named: "never",
1231
+ // asyncArrow: "always"
1232
+ // }
1233
+ // ],
1234
+ // require or disallow spaces inside parentheses
1235
+ "space-in-parens": ["error", "never"],
1236
+ // require spaces around operators
1237
+ "space-infix-ops": "error",
1238
+ // Require or disallow spaces before/after unary operators
1239
+ // https://eslint.org/docs/rules/space-unary-ops
1240
+ "space-unary-ops": [
1241
+ "error",
1242
+ {
1243
+ words: true,
1244
+ nonwords: false,
1245
+ overrides: {}
1246
+ }
1247
+ ],
1248
+ // require or disallow a space immediately following the // or /* in a comment
1249
+ // https://eslint.org/docs/rules/spaced-comment
1250
+ "spaced-comment": [
1251
+ "error",
1252
+ "always",
1253
+ {
1254
+ line: {
1255
+ exceptions: ["-", "+"],
1256
+ markers: ["=", "!", "/"]
1257
+ // space here to support sprockets directives, slash for TS /// comments
1258
+ },
1259
+ block: {
1260
+ exceptions: ["-", "+"],
1261
+ markers: ["=", "!", ":", "::"],
1262
+ // space here to support sprockets directives and flow comment types
1263
+ balanced: true
1264
+ }
1265
+ }
1266
+ ],
1267
+ // Enforce spacing around colons of switch statements
1268
+ // https://eslint.org/docs/rules/switch-colon-spacing
1269
+ "switch-colon-spacing": ["error", { after: true, before: false }],
1270
+ // Require or disallow spacing between template tags and their literals
1271
+ // https://eslint.org/docs/rules/template-tag-spacing
1272
+ "template-tag-spacing": ["error", "never"],
1273
+ // require or disallow the Unicode Byte Order Mark
1274
+ // https://eslint.org/docs/rules/unicode-bom
1275
+ "unicode-bom": ["error", "never"],
1276
+ // require regex literals to be wrapped in parentheses
1277
+ "wrap-regex": "off",
1278
+ "class-methods-use-this": "off",
1279
+ /*************************************************************
1280
+ *
1281
+ * Nx Rules - The following rules are specific to the Nx plugin
1282
+ *
1283
+ **************************************************************/
1284
+ "@nx/enforce-module-boundaries": [
1285
+ "error",
1286
+ {
1287
+ enforceBuildableLibDependency: true,
1288
+ checkDynamicDependenciesExceptions: [".*"],
1289
+ allow: [],
1290
+ depConstraints: [
1291
+ {
1292
+ sourceTag: "*",
1293
+ onlyDependOnLibsWithTags: ["*"]
1294
+ }
1295
+ ]
1296
+ }
1297
+ ]
1298
+ };
1299
+ if (options.useTypeScriptEslint) {
1300
+ rules = {
1301
+ ...rules,
1302
+ /*************************************************************
1303
+ *
1304
+ * TypeScript Rules - The following rules are specific to the TypeScript plugin
1305
+ *
1306
+ **************************************************************/
1307
+ "@typescript-eslint/no-explicit-any": "off",
1308
+ "@typescript-eslint/no-empty-function": "off",
1309
+ "@typescript-eslint/no-var-requires": "off",
1310
+ "@typescript-eslint/ban-ts-comment": "off",
1311
+ "@typescript-eslint/no-empty-interface": "off",
1312
+ "@typescript-eslint/explicit-module-boundary-types": "off",
1313
+ "@typescript-eslint/explicit-function-return-type": "off",
1314
+ "@typescript-eslint/no-unused-vars": [
1315
+ "warn",
1316
+ { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }
1317
+ ],
1318
+ "@typescript-eslint/prefer-nullish-coalescing": [
1319
+ "error",
1360
1320
  {
1361
- sourceTag: "*",
1362
- onlyDependOnLibsWithTags: ["*"]
1321
+ ignorePrimitives: {
1322
+ string: true
1323
+ }
1324
+ }
1325
+ ],
1326
+ "@typescript-eslint/no-restricted-imports": [
1327
+ "error",
1328
+ {
1329
+ "patterns": [
1330
+ {
1331
+ "group": ["nx/src/plugins/js*"],
1332
+ "message": "Imports from 'nx/src/plugins/js' are not allowed. Use '@nx/js' instead"
1333
+ },
1334
+ {
1335
+ "group": ["**/native-bindings", "**/native-bindings.js"],
1336
+ "message": "Direct imports from native-bindings.js are not allowed. Import from index.js instead."
1337
+ },
1338
+ {
1339
+ "group": ["create-storm-workspace"],
1340
+ "message": "Direct imports from `create-storm-workspace` are not allowed. Instead install this package globally (example: 'npm i create-storm-workspace -g')."
1341
+ },
1342
+ {
1343
+ "group": ["create-nx-workspace"],
1344
+ "message": "Direct imports from `create-nx-workspace` are not allowed. Instead install this package globally (example: 'npm i create-nx-workspace -g')."
1345
+ }
1346
+ ]
1363
1347
  }
1364
1348
  ]
1365
- }
1366
- ]
1349
+ };
1350
+ }
1351
+ if (options.useUnicorn) {
1352
+ rules = {
1353
+ ...rules,
1354
+ /*************************************************************
1355
+ *
1356
+ * Unicorn Rules - The following rules are specific to the Unicorn plugin
1357
+ *
1358
+ **************************************************************/
1359
+ "unicorn/number-literal-case": "off",
1360
+ "unicorn/template-indent": "off",
1361
+ "unicorn/prevent-abbreviations": "off",
1362
+ "unicorn/no-await-expression-member": "off",
1363
+ "unicorn/no-useless-undefined": "off",
1364
+ "unicorn/no-array-push-push": "off",
1365
+ "unicorn/no-array-reduce": "off",
1366
+ "unicorn/no-useless-switch-case": "off",
1367
+ "unicorn/prefer-string-replace-all": "off",
1368
+ "unicorn/no-abusive-eslint-disable": "off",
1369
+ "unicorn/import-style": "off",
1370
+ "unicorn/prefer-module": "off",
1371
+ "unicorn/consistent-function-scoping": "off",
1372
+ "unicorn/no-nested-ternary": "off"
1373
+ };
1374
+ }
1375
+ return rules;
1367
1376
  };
1368
1377
 
1369
1378
  const config = {
@@ -12885,20 +12894,13 @@ function getStormConfig(options = {
12885
12894
  react: {},
12886
12895
  useReactCompiler: false
12887
12896
  }, ...userConfigs) {
12897
+ const useTypeScriptEslint = options.useTypeScriptEslint ?? true;
12898
+ const useUnicorn = options.useUnicorn ?? true;
12899
+ const react = options.react ?? {};
12900
+ const useReactCompiler = options.useReactCompiler ?? false;
12888
12901
  const configs = [
12889
12902
  // https://eslint.org/docs/latest/rules/
12890
12903
  eslint.configs.recommended,
12891
- // https://typescript-eslint.io/
12892
- ...tsEslint$1.configs.recommended.map((config) => ({
12893
- ...config,
12894
- files: [TS_FILE]
12895
- // We use TS config only for TS files
12896
- })),
12897
- // https://github.com/sindresorhus/eslint-plugin-unicorn
12898
- {
12899
- ...unicorn.configs["flat/recommended"],
12900
- files: ["**/*.ts"]
12901
- },
12902
12904
  // Prettier
12903
12905
  prettierConfig,
12904
12906
  // Import
@@ -12981,8 +12983,25 @@ function getStormConfig(options = {
12981
12983
  // User overrides
12982
12984
  ...userConfigs
12983
12985
  ].filter(Boolean);
12986
+ if (useTypeScriptEslint) {
12987
+ configs.push(
12988
+ ...tsEslint$1.configs.recommended.map((config) => ({
12989
+ ...config,
12990
+ files: [TS_FILE]
12991
+ // We use TS config only for TS files
12992
+ }))
12993
+ );
12994
+ }
12995
+ if (useUnicorn) {
12996
+ configs.push({
12997
+ plugins: { unicorn },
12998
+ rules: {
12999
+ ...unicorn.configs["flat/recommended"].rules
13000
+ }
13001
+ });
13002
+ }
12984
13003
  const typescriptConfig = {
12985
- files: ["**/*.ts"],
13004
+ files: [TS_FILE],
12986
13005
  languageOptions: {
12987
13006
  globals: {
12988
13007
  ...Object.fromEntries(
@@ -13018,29 +13037,7 @@ function getStormConfig(options = {
13018
13037
  }
13019
13038
  },
13020
13039
  rules: {
13021
- // // https://eslint.org/docs/latest/rules/
13022
- // ...eslint.configs.recommended.rules,
13023
- // // https://typescript-eslint.io/
13024
- // ...tsEslint.configs.recommended.reduce(
13025
- // (ret, record) => ({ ...ret, ...record.rules }),
13026
- // {}
13027
- // ),
13028
- // // Prettier
13029
- // ...prettierConfig.rules,
13030
- // // https://www.npmjs.com/package/eslint-plugin-unicorn
13031
- // ...unicorn.configs["flat/recommended"].rules,
13032
- // Banner
13033
- // ...banner.configs!["recommended"]![1]?.rules,
13034
- ...config$1,
13035
- // "banner/banner": [
13036
- // "error",
13037
- // {
13038
- // repositoryName: options.name,
13039
- // banner: options.banner,
13040
- // commentType: "block",
13041
- // numNewlines: 2
13042
- // }
13043
- // ],
13040
+ ...getStormRulesConfig({ ...options, useTypeScriptEslint, useUnicorn }),
13044
13041
  ...options.rules ?? {}
13045
13042
  },
13046
13043
  ignores: [
@@ -13055,56 +13052,10 @@ function getStormConfig(options = {
13055
13052
  ]
13056
13053
  };
13057
13054
  configs.push(typescriptConfig);
13058
- if (options.react) {
13055
+ if (react) {
13059
13056
  const reactConfigs = [
13060
13057
  {
13061
- files: ["**/*.tsx"],
13062
- languageOptions: {
13063
- globals: {
13064
- ...Object.fromEntries(
13065
- Object.keys(globals).flatMap(
13066
- (group) => Object.keys(globals[group]).map((key) => [
13067
- key,
13068
- "readonly"
13069
- ])
13070
- )
13071
- ),
13072
- ...globals.browser,
13073
- ...globals.node,
13074
- "window": "readonly",
13075
- "Storm": "readonly"
13076
- },
13077
- parserOptions: {
13078
- emitDecoratorMetadata: true,
13079
- experimentalDecorators: true,
13080
- project: options.tsconfig ? options.tsconfig : "./tsconfig.base.json",
13081
- projectService: true,
13082
- sourceType: "module",
13083
- projectFolderIgnoreList: [
13084
- "**/node_modules/**",
13085
- "**/dist/**",
13086
- "**/coverage/**",
13087
- "**/tmp/**",
13088
- "**/.nx/**",
13089
- "**/.tamagui/**",
13090
- "**/.next/**",
13091
- ...options.ignores || []
13092
- ],
13093
- ...options.parserOptions
13094
- }
13095
- },
13096
- ignores: [
13097
- "**/node_modules/**",
13098
- "**/dist/**",
13099
- "**/coverage/**",
13100
- "**/tmp/**",
13101
- "**/.nx/**",
13102
- "**/.tamagui/**",
13103
- "**/.next/**",
13104
- ...options.ignores || []
13105
- ]
13106
- },
13107
- {
13058
+ ...reactPlugin.configs?.recommended,
13108
13059
  files: ["**/*.tsx"],
13109
13060
  ignores: [
13110
13061
  "**/node_modules/**",
@@ -13116,9 +13067,10 @@ function getStormConfig(options = {
13116
13067
  "**/.next/**",
13117
13068
  ...options.ignores || []
13118
13069
  ],
13119
- ...react.configs?.recommended
13070
+ ...react
13120
13071
  },
13121
13072
  {
13073
+ ...reactHooks.configs?.recommended,
13122
13074
  files: ["**/*.tsx"],
13123
13075
  ignores: [
13124
13076
  "**/node_modules/**",
@@ -13129,15 +13081,14 @@ function getStormConfig(options = {
13129
13081
  "**/.tamagui/**",
13130
13082
  "**/.next/**",
13131
13083
  ...options.ignores || []
13132
- ],
13133
- ...reactHooks.configs?.recommended
13084
+ ]
13134
13085
  }
13135
13086
  // {
13136
13087
  // files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
13137
13088
  // ...jsxA11y.flatConfigs?.recommended
13138
13089
  // }
13139
13090
  ];
13140
- if (options.useReactCompiler === true) {
13091
+ if (useReactCompiler) {
13141
13092
  reactConfigs.push({
13142
13093
  files: ["**/*.tsx"],
13143
13094
  ignores: [