Skip to content

Conversation

@brrichards
Copy link
Contributor

@brrichards brrichards commented Jan 7, 2026

Removes the unicorn/no-array-reduce: off override from the @fluidframework/tree package and fixes the resulting errors. Converts all Array.reduce() calls to explicit for loops. This is part of an ongoing effort to incrementally remove global ESLint rule overrides from eslint.config.mts and .eslintrc.cjs.

Changes:

  • Production code (2 files)
  • Test code (6 files)

No inline overrides were needed - all reduce usages could be converted to for loops.

@brrichards brrichards marked this pull request as ready for review January 7, 2026 19:11
@brrichards brrichards requested a review from a team as a code owner January 7, 2026 19:11
Copilot AI review requested due to automatic review settings January 7, 2026 19:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the unicorn/no-array-reduce ESLint rule override from the @fluidframework/tree package and converts all Array.reduce() calls to explicit for loops, improving code readability and debuggability.

  • Removes the ESLint rule override from both eslint.config.mts and .eslintrc.cjs
  • Converts 8 different reduce() operations across 8 files to explicit for loops
  • All conversions maintain logical equivalence with improved clarity

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/dds/tree/eslint.config.mts Removes unicorn/no-array-reduce: "off" override
packages/dds/tree/.eslintrc.cjs Removes unicorn/no-array-reduce: "off" override
packages/dds/tree/src/test/simple-tree/list.spec.ts Converts reduce in prettyArgs() to for loop for string building
packages/dds/tree/src/test/shared-tree-core/edit-manager/editManagerScenario.ts Converts reduce for finding minimum peer reference to explicit Math.min with spread
packages/dds/tree/src/test/feature-libraries/sequence-field/utils.ts Converts reduce in composeDeep() to for loop for composing changes
packages/dds/tree/src/test/feature-libraries/optional-field/optionalChangeRebaser.test.ts Converts reduce in rebaseComposedWrapped() to for loop for composing changesets
packages/dds/tree/src/test/feature-libraries/modular-schema/modularChangesetUtil.ts Converts reduce in fieldChangeMapFromDescription() to for-of loop
packages/dds/tree/src/test/core/tree/anchorSet.spec.ts Converts reduce in makePath() to for-of loop for building path structure
packages/dds/tree/src/shared-tree-core/editManager.ts Converts two reduce operations in loadSummaryData() to for loops for building commit chains
packages/dds/tree/src/core/rebase/utils.ts Converts reduce in rebaseChangeOverChanges() to for loop for rebasing changes

@brrichards brrichards merged commit 6f4173c into microsoft:main Jan 12, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants