Skip to content

Commit 4939842

Browse files
authored
improvement(eslint-config-fluid): Disable eslint rule that yields false positives (#26137)
Disables `unicorn/no-array-callback-reference`, which yields false positives for non-array methods with the same name as array methods.
1 parent 8ae32b6 commit 4939842

File tree

16 files changed

+16
-17
lines changed

16 files changed

+16
-17
lines changed

common/build/eslint-config-fluid/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Packages can now use `eslint.config.mjs` instead of `.eslintrc.cjs`, but the leg
7474

7575
- `unicorn/import-style`: Changed from `"error"` to `"off"`
7676
- `unicorn/consistent-destructuring`: Changed from `"error"` to `"off"`
77+
- `unicorn/no-array-callback-reference`: Changed from `"error"` to `"off"`
78+
- Yields false positives for calls to `map` methods on non-array types.
7779

7880
**Unicorn rules changed to warnings** (to surface occurrences without breaking builds):
7981

common/build/eslint-config-fluid/printed-configs/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@
20502050
"error"
20512051
],
20522052
"unicorn/no-array-callback-reference": [
2053-
"error"
2053+
"off"
20542054
],
20552055
"unicorn/no-array-for-each": [
20562056
"error"

common/build/eslint-config-fluid/printed-configs/react.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@
21692169
"error"
21702170
],
21712171
"unicorn/no-array-callback-reference": [
2172-
"error"
2172+
"off"
21732173
],
21742174
"unicorn/no-array-for-each": [
21752175
"error"

common/build/eslint-config-fluid/printed-configs/recommended.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@
20502050
"error"
20512051
],
20522052
"unicorn/no-array-callback-reference": [
2053-
"error"
2053+
"off"
20542054
],
20552055
"unicorn/no-array-for-each": [
20562056
"error"

common/build/eslint-config-fluid/printed-configs/strict-biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2089,7 +2089,7 @@
20892089
"error"
20902090
],
20912091
"unicorn/no-array-callback-reference": [
2092-
"error"
2092+
"off"
20932093
],
20942094
"unicorn/no-array-for-each": [
20952095
"error"

common/build/eslint-config-fluid/printed-configs/strict.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2089,7 +2089,7 @@
20892089
"error"
20902090
],
20912091
"unicorn/no-array-callback-reference": [
2092-
"error"
2092+
"off"
20932093
],
20942094
"unicorn/no-array-for-each": [
20952095
"error"

common/build/eslint-config-fluid/printed-configs/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@
20462046
"error"
20472047
],
20482048
"unicorn/no-array-callback-reference": [
2049-
"error"
2049+
"off"
20502050
],
20512051
"unicorn/no-array-for-each": [
20522052
"error"

common/build/eslint-config-fluid/recommended.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ module.exports = {
5757
// False positives on non-array `push` methods.
5858
"unicorn/no-array-push-push": "off",
5959

60+
// False positives on non-array methods.
61+
"unicorn/no-array-callback-reference": "off",
62+
6063
"unicorn/empty-brace-spaces": "off",
6164

6265
// Rationale: Destructuring of `Array.entries()` in order to get the index variable results in a

examples/benchmarks/bubblebench/ot/src/proxy/tree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const arrayPatch = {
3636
consumer(
3737
item
3838
.map((value, index) => json1.insertOp([...path, start + index], value))
39-
// eslint-disable-next-line unicorn/no-array-reduce, unicorn/no-array-callback-reference
39+
// eslint-disable-next-line unicorn/no-array-reduce
4040
.reduce(json1.type.compose),
4141
);
4242
return target.push(...item);

packages/dds/map/src/directory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export class SharedDirectory
525525
// TODO: Use `unknown` instead (breaking change).
526526
// eslint-disable-next-line @typescript-eslint/no-explicit-any
527527
public forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {
528-
// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference
528+
// eslint-disable-next-line unicorn/no-array-for-each
529529
this.root.forEach(callback);
530530
}
531531

0 commit comments

Comments
 (0)