open-index/open-npm huggingface dataset:
npm package: @putout/plugin-remove-skip
Description: putout plugin adds ability to find and remove test.only calls
Author: coderaiser
Latest version: 4.0.1

# @putout/plugin-remove-skip [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-skip.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-skip"npm"

🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to find and remove `test.skip` calls. Part of [@putout/plugin-tape](https://github.com/coderaiser/putout/tree/master/packages/plugin-tape#remove-skip).

## Install

```
npm i @putout/plugin-remove-skip -D
```

## Rule

Rule `remove-skip` enabled by default, to disable add to `.putout.json`:

```json
{
    "rules": {
        "remove-skip": "off"
    }
}
```

## ❌ Incorrect code example

```js
test.skip('some', (t) => {
    t.end();
});
```

## ✅ Correct code Example

```js
test('some', (t) => {
    t.end();
});
```

## License

MIT
npm package: @putout/plugin-remove-unreachable-code
Description: 🐊Putout plugin adds ability to find and remove unreachable code
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-unreachable-code [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unreachable-code.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unreachable-code"npm"

> The **JavaScript** warning "unreachable code after return statement" occurs when using an expression after a return statement, or when using a semicolon-less return statement but including an expression directly after.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Stmt_after_return)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove unreachable code.

## Install

```
npm i @putout/plugin-remove-unreachable-code
```

## Rule

```json
{
    "rules": {
        "remove-unreachable-code": "on"
    }
}
```

## ❌ Example of incorrect code

```js
function hi() {
    return 'world';
    console.log('hello');
}

function log() {
    throw Error('error');
    
    console.log('hello');
}
```

## ✅ Example of correct code

```js
function hi() {
    return 'world';
}

function log() {
    throw Error('error');
}
```

## License

MIT
npm package: @putout/plugin-remove-unreferenced-variables
Description: 🐊Putout plugin adds ability to find and remove unreferenced variables
Author: coderaiser
Latest version: 6.0.1

# @putout/plugin-remove-unreferenced-variables [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unreferenced-variables.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unreferenced-variables "npm"

> A **variable** is a named reference to a **value**.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Glossary/Variable)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove **variables** without **references**. Merged with [`@putout/plugin-variables`](https://www.npmjs.com/package/@putout/plugin-variables).

## Install

```
npm i @putout/plugin-remove-unreferenced-variables -D
```

## Rule

```json
{
    "rules": {
        "remove-unreferenced-variables": "on"
    }
}
```

## ❌ Example of incorrect code

```js
let a;
let b;

a = 5;
b = 6;

console.log(a);
```

## ✅ Example of correct code

```js
let a;

a = 5;

console.log(a);
```

## License

MIT
npm package: @putout/plugin-remove-unused-expressions
Description: 🐊Putout plugin adds ability to find and remove unused expressions
Author: coderaiser
Latest version: 12.1.0

# @putout/plugin-remove-unused-expressions [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-expressions.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-expressions"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove `unused expressions`, excluding directives: [`use strict`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) and [`use client`](https://react.dev/reference/rsc/use-client).

## Install

```
npm i @putout/plugin-remove-unused-expressions -D
```

## Rule

```json
{
    "rules": {
        "remove-unused-expressions": "on"
    }
}
```

## ❌ Example of incorrect code

```js
function show(error) {
    showError;
}
```

## ✅ Example of correct code

```js
function show(error) {}
```

## License

MIT
npm package: @putout/plugin-remove-unused-for-of-variables
Description: 🐊Putout plugin adds ability to find and remove unused for-of variables
Author: coderaiser
Latest version: 3.0.3

# @putout/plugin-remove-unused-for-of-variables [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-for-of-variables.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-for-of-variables"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove `unused` `for-of` `variables`. Merged with [`@putout/plugin-for-of`](https://www.npmjs.com/package/@putout/plugin-for-of#remove-unused-variables).

## Install

```
npm i @putout/plugin-remove-unused-for-of-variables -D
```

## Rule

```json
{
    "rules": {
        "remove-unused-for-of-variables": "on"
    }
}
```

## ❌ Example of incorrect code

```js
for (const {a, b} of c) {
    console.log(a);
}
```

## ✅ Example of correct code

```js
for (const {a} of c) {
    console.log(a);
}
```

## License

MIT
npm package: @putout/plugin-remove-unused-labels
Description: 🐊Putout plugin adds ability to find and remove unused 'label' statement
Author: coderaiser
Latest version: 1.0.2

# @putout/plugin-remove-unused-labels [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-labels.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-labels "npm"

> A **labeled statement** is any statement that is prefixed with an identifier. You can jump to this label using a `break` or `continue` statement nested within the labeled statement.>
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove unused `label` statement. Merged to [`@putout/plugin-labels`](https://www.npmjs.com/package/@putout/labels).

Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/021bf8fa6f01bcc265cebbaa19d5dffc/1833eaee02119cf1d38974157a8d010ecaed7b33).

## Install

```
npm i @putout/plugin-remove-unused-labels
```

## Rule

```json
{
    "rules": {
        "remove-unused-labels": "on"
    }
}
```

## ❌ Example of incorrect code

```js
hello: while (true) {
    break;
}
```

## ✅ Example of correct code

```js
while (true) {
    break;
}
```

## Comparison

| Linter        | Rule                                                                                                                   | Fix |
|---------------|------------------------------------------------------------------------------------------------------------------------|-----|
| 🐊 **Putout** | [`remove-unused-labels`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-labels#readme) | ✅   |
| ⏣ **ESLint**  | [`no-unused-labels`](https://eslint.org/docs/rules/no-unused-labels)                                                   | ❌   |
| 🦕 **Deno**   | [`no-unused-labels`](https://lint.deno.land/rules/no-unused-labels)                                                    | ❌   |

## License

MIT
npm package: @putout/plugin-remove-unused-private-fields
Description: 🐊Putout plugin adds ability to remove unused private fields
Author: coderaiser
Latest version: 4.0.0

# @putout/plugin-remove-unused-private-fields [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-private-fields.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-private-fields"npm"

> **Class fields** are **public** by default, but **private class members** can be created by using a hash **`#`** prefix. The privacy encapsulation of these **class** features is enforced by **JavaScript** itself.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove unused private fields.

## Install

```
npm i @putout/plugin-remove-unused-private-fields
```

## Rule

```json
{
    "rules": {
        "remove-unused-private-fields": "on"
    }
}
```

## ❌ Incorrect code example

```js
class Hello {
    #a = 5;
    #b = 3;
    get() {
        return this.#a;
    }
}
```

## ✅ Correct code Example

```js
class Hello {
    #a = 5;
    get() {
        return this.#a;
    }
}
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout** | [`remove-unused-private-fields`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-private-fields#readme) | ✅
⏣ **ESLint** | [`no-unused-private-class-members`](https://eslint.org/docs/rules/no-unused-private-class-members) | ❌

## License

MIT
npm package: @putout/plugin-remove-unused-types
Description: putout plugin adds ability to find and remove unused types
Author: coderaiser
Latest version: 2.0.1

# @putout/plugin-remove-unused-types [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-types.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-types "npm"

🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to find and remove `unused types`.
Moved to [`@putout/plugin-typescript`](https://github.com/coderaiser/putout/tree/v24.0.2/packages/plugin-typescript#remove-unused-types)

## Install

```
npm i @putout/plugin-remove-unused-types -D
```

## Rule

```json
{
    "rules": {
        "remove-unused-types": "on"
    }
}
```

## ❌ Incorrect code example

```ts
type n = number;
type s = string;

const x: n = 5;
```

## ✅ Correct code Example

```ts
type n = number;

const x: n = 5;
```

## License

MIT
npm package: @putout/plugin-remove-unused-variables
Description: 🐊Putout plugin adds ability to find and remove unused variables
Author: coderaiser
Latest version: 14.1.1

# @putout/plugin-remove-unused-variables [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-variables.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-variables "npm"

> A variable is a container for a value, like a `number` we might use in a sum, or a `string` that we might use as part of a sentence.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Variables)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove the variables that are declared, but:

- not passed as **argument** to a **function**;
- not used as **operand** in **expression**;

That is **unused variables**. Most likely it is a leftovers due to incomplete transforming of the code. Such variables take up space and gives no value so they must be removed. Merged with [`@putout/plugin-variables`](https://www.npmjs.com/package/@putout/plugin-variables).

☝️*Remember, when you [writing a transform](https://github.com/coderaiser/putout/tree/master/packages/engine-runner#readme) you can skip all parts related to **removing unused variables** and just reuse current **plugin** it will make your code simpler and less error prone.*

☝️*No, you cannot just look at [`referenced` and `constant` fields](https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md#user-content-bindings) to determine if you can remove variable and [here is why](https://putout.cloudcmd.io/#/gist/4277392f74b56b74911b779c9624af8d/cfec476f857dfb4f4c7a6247bdcc6b521fed8e70) one of the biggest plugins exists*.

## Install

```
npm i @putout/plugin-remove-unused-variables -D
```

## Rule

Rule `remove-unused-variables` is enabled by default, to disable add to `.putout.json`:

```json
{
    "rules": {
        "remove-unused-variables": "off"
    }
}
```

## ❌ Example of incorrect code

```js
const a = 'hello';
const b = 'world';

console.log(a);
```

## ✅ Example of correct code

```js
const a = 'hello';
console.log(a);
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout**| [`remove-unused-variables`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables#readme)| ✅
⏣ **ESLint** | [`no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars) | ❌

## License

MIT
npm package: @putout/plugin-remove-useless-array
Description: 🐊Putout plugin adds ability to remove useless array inside property accessors
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-useless-array [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-array.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-array "npm"

> Property accessors provide access to an object's properties by using the dot notation or the bracket notation.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless array inside property accessors.
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/5f12b264319f962d28c85948f6162ef9/03422d094b86256a4d20ac70cbcde929884844e3).

## Install

```
npm i @putout/plugin-remove-useless-array
```

## Rule

```json
{
    "rules": {
        "remove-useless-array": "on"
    }
}
```

## ❌ Example of incorrect code

```js
A[[B]];
```

## ✅ Example of correct code

```js
A[B];
```

## License

MIT
npm package: @putout/plugin-remove-useless-array-constructor
Description: 🐊Putout plugin adds ability to remove useless Array constructor
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-useless-array-constructor [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-array-constructor.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-array-constructor "npm"

> TypeScript code must not use the `Array()` constructor, with or without new. It has confusing and contradictory usage.
>
> (c) [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html#array-constructor)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin removes useless [Array constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Array).
It has a different meaning for one, and couple arguments:

```js
const a = new Array(2); // [undefined, undefined]
const b = new Array(2, 3); // [2, 3];
```

## Install

```
npm i @putout/plugin-remove-useless-array-constructor -D
```

## Rule

```json
{
    "rules": {
        "remove-useless-array-constructor": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const a = Array(1, 2, 3);
```

## ✅ Example of correct code

```js
const a = [1, 2, 3];
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout**| [`remove-useless-array-constructor`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-array-constructor#readme)| ✅
⏣ **ESLint** | [`no-array-constructor`](https://eslint.org/docs/rules/no-array-constructor) | ❌

## License

MIT
npm package: @putout/plugin-remove-useless-array-entries
Description: 🐊Putout plugin adds ability to remove useless array.entries()
Author: coderaiser
Latest version: 2.0.1

# @putout/plugin-remove-useless-array-entries [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-array-entries.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-array-entries "npm"

> The `entries()` method returns a new Array Iterator object that contains the key/value pairs for each index in the array.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless [`array.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).

## Install

```
npm i @putout/plugin-remove-useless-array-entries
```

## Rule

```json
{
    "rules": {
        "remove-useless-array-entries": "on"
    }
}
```

## ❌ Example of incorrect code

```js
for (const [, element] of array.entries()) {
    console.log(element);
}
```

## ✅ Example of correct code

```js
for (const element of array) {
    console.log(element);
}
```

## License

MIT
npm package: @putout/plugin-remove-useless-array-from
Description: 🐊Putout plugin adds ability to remove useless 'Array.from()'
Author: coderaiser
Latest version: 2.1.1

# @putout/plugin-remove-useless-array-from [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-array-from.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-array-from"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `Array.from()`. Merged to [`@putout/plugin-for-of`](https://www.npmjs.com/package/@putout/plugin-for-of).

## Install

```
npm i @putout/plugin-remove-useless-array-from
```

## Rule

```json
{
    "rules": {
        "remove-useless-array-from": "on"
    }
}
```

## ❌ Example of incorrect code

```js
for (const x of Array.from(y)) {}
```

## ✅ Example of correct code

```js
for (const x of y) {}
```

## License

MIT
npm package: @putout/plugin-remove-useless-assign
Description: 🐊Putout plugin adds ability to remove useless assign
Author: coderaiser
Latest version: 2.0.0

# @putout/plugin-remove-useless-assign [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-assign.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-assign "npm"

> The `Object.assign()` method copies all enumerable own properties from one or more source objects to a target object. It returns the modified target object.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `assign`.
Check it out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/04c18d7d2302e0a3cc543c7c83adeaf2/ddb38d94dcc6425fc944e3b130837739f916c7df).

## Install

```
npm i @putout/plugin-remove-useless-assign
```

## Rule

```json
{
    "rules": {
        "remove-useless-assign": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const load = stub().rejects(assign(Error('LOAD USED')));
```

## ✅ Example of correct code

```js
const load = stub().rejects(Error('LOAD USED'));
```

## License

MIT
npm package: @putout/plugin-remove-useless-async
Description: putout plugin adds ability to remove useless async
Author: coderaiser
Latest version: 4.0.1

# @putout/plugin-remove-useless-async [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-async.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-async"npm"

🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to remove useless `async`. Part of [@putout/plugin-promises](https://github.com/coderaiser/putout/tree/v24.5.0/packages/plugin-promises).

## Install

```
npm i @putout/plugin-remove-useless-async
```

## Rule

```json
{
    "rules": {
        "remove-useless-async": "on"
    }
}
```

## ❌ Incorrect code example

```js
async function show() {
    console.log('hello');
}
```

## ✅ Correct code Example

```js
function show() {
    console.log('hello');
}
```

## License

MIT
npm package: @putout/plugin-remove-useless-await
Description: putout plugin adds ability to remove useless await
Author: coderaiser
Latest version: 1.3.1

# @putout/plugin-remove-useless-await [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-await.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-await "npm"

🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to remove useless `await`. Part of [@putout/plugin-promises](https://github.com/coderaiser/putout/tree/v24.5.0/packages/plugin-promises).

## Install

```
npm i @putout/plugin-remove-useless-await
```

## Rule

```json
{
    "rules": {
        "remove-useless-await": "on"
    }
}
```

## ❌ Incorrect code example

```js
await await Promise.resolve();
```

## ✅ Correct code Example

```js
await Promise.resolve();
```

## License

MIT
npm package: @putout/plugin-remove-useless-break
Description: 🐊Putout plugin adds ability to remove useless 'break'
Author: coderaiser
Latest version: 1.0.2

# @putout/plugin-remove-useless-break [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-break.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-break "npm"

> The `break` statement terminates the current loop or switch statement and transfers program control to the statement following the terminated statement.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `break`. Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/b993e0e96fec0fba1a9228ddeac5551a/5d0db5af60f87fcb0476de2f0d4efe78421aa68a).

## Install

```
npm i @putout/plugin-remove-useless-break
```

## Rule

```json
{
    "rules": {
        "remove-useless-break": "on"
    }
}
```

## ❌ Example of incorrect code

```js
while (a) {
    break;
}
```

## ✅ Example of correct code

```js
while (a) {}
```

## License

MIT
npm package: @putout/plugin-remove-useless-conditions
Description: 🐊Putout plugin adds ability to remove useless conditions
Author: coderaiser
Latest version: 3.0.1

# @putout/plugin-remove-useless-conditions [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-conditions.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-conditions "npm"

> The **if** statement executes a statement if a specified condition is **truthy**. If the condition is **falsy**, another statement can be executed.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `conditions`. Merged to [`@putout/plugin-conditions`](https://www.npmjs.com/package/@putout/plugin-conditions).

## Install

```
npm i @putout/plugin-remove-useless-conditions
```

## Rule

```json
{
    "rules": {
        "remove-useless-conditions/evaluate": "on",
        "remove-useless-conditions/simplify": "on"
    }
}
```

### Evaluate

## ❌ Example of incorrect code

```js
const a = [];
const c = a;

if (a) {
    console.log(a);
}
```

## ✅ Example of correct code

```js
const a = [];
const c = a;

console.log(a);
```

### Simplify

## ❌ Example of incorrect code

```js
if (zone?.tooltipCallback) {
    zone.tooltipCallback(e);
}

if (a)
    alert('hello');
else
    alert('hello');
```

## ✅ Example of correct code

```js
zone?.tooltipCallback(e);

alert('hello');
```

## License

MIT
npm package: @putout/plugin-remove-useless-constructor
Description: 🐊Putout plugin adds ability to remove useless constructor
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-useless-constructor [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-constructor.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-constructor "npm"

> The `constructor` method is a special method of a class for creating and initializing an object instance of that class.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `constructor`.
Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/4f23b20fe29ebaf9c691662846f75c0f/04a5f3c7ea0aba9dd9ed9fe76d957c29c46ef626).

## Install

```
npm i @putout/plugin-remove-useless-constructor
```

## Rule

```json
{
    "rules": {
        "remove-useless-constructor": "on"
    }
}
```

## ❌ Example of incorrect code

```js
class A extends B() {
    constructor(...args) {
        super(...args);
    }
}
```

## ✅ Example of correct code

```js
class A extends B() {}
```

## License

MIT
npm package: @putout/plugin-remove-useless-continue
Description: 🐊Putout plugin adds ability to remove useless 'continue'
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-useless-continue [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-continue.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-continue "npm"

> The `continue` statement terminates execution of the statements in the current iteration of loop.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/continue)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `continue`.

## Install

```
npm i @putout/plugin-remove-useless-continue
```

## Rule

```json
{
    "rules": {
        "remove-useless-continue": "on"
    }
}
```

## ❌ Example of incorrect code

```js
for ((sign = decpt, i = 0); sign /= 10 !== 0; i++) {
    console.log('hello');
    continue;
}
```

## ✅ Example of correct code

```js
for ((sign = decpt, i = 0); sign /= 10 !== 0; i++) {
    console.log('hello');
}
```

## License

MIT
npm package: @putout/plugin-remove-useless-delete
Description: 🐊Putout plugin adds ability to remove useless delete
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-useless-delete [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-assign.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-assign "npm"

> The `delete` operator removes a `property` from an `object`. If the `property`'s value is an `object` and there are no more references to the `object`, the `object` held by that `property` is eventually released automatically.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `delete`.
Check it out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/71a95e8831318c77549ae2e49332f6a4/32dd1c3525ba8b65be2cf7fd02cb8e20646ac3f8).

Fixes syntax error:

> `SyntaxError: Delete of an unqualified identifier in strict mode.`
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Delete_in_strict_mode)

## Install

```
npm i @putout/plugin-remove-useless-delete
```

## Rule

```json
{
    "rules": {
        "remove-useless-assign": "on"
    }
}
```

## ❌ Example of incorrect code

```js
delete x;
delete x.x;
delete x[1];
```

## ✅ Example of correct code

```js
delete x.x;
delete x[1];
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout** | [`remove-useless-delete`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useles-delete#readme) | ✅
⏣ **ESLint** | [`no-delete-var`](https://eslint.org/docs/rules/no-delete-var) | ❌
🦕 **Deno** | [`no-delete-var`](https://lint.deno.land/rules/no-delete-var) | ❌

## License

MIT
npm package: @putout/plugin-remove-useless-else
Description: 🐊Putout plugin adds ability to remove useless else
Author: coderaiser
Latest version: 2.0.2

# @putout/plugin-remove-useless-else [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-else.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-else"npm"

> You can skip the `else` block if your `if` block always executes a `return` statement, it makes code a lot easier to read.
>
> (c) [no else return](https://www.samanthaming.com/tidbits/23-no-else-return/)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `else`. Merged to [`@putout/plugin-conditions`](https://www.npmjs.com/package/@putout/plugin-conditions).

## Install

```
npm i @putout/plugin-remove-useless-else
```

## Rule

```json
{
    "rules": {
        "remove-useless-else": "on"
    }
}
```

## ❌ Example of incorrect code

```js
if (x)
    return;
else
    console.log();
```

## ✅ Example of correct code

```js
if (x)
    return;

console.log();
```

## License

MIT
npm package: @putout/plugin-remove-useless-escape
Description: 🐊Putout plugin adds ability to find and remove useless escape
Author: coderaiser
Latest version: 10.0.0

# @putout/plugin-remove-useless-escape [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-escape.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-escape "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove useless escape.

## Install

```
npm i @putout/plugin-remove-useless-escape
```

## Rule

```json
{
    "rules": {
        "remove-useless-escape": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const t = 'hello \"world\"';
const s1 = `hello \"world\"`;
const s = `hello \'world\'`;
```

## ✅ Example of correct code

```js
const t = 'hello "world"';
const s1 = `hello "world"`;
const s = `hello 'world'`;
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout**| [`remove-useless-escape`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-escape#readme)| ✅
⏣ **ESLint** | [`no-useless-escape`](https://eslint.org/docs/rules/no-useless-escape) | ❌

## License

MIT
npm package: @putout/plugin-remove-useless-for-of
Description: 🐊Putout plugin adds ability to remove useless for-of
Author: coderaiser
Latest version: 2.0.1

# @putout/plugin-remove-useless-for-of [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-for-of.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-for-of "npm"

> The `Array` enables storing a collection of multiple items under a single variable name.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `for...of` statements. Merged to [`@putout/plugin-for-of`](https://www.npmjs.com/package/@putout/plugin-for-of).

## Install

```
npm i @putout/plugin-remove-useless-for-of
```

## Rule

```json
{
    "rules": {
        "remove-useless-for-of": "on"
    }
}
```

## ❌ Example of incorrect code

```js
for (const a of ['hello']) {
    console.log(a);
}
```

## ✅ Example of correct code

```js
console.log('hello');
```

## License

MIT
npm package: @putout/plugin-remove-useless-functions
Description: 🐊Putout plugin adds ability to find and remove useless functions
Author: coderaiser
Latest version: 5.0.0

# @putout/plugin-remove-useless-functions [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-functions.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-functions "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove `useless functions`.

## Install

```
npm i @putout/plugin-remove-useless-functions -D
```

## Rule

```json
{
    "rules": {
        "remove-useless-functions": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const y = (...a) => {
    alert(...a);
};

[1, 2, null].filter((a) => a);
```

## ✅ Example of correct code

```js
const y = alert;
[1, 2, null].filter(Boolean);
```

## Open Questions

Why there is no transform for such case:

```js
const f = (a) => alert(a);
```

Isn't is the same as:

```js
const f = alert;
```

Actually it is the same, and this example can be converted without an issue,
but there is also cases like:

```js
const one = (f) => (a) => f(a);

[
    1,
    2,
    3,
    4,
].map(one(console.log));

// output
1;
2;
3;
```

And if it will be simplified:

```js
const one = (f) => f;

[
    1,
    2,
    3,
    4,
].map(one(console.log));

// output
'1 0 [1, 2, 3]';
'2 1 [1, 2, 3]';
'3 2 [1, 2, 3]';
```

So behaviour is totally different. The same result for:

```js
[
    1,
    2,
    3,
    4,
].map(console.log);
```

Because `map` calls a function with 3 arguments, and `console.log` receives any count of arguments,
to cut redundant args there is a need to use something like:

```js
const one = (f) => (a) => f(a);
```

There is a lot such cases in the wild. While we have no syntax to set the count of `arguments` we are going to receive,
and a way to avoid returning result we don't want function to return, there is no need in such a dengerous transform.

## License

MIT
npm package: @putout/plugin-remove-useless-map
Description: 🐊Putout plugin adds ability to remove useless `.map`
Author: coderaiser
Latest version: 3.0.1

# @putout/plugin-remove-useless-map [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-map.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-map "npm"

> The `map()` method creates a new array populated with the results of calling a provided function on every element in the calling array.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `map()`.

## Install

```
npm i @putout/plugin-remove-useless-map
```

## Rule

```json
{
    "rules": {
        "remove-useless-map": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const [str] = lines.map((line) => `hello ${line}`);

const x = array.map((a) => a);

Object
    .entries(a)
    .map(([a, b]) => [a, b]);
```

## ✅ Example of correct code

```js
const [line] = lines;
const str = `hello ${line}`;

const x = array;
```

## License

MIT
npm package: @putout/plugin-remove-useless-mapped-types
Description: putout plugin adds ability to remove useless mapped types
Author: coderaiser
Latest version: 1.0.1

# @putout/plugin-remove-useless-mapped-types [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-mapped-types.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-mapped-types "npm"

🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to remove useless [mapped types](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html).
Moved to [`@putout/plugin-typescript`](https://github.com/coderaiser/putout/v24.0.2/master/packages/plugin-typescript#convert-generic-to-shorthand).

## Install

```
npm i @putout/plugin-remove-useless-mapped-types
```

## Rule

```json
{
    "rules": {
        "remove-useless-mapped-types": "on"
    }
}
```

## ❌ Incorrect code example

```ts
type SuperType = {
    [Key in keyof Type]: Type[Key];
};
```

## ✅ Correct code Example

```ts
type SuperType = Type;
```

## License

MIT
npm package: @putout/plugin-remove-useless-mapping-modifiers
Description: 🐊Putout plugin adds ability to remove useless mapping modifiers
Author: coderaiser
Latest version: 1.0.2

# @putout/plugin-remove-useless-mapping-modifiers [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-mapping-modifiers.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-mapping-modifiers "npm"

🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to remove useless [mapping modifiers](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#mapping-modifiers).
Moved to [`@putout/plugin-typescript`](https://github.com/coderaiser/putout/tree/v24.0.2/packages/plugin-typescript#remove-useless-mapping-modifiers)

## Install

```
npm i @putout/plugin-remove-useless-mapping-modifiers
```

## Rule

```json
{
    "rules": {
        "remove-useless-mapping-modifiers": "on"
    }
}
```

## ❌ Incorrect code example

```ts
type SuperType = {
    [Key in keyof Type]+?: Type[Key];
};
```

## ✅ Correct code Example

```ts
type SuperType = {
    [Key in keyof Type]?: Type[Key];
};
```

## License

MIT
npm package: @putout/plugin-remove-useless-new
Description: 🐊Putout plugin adds ability to remove useless operator 'new'
Author: coderaiser
Latest version: 2.3.2

# @putout/plugin-remove-useless-new [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-new.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-new "npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless operator `new`. Which has no sense for `BigInt`, `Boolean`, `String`, `Number`, `Object`, `RegExp`, `Error`:

> Thus the function call `Error(…)` is equivalent to the object creation expression `new Error(…)` with the same arguments.
>
> (c) https://262.ecma-international.org/12.0/#sec-error-constructor

And [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) cannot be used with `new`, as it is primitive.
Part of [`@putout/plugin-new`](https://www.npmjs.com/package/@putout/plugin-new).

## Install

```
npm i @putout/plugin-remove-useless-new
```

## Rule

```json
{
    "rules": {
        "remove-useless-new": "on"
    }
}
```

## ❌ Example of incorrect code

```js
new Error('Something whent wrong');
new new Boolean();
```

## ✅ Example of correct code

```js
Error('Something whent wrong');
Boolean();
```

## Comparison

Linter | Rule | Fix
--------|-------|------------|
🐊 **Putout** | [`remove-useless-new`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-new#readme)| ✅
🦕 **ESLint** | [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers) | ❌
⠀| [`no-new-object`](https://eslint.org/docs/rules/no-new-object) | ❌
⠀| [`no-array-constructor`](https://eslint.org/docs/rules/no-array-constructor) | ❌
⠀| [`no-new-symbol`](https://eslint.org/docs/rules/no-new-symbol) | ❌

## License

MIT
npm package: @putout/plugin-remove-useless-object-from-entries
Description: 🐊Putout plugin adds ability to remove useless 'Object.fromEntries()'
Author: coderaiser
Latest version: 1.0.1

# @putout/plugin-remove-useless-object-from-entries [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-object-from-entries.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-object-from-entries "npm"

> The `Object.fromEntries()` static method transforms a list of key-value pairs into an object.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless [`Object.fromEntries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries).

## Install

```
npm i @putout/plugin-remove-useless-object-from-entries
```

## Rule

```json
{
    "rules": {
        "remove-useless-object-from-entries": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const a = {
    b: Object.fromEntries(Object.entries({
        hello: 'world',
    })),
};
```

## ✅ Example of correct code

```js
const a = {
    b: {
        hello: 'world',
    },
};
```

## License

MIT
npm package: @putout/plugin-remove-useless-operand
Description: 🐊Putout plugin adds ability to remove useless operand
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-useless-operand [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-operand.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-operand "npm"

> The [**increment operator**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Increment) (`++`) adds one to its operand and returns a value.
>
> The [**addition assignment operator**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition_assignment) (`+=`) adds the value of the right operand to a variable and assigns the result to the variable.
>
> (c) MDN

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless **operand**.

## Install

```
npm i @putout/plugin-remove-useless-operand
```

## Rule

```json
{
    "rules": {
        "remove-useless-operand": "on"
    }
}
```

## ❌ Example of incorrect code

```js
a = a + b;
a = b + a;
b += 1;
```

## ✅ Example of correct code

```js
a += b;
++b;
```

## License

MIT
npm package: @putout/plugin-remove-useless-push
Description: 🐊Putout plugin adds ability to remove useless 'push()'
Author: coderaiser
Latest version: 3.0.0

# @putout/plugin-remove-useless-push [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-push.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-push "npm"

> The `push()` method of `Array` instances adds the specified elements to the end of an array and returns the new length of the array.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `push()`. The rule fits good with  [`putout/remove-unused-variables`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-unused-variables#readme).

Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/edebc3873f4b2ea6d99cfb957814bc63/603eed77455010519c1127490267888e3f6576a8).

## Install

```
npm i @putout/plugin-remove-useless-push
```

## Rule

```json
{
    "rules": {
        "remove-useless-push": "on"
    }
}
```

## ❌ Example of incorrect code

```js
function get() {
    const a = [];
    const b = [];
    
    a.push(1);
    b.push(2);
    
    return b;
}
```

## ✅ Example of correct code

```js
function get() {
    const a = [];
    const b = [];
    
    b.push(2);
    
    return b;
}
```

## License

MIT
npm package: @putout/plugin-remove-useless-replace
Description: 🐊Putout plugin adds ability to remove useless 'replace()'
Author: coderaiser
Latest version: 2.0.0

# @putout/plugin-remove-useless-replace [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-replace.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-replace "npm"

> The `replace()` method returns a new string with some or all matches of a `pattern` replaced by a `replacement`. The original string is left unchanged.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless `replace`.
Check it out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/a7697acfe3a2f9fcac07a205a420ea83/3b5a99fa1be2ce5268c33bfe51826eeb6def1ed0).

## Install

```
npm i @putout/plugin-remove-useless-replace
```

## Rule

```json
{
    "rules": {
        "remove-useless-replace": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const a = 'hello'.replace(b, b);
```

## ✅ Example of correct code

```js
const a = 'hello';
```

## License

MIT
npm package: @putout/plugin-remove-useless-return
Description: 🐊Putout plugin adds ability to find and remove useless return
Author: coderaiser
Latest version: 7.0.2

# @putout/plugin-remove-useless-return [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-return.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-return"npm"

> The `return` statement ends function execution and specifies a value to be returned to the function caller.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove useless `return`. Merged with [`@putout/plugin-return`](https://www.npmjs.com/package/@putout/plugin-return).


## Install

```
npm i @putout/plugin-remove-useless-return
```

## Rule

```json
{
    "rules": {
        "remove-useless-return": "on"
    }
}
```

## ❌ Example of incorrect code

```js
const traverse = ({push}) => {
    return {
        ObjectExpression(path) {
            push(path);
        },
    };
};
```

## ✅ Example of correct code

```js
const traverse = ({push}) => ({
    ObjectExpression(path) {
        push(path);
    },
});
```

## License

MIT
npm package: @putout/plugin-remove-useless-spread
Description: 🐊Putout plugin adds ability to remove useless spread
Author: coderaiser
Latest version: 13.1.1

# @putout/plugin-remove-useless-spread [![NPM version][NPMIMGURL]][NPMURL]

[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-spread.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-spread "npm"

> **Spread** syntax can be used when all elements from an object or array need to be included in a list of some kind.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to remove useless **spread** syntax. Merged with [`@putout/plugin-spread`](https://www.npmjs.com/package/@putout/plugin-spread).

## Install

```
npm i @putout/plugin-remove-useless-spread
```

## Rule

```json
{
    "rules": {
        "remove-useless-spread/array": "on",
        "remove-useless-spread/object": "on",
        "remove-useless-spread/nested": "on"
    }
}
```

## array

The thing is `[...b]` can be used for:

- copying an array;
- converting different value type like `string` to an `array`.

So better to be more concrete and use `slice` for copying and `Array()`/`Array.from()` for converting to decrease cognitive load.
Also sometimes there is no need on any of this operations, and we can drop `spread`.

### ❌ Example of incorrect code

```js
for (const a of [...b]) {}

const places = [...getPlaces()];
```

### ✅ Example of correct code

```js
for (const a of b) {}

const places = getPlaces();

// Array constructor creates sparse array
[...Array(5)].map(Number);
```

## object

### ❌ Example of incorrect code

```js
const a = {
    ...fn(),
};
```

### ✅ Example of correct code

```js
const a = fn();
```

## nested

Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/60e5a99112affb8a629347e5bf04aedf/38b33f3b5b133897b346a018462c431824e64bb8).

### ❌ Example of incorrect code

```js
[
    ...[
        ...a,
        ...b,
    ],
    ...x,
];
```

### ✅ Example of correct code

```js
[
    ...a,
    ...b,
    ...x,
];
```

## License

MIT