For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt, and this page is available as Markdown at https://rslint.rs/rules/eslint/no-extra-bind.md.
close

no-extra-bind

Added in v0.3.4

Configuration

rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-extra-bind': 'error',
    },
  },
]);

Rule Details

Disallows unnecessary calls to .bind(). If a function expression does not use this, calling .bind() on it is unnecessary. Arrow functions never have their own this binding, so .bind() on an arrow function is always unnecessary.

Examples of incorrect code for this rule:

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

var x = (() => {
  foo();
}).bind(bar);

var x = function () {
  (function () {
    this.bar();
  })();
}.bind(baz);

Examples of correct code for this rule:

var x = function () {
  this.foo();
}.bind(bar);

var x = function (a) {
  return a + 1;
}.bind(foo, bar);

var x = f.bind(bar);

Original Documentation