Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[unbound-method] problem detected using typeof of method #692

Closed
andsouto opened this issue Jul 10, 2019 · 0 comments · Fixed by #904
Closed

[unbound-method] problem detected using typeof of method #692

andsouto opened this issue Jul 10, 2019 · 0 comments · Fixed by #904
Labels
bug Something isn't working good first issue Good for newcomers has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@andsouto
Copy link

Repro

{
  "rules": {
    "@typescript-eslint/unbound-method": ["error"]
  }
}
typeof Number.isInteger === 'function';

Expected Result
No error is detected.

Actual Result
The next error is shown:

Avoid referencing unbound methods which may cause unintentional scoping of `this` @typescript-eslint/unbound-method

Additional Info
If the method is not run I can't see how the this can get an unexpected value.

I've seem tslint has an allow-typeof option to allow this use case. However, if I'm not missing something the ideal behaviour will be only applying the rule when the method is run instead of adding that kind of options.

Versions

package version
@typescript-eslint/eslint-plugin 1.11.0
@typescript-eslint/parser 1.11.0
TypeScript 3.5.3
ESLint 5.16.0
node 8.16.0
npm 6.10.0
@andsouto andsouto added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jul 10, 2019
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Jul 11, 2019
@bradzacher bradzacher added the good first issue Good for newcomers label Jul 27, 2019
@bradzacher bradzacher added the has pr there is a PR raised to close this label Aug 27, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants