> 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.

# unbound-method

[Added in v0.1.4](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.4)
## Configuration

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ ts.configs.recommendedTypeChecked | `"error"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/unbound-method': 'error',
    },
  },
]);
```

## Rule Details

Enforce unbound methods are called with their expected scope. Extracting a class method as a standalone variable or callback without binding it to the class instance causes `this` to be `undefined` at runtime, which is a common source of bugs. This rule reports when a method is referenced without being called, unless it is in a safe context (like a comparison, typeof check, or conditional check).

If the method does not access `this`, the rule additionally suggests annotating the method parameter with `this: void` or converting it to an arrow function.

Examples of **incorrect** code for this rule:

```typescript
class MyClass {
  method() {
    return this.value;
  }
}
const instance = new MyClass();
const unboundMethod = instance.method;
[1, 2, 3].forEach(instance.method);
```

Examples of **correct** code for this rule:

```typescript
class MyClass {
  method() {
    return this.value;
  }
}
const instance = new MyClass();
const boundMethod = instance.method.bind(instance);
instance.method();
if (instance.method) {
}
typeof instance.method;
```

## Original Documentation

- [typescript-eslint: unbound-method](https://typescript-eslint.io/rules/unbound-method)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.28.0/packages/eslint-plugin/src/rules/unbound-method.ts)
