-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Copy link
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.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
const { abort } = new AbortController();
abort();ESLint Config
module.exports = {
"rules": {
"@typescript-eslint/unbound-method": "error"
}
}tsconfig
Expected Result
The error message should tell me what's wrong, and optionally give a hint as to how I can fix it. If the type comes from a .d.ts outside of my control -say, node_modules/ or lib.*.d.ts- then there's no need to suggest changes to the type signature such as annotating with this: void.
Actual Result
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.
Additional Info
Maybe we just remove the "If your ... annotate it with this: void" from the error?
Avoid referencing unbound methods which may cause unintentional scoping of `this`.
Consider using an arrow function instead.
Thanks @mattpocock for accidentally reminding me to file this, I'd been meaning to for a while. 😄 https://x.com/JoshuaKGoldberg/status/1838944653401375048
💖
mattpocock and AhmedBaset
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
{ "compilerOptions": { "strictNullChecks": true } }