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

# no-useless-call

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


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

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

## Rule Details

`Function.prototype.call()` and `Function.prototype.apply()` are slower than the
normal function invocation. This rule reports cases where `.call()` /
`.apply()` does not change `this` (so the call could be a normal invocation).

A call is reported when its `thisArg` matches the receiver implied by the
applied expression:

- `foo.call(undefined, …)` / `foo.apply(null, …)` — the applied expression has
  no implied `this`, so `null`/`undefined`/`void 0` are equivalent to a plain
  call.
- `obj.foo.call(obj, …)` / `obj.foo.apply(obj, …)` — the `thisArg` is the same
  expression (token-for-token) as the receiver of the applied member access.

`.apply()` is only flagged when the second argument is an array literal — the
variadic / spread case is the responsibility of `prefer-spread`.

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

```javascript
foo.call(undefined, 1, 2, 3);
foo.apply(undefined, [1, 2, 3]);
foo.call(null, 1, 2, 3);
foo.apply(null, [1, 2, 3]);

obj.foo.call(obj, 1, 2, 3);
obj.foo.apply(obj, [1, 2, 3]);
```

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

```javascript
// The `this` binding actually changes.
foo.call(obj, 1, 2, 3);
foo.apply(obj, [1, 2, 3]);
obj.foo.call(null, 1, 2, 3);
obj.foo.apply(null, [1, 2, 3]);
obj.foo.call(otherObj, 1, 2, 3);
obj.foo.apply(otherObj, [1, 2, 3]);

// Variadic is delegated to `prefer-spread`.
foo.apply(undefined, args);
foo.apply(null, args);
obj.foo.apply(obj, args);
```

## Original Documentation

- [ESLint: no-useless-call](https://eslint.org/docs/latest/rules/no-useless-call)
- [Source code](https://github.com/eslint/eslint/blob/v10.8.1/lib/rules/no-useless-call.js)
