Disallow unnecessary function binding (no-extra-bind)

Function binding makes no difference in function expressions, when the function does not use this.

var foo = function() {
  do(stuff);
}.bind(bar)

Rule details

The following patterns are considered warnings:

function() {
  foo();
}.bind(bar);
function() {
  (function() {
    this.foo();
  }());
}.bind(bar);
function() {
  function foo() {
    this.bar();
  }
}.bind(baz);

The following patterns are not considered warnings:

function() {
  this.foo();
}.bind(bar);
function(a) {
  return a + 1;
}.bind(foo, bar);

Version

This rule was introduced in ESLint 0.8.0.

Resources