---
url: /docs/guide/usage/linter/rules/unicorn/prefer-single-call.md
---

### What it does

Enforces combining multiple `Array#{push,unshift}()`,
`Element#classList.{add,remove}()`, and `importScripts()` into a single call.

Supersedes the deprecated `unicorn/no-array-push-push` rule.

### Why is this bad?

Calling the same variadic method on the same receiver multiple times
consecutively can be merged into a single call, which is more concise
and can be marginally more performant.

### Examples

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

```javascript
foo.push(1);
foo.push(2);

foo.unshift(1);
foo.unshift(2);

element.classList.add("foo");
element.classList.add("bar");

importScripts("foo.js");
importScripts("bar.js");
```

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

```javascript
foo.push(1, 2);

foo.unshift(2, 1);

element.classList.add("foo", "bar");

importScripts("foo.js", "bar.js");
```

## Configuration

This rule accepts a configuration object with the following properties:

### ignore

type: `string[]`

default: `[]`

Methods to ignore.

## How to use

## Version

This rule was added in v1.70.0.

## References
