no-useless-call
Configuration
rslint.config.ts
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 impliedthis, sonull/undefined/void 0are equivalent to a plain call.obj.foo.call(obj, …)/obj.foo.apply(obj, …)— thethisArgis 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:
Examples of correct code for this rule: