Skip to content

Conversation

@brrichards
Copy link
Contributor

Removes the unicorn/no-array-method-this-argument: off override from the @fluidframework/tree package and fixes the resulting errors. Adds inline disables for two test cases that specifically verify thisArg binding behavior. This is part of an ongoing effort to incrementally remove global ESLint rule overrides from eslint.config.mts and .eslintrc.cjs.

Since the 2 errors that result from this error removal are testing thisArg specificially, inlines are required. This proposed fix allows the rule to now be enabled for the rest of the package.

@brrichards brrichards marked this pull request as ready for review January 12, 2026 20:38
@brrichards brrichards requested a review from a team as a code owner January 12, 2026 20:38
Copilot AI review requested due to automatic review settings January 12, 2026 20:38
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 pull request enables the unicorn/no-array-method-this-argument ESLint rule for the @fluidframework/tree package by removing the global override from ESLint configuration files and adding inline disables only where specifically needed for tests that verify thisArg binding behavior.

Changes:

  • Removed the global unicorn/no-array-method-this-argument: off override from both ESLint configuration files
  • Added inline ESLint disables for two test cases that explicitly test thisArg binding functionality

Reviewed changes

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

File Description
packages/dds/tree/eslint.config.mts Removed global override for unicorn/no-array-method-this-argument rule
packages/dds/tree/.eslintrc.cjs Removed global override for unicorn/no-array-method-this-argument rule
packages/dds/tree/src/test/simple-tree/mapNode.spec.ts Added inline ESLint disables for two test cases that specifically test thisArg binding behavior

}
// eslint-disable-next-line unicorn/no-array-for-each -- Testing thisArg binding behavior
// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-method-this-argument -- Testing thisArg binding behavior
node.forEach(callback, thisArg);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not rewrite this as node.forEach(callback.bind(thisArg)); and remove the ignore? Or is this test specifically testing the thisArg binding behavrio?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it's testing when we pass in thisArg as the second argument, it gets correctly bound to "this" in the callback on line 61.

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