question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore self binding in `prefer-prototype-methods`

See original GitHub issue

this.foo.bind(this) and foo.bar.bind(foo) is very common.

Even though ClassName.prototype.method.bind(this) make more sense, many people still prefer the old way as they are shorter and not really “borrowing” method, should we ignore it or check under an option?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sindresorhuscommented, Jun 6, 2021

Agreed. We can add an option if someone asks.

0reactions
alfaprojectcommented, Jun 10, 2021

Was actually going to open an issue and then saw this. I’m also disabling this rule. At the very least, an option for self binding would be nice

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function.prototype.bind() - JavaScript - MDN Web Docs - Mozilla
The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence...
Read more >
Getting Out of Binding Situations in JavaScript - A List Apart
Binding -sensitive code patterns involve passing method references, which usually happens through two possible means: either you're assigning a method as a value ......
Read more >
What is the use of the JavaScript 'bind' method? - Stack Overflow
The bind function can take any number of arguments and return a new function. The new function will call the original function using...
Read more >
YDKJS: this & Object Prototypes, this call site, implicit, explicit ...
The primary reason for this behavior is to create a function (that can be used with new for constructing objects) that essentially ignores...
Read more >
The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found