Skip to content

unnecessaryBinds

Reports unnecessary .bind() calls.

✅ This rule is included in the ts logical presets.

Using .bind() on a function that doesn’t use this is unnecessary. Additionally, using .bind() on arrow functions has no effect since arrow functions have lexical this binding.

const handler = function () {
console.log("hello");
}.bind(this);
const callback = (() => {
this.process();
}).bind(context);

This rule is not configurable.

If you use .bind() with additional arguments to create partially applied functions, this rule should not flag those cases.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.