Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

no-unbound-method warns on method existence check #3009

Closed
NN--- opened this issue Jul 6, 2017 · 3 comments
Closed

no-unbound-method warns on method existence check #3009

NN--- opened this issue Jul 6, 2017 · 3 comments

Comments

@NN---
Copy link
Contributor

NN--- commented Jul 6, 2017

Bug Report

  • TSLint version: 5.5.0
  • TypeScript version: 2.4.1
  • Running TSLint via: gulp-tslint

TypeScript code being linted

var a = document.addEventListener ? document.addEventListener  : null;

Actual behavior

No error

Expected behavior

error noUnboundMethod: Avoid referencing unbound methods which may cause unintentional scoping of 'this'.

@adidahiya
Copy link
Contributor

can you paste the verbose lint failure? which [line, col] is it failing on? it's more likely on the second instance of document.addEventListener, which is potentially a legit error (invoking a() is not the same as document.addEventListener()).

@NN---
Copy link
Contributor Author

NN--- commented Jul 8, 2017

This is the code:

if (!document.documentElement.doScroll) {
}

TSLint:

[16:40:57] Using gulpfile C:\Projects\Agent-9.2\ChromeExtension\gulpfile.js
[16:40:57] Starting 'tslint'...
test.ts(30,6): error noUnboundMethod: Avoid referencing unbound methods which may cause unintentional scoping of 'this'.

[16:41:00] 'tslint' errored after 3.64 s
[16:41:00] Error in plugin 'gulp-tslint'
Message:
    Failed to lint: test.ts [30, 6]: Avoid referencing unbound methods which may cause unintentional scoping of 'this'..

@ghost ghost mentioned this issue Oct 19, 2017
4 tasks
@ajafff
Copy link
Contributor

ajafff commented Oct 19, 2017

Fixed by #3349

@ajafff ajafff closed this as completed Oct 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants