@arcgis/eslint-config 6.0.0-next.41 → 6.0.0-next.43

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.
@@ -601,16 +601,22 @@ const eslintConfigCore = [
601
601
  "unicorn/no-abusive-eslint-disable": "error",
602
602
  // Detect getter accessing itself - causes a runtime loop
603
603
  "unicorn/no-accessor-recursion": "error",
604
- // Detect Promise.all([await a]) when await Promise.all([a]) was meant
605
- "unicorn/no-await-in-promise-methods": "error",
604
+ // Forbid `foo && foo` and `foo || foo`
605
+ "unicorn/no-duplicate-logical-operands": "error",
606
606
  // Forbid unsafe usage of instanceof
607
607
  "unicorn/no-instanceof-builtins": "error",
608
608
  // Catch .removeEventListener usages that don't work
609
609
  "unicorn/no-invalid-remove-event-listener": "error",
610
+ // Detects Symbol.dispose in an async context for example.
611
+ "unicorn/no-invalid-well-known-symbol-methods": "error",
612
+ // Detects `!(a === b)` for example
613
+ "unicorn/no-negated-comparison": "error",
610
614
  // Detect !a==b when a!=b was meant.
611
615
  // TODO: drop because TypeScript detects this. And it misses
612
616
  // cases that @typescript-eslint/no-confusing-non-null-assertion detects
613
617
  "unicorn/no-negation-in-equality-check": "error",
618
+ // Disallow comparisons made redundant by an equality check in the same logical AND.
619
+ "unicorn/no-redundant-comparison": "error",
614
620
  // Catch redundant promise syntax
615
621
  "unicorn/no-single-promise-in-promise-methods": "error",
616
622
  // Prefer === undefined over typeof bar === 'undefined'
@@ -621,6 +627,10 @@ const eslintConfigCore = [
621
627
  "unicorn/no-unnecessary-array-splice-count": "error",
622
628
  // Catch redundant .slice() syntax
623
629
  "unicorn/no-unnecessary-slice-end": "error",
630
+ // Disallow String#trim() before String#startsWith() or String#endsWith().
631
+ "unicorn/no-unnecessary-string-trim": "error",
632
+ // Disallow unnecessary Boolean() casts in array predicate callbacks.
633
+ "unicorn/no-useless-boolean-cast": "error",
624
634
  // Catch redundant spread syntax
625
635
  "unicorn/no-useless-fallback-in-spread": "error",
626
636
  // Replace .some() with .every() or the opposite when it simplifies the code
@@ -629,6 +639,8 @@ const eslintConfigCore = [
629
639
  "unicorn/no-useless-promise-resolve-reject": "error",
630
640
  // Catch redundant spread syntax usage
631
641
  "unicorn/no-useless-spread": "error",
642
+ // Disallow useless template literal expressions.
643
+ "unicorn/no-useless-template-literals": "error",
632
644
  // Do not initialize variables with =undefined as that is the default
633
645
  "unicorn/no-useless-undefined": ["error", { checkArguments: false, checkArrowFunctionBody: false }],
634
646
  // Prefer .find() over .filter()[0]
@@ -639,34 +651,65 @@ const eslintConfigCore = [
639
651
  "unicorn/prefer-array-flat-map": "error",
640
652
  // Prefer .indexOf() over .findIndex() where possible
641
653
  "unicorn/prefer-array-index-of": "error",
654
+ // Prefer iterating an array directly or with Array#keys() over Array#entries() when the index or value is unused.
655
+ "unicorn/prefer-array-iterable-methods": "error",
642
656
  // Use .some() over .filter().length>0
643
657
  "unicorn/prefer-array-some": "error",
658
+ // Prefer BigInt literals over the constructor.
659
+ "unicorn/prefer-bigint-literals": "error",
644
660
  // Use newer methods when working with blobs
645
661
  "unicorn/prefer-blob-reading-methods": "error",
646
662
  // Prefer Date.now() over older longer but equivalent variants
647
663
  "unicorn/prefer-date-now": "error",
648
- // Catch legacy default-values syntax
649
- "unicorn/prefer-default-parameters": "error",
664
+ // Prefer Object.groupBy() or Map.groupBy() over manual grouping.
665
+ "unicorn/prefer-group-by": "error",
666
+ // Prefer .has() when checking existence.
667
+ "unicorn/prefer-has-check": "error",
650
668
  // Use .includes() over .indexOf() where possible for readability
651
669
  "unicorn/prefer-includes": "error",
652
- // Prefer `a ?? b` over `a ? a : b`
653
- "unicorn/prefer-logical-operator-over-ternary": "error",
670
+ // Prefer passing iterables directly to constructors instead of filling empty collections.
671
+ "unicorn/prefer-iterable-in-constructor": "error",
672
+ // Prefer new Map() over Object.fromEntries() when using the result as a map.
673
+ "unicorn/prefer-map-from-entries": "error",
654
674
  // Prefer simpler syntax for .slice() from the end
655
675
  "unicorn/prefer-negative-index": "error",
656
676
  // Require `node:` in node.js imports. Improves compatibility with non-node engines
657
677
  "unicorn/prefer-node-protocol": "error",
678
+ // Prefer Object.defineProperties() over multiple Object.defineProperty() calls.
679
+ "unicorn/prefer-object-define-properties": "error",
680
+ // Prefer Promise.resolve() and Promise.reject() over trivial new Promise() calls.
681
+ "unicorn/prefer-promise-static-methods": "error",
682
+ // Prefer Promise.withResolvers() when extracting resolver functions from new Promise().
683
+ "unicorn/prefer-promise-with-resolvers": "error",
684
+ // Prefer RegExp.escape() for escaping strings to use in regular expressions.
685
+ "unicorn/prefer-regexp-escape": "error",
658
686
  // TODO: consider dropping - string.match(regex) is more readable
687
+ // but `test` exclusively returns a boolean and therefore is more efficient.
659
688
  "unicorn/prefer-regexp-test": "error",
660
689
  // Prefer sets over arrays when using the array only for .includes() check
661
690
  "unicorn/prefer-set-has": "error",
691
+ // Prefer Set methods for Set operations.
692
+ "unicorn/prefer-set-methods": "error",
662
693
  // Simplify code when set .size is needed
663
694
  "unicorn/prefer-set-size": "error",
695
+ // Enforce combining multiple single-character replacements into a single String#replaceAll() with a regular expression.
696
+ "unicorn/prefer-single-replace": "error",
697
+ // Prefer String#split() with a limit.
698
+ "unicorn/prefer-split-limit": "error",
699
+ // Prefer String#matchAll() over RegExp#exec() loops.
700
+ "unicorn/prefer-string-match-all": "error",
664
701
  // Use .replaceAll() over .replace() when replaceAll was meant. Readability.
665
702
  "unicorn/prefer-string-replace-all": "error",
666
703
  // Use .slice() over legacy .substring() and .substr()
667
704
  "unicorn/prefer-string-slice": "error",
668
705
  // Prefer .startsWith() over regex when they are equivalent for readability
669
706
  "unicorn/prefer-string-starts-ends-with": "error",
707
+ // Prefer URL.canParse() over constructing a URL in a try/catch for validation.
708
+ "unicorn/prefer-url-can-parse": "error",
709
+ // Prefer URL#href over stringifying a URL.
710
+ "unicorn/prefer-url-href": "error",
711
+ // Prefer putting the condition in the while statement.
712
+ "unicorn/prefer-while-loop-condition": "error",
670
713
  // Require `new Error` over `Error`.
671
714
  // TODO: dro because they are equivalent and `new ` adds bytes (not minified by esbuild)
672
715
  "unicorn/throw-new-error": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/eslint-config",
3
- "version": "6.0.0-next.41",
3
+ "version": "6.0.0-next.43",
4
4
  "description": "ESLint configuration for WebGIS SDK",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "license": "SEE LICENSE IN LICENSE.md",
23
23
  "dependencies": {
24
- "@arcgis/toolkit": "6.0.0-next.41",
24
+ "@arcgis/toolkit": "6.0.0-next.43",
25
25
  "@eslint/markdown": "^8.0.3",
26
26
  "@types/confusing-browser-globals": "^1.0.3",
27
27
  "@typescript-eslint/utils": "^8.63.0",
@@ -34,7 +34,7 @@
34
34
  "eslint-plugin-react-jsx": "~5.11.2",
35
35
  "eslint-plugin-regexp": "~3.1.1",
36
36
  "eslint-plugin-storybook": "^10.6.3",
37
- "eslint-plugin-unicorn": "~64.0.0",
37
+ "eslint-plugin-unicorn": "~80.0.0",
38
38
  "globals": "^16.5.0",
39
39
  "jsonc-eslint-parser": "^3.1.0",
40
40
  "prettier-linter-helpers": "^1.0.1",