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

fix(eslint-plugin): [unbound-method] false positives for unary expressions #1964

merged 2 commits into from May 4, 2020


Copy link

@auhsoja auhsoja commented May 1, 2020

Fixes #1934.

Added an extra check to isSafeUse to deal with the case when an unbound method is made truthy/falsy (and therefore safe to reference) through the use of the ! operator.

Copy link

Thanks for the PR, @auhsoja!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!

🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

Copy link

codecov bot commented May 1, 2020

Codecov Report

Merging #1964 into master will decrease coverage by 0.49%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1964      +/-   ##
- Coverage   94.38%   93.88%   -0.50%     
  Files         164      170       +6     
  Lines        7585     7737     +152     
  Branches     2180     2227      +47     
+ Hits         7159     7264     +105     
- Misses        183      218      +35     
- Partials      243      255      +12     
Flag Coverage Δ
#unittest 93.88% <100.00%> (-0.50%) ⬇️
Impacted Files Coverage Δ
packages/eslint-plugin/src/rules/unbound-method.ts 95.23% <100.00%> (ø)
...nt-plugin/src/rules/switch-exhaustiveness-check.ts 97.67% <0.00%> (-2.33%) ⬇️
...kages/eslint-plugin/src/rules/no-base-to-string.ts 97.95% <0.00%> (-2.05%) ⬇️
...ackages/eslint-plugin/src/rules/member-ordering.ts 98.46% <0.00%> (-0.69%) ⬇️
packages/eslint-plugin/src/util/types.ts 81.21% <0.00%> (-0.39%) ⬇️
...ackages/eslint-plugin/src/rules/prefer-includes.ts 100.00% <0.00%> (ø)
...kages/experimental-utils/src/eslint-utils/index.ts 100.00% <0.00%> (ø) 100.00% <0.00%> (ø)
...xperimental-utils/src/eslint-utils/applyDefault.ts 100.00% <0.00%> (ø)
...-plugin/src/rules/restrict-template-expressions.ts 100.00% <0.00%> (ø)
... and 8 more

@bradzacher bradzacher added the bug Something isn't working label May 2, 2020
Copy link

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for doing this!

@bradzacher bradzacher changed the title fix(eslint-plugin): [unbound-method] False positives for uncalled function checks. fix(eslint-plugin): [unbound-method] false positives for unary expressions May 4, 2020
@bradzacher bradzacher merged commit b35070e into typescript-eslint:master May 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
bug Something isn't working
None yet

Successfully merging this pull request may close these issues.

[unbound-method] False positive for Uncalled Function Checks
2 participants