# @putout/plugin-remove-useless-conditions

> 🐊Putout plugin adds ability to remove useless conditions

Latest version **3.0.1** (published 2023-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @putout/plugin-remove-useless-conditions
pnpm add @putout/plugin-remove-useless-conditions
yarn add @putout/plugin-remove-useless-conditions
bun add @putout/plugin-remove-useless-conditions
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2023-03-11 |
| First published | 2021-03-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 796 |
| Author | coderaiser |
| Maintainers | coderaiser |
| Keywords | putout, plugin, putout-plugin, putout-plugin-remove, putout-plugin-remove-useless, conditions, useless |

## Links

- npm: https://www.npmjs.com/package/@putout/plugin-remove-useless-conditions
- Repository: https://github.com/coderaiser/putout
- Homepage: https://github.com/coderaiser/putout/tree/v28.19.2/packages/plugin-remove-useless-conditions#readme
- Issues: https://github.com/coderaiser/putout/issues
- npm.io page: https://npm.io/package/@putout/plugin-remove-useless-conditions

## Recent versions

- 3.0.1 (latest) — 2023-03-11
- 3.0.0 — 2023-01-29
- 1.1.0 — 2021-04-09
- 1.0.0 — 2021-03-28

## README

# @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

---
_Source: https://npm.io/package/@putout/plugin-remove-useless-conditions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
