-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues
and found none that matched my issue(see description) - I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
const collator = new Intl.Collator("en")
const sorted = ["foo", "bar"].sort(collator.compare)
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/unbound-method": "error"
},
};
tsconfig
No response
Expected Result
The rule should not fire an error for this code, as Intl.Collator.prototype.compare
is bound to collator according to the ECMAScript spec.
Actual Result
The rule fires for the use of collator.compare
:
Avoid referencing unbound methods which may cause unintentional scoping of `this`.
If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead. 4:36 - 4:52
Additional Info
This is a duplicate of #4383, which was marked 'unable to repro'. However, the playground example linked in the team response actually reproduces the issue.
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin