Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@putout/plugin-remove-useless-conditions

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/plugin-remove-useless-conditions

🐊Putout plugin adds ability to remove useless conditions

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@putout/plugin-remove-useless-conditions NPM version

The if statement executes a statement if a specified condition is truthy. If the condition is falsy, another statement can be executed.

(c) MDN

🐊Putout plugin adds ability to remove useless conditions. Merged to @putout/plugin-conditions.

Install

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

Rule

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

Evaluate

❌ Example of incorrect code

const a = [];
const c = a;

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

✅ Example of correct code

const a = [];
const c = a;

console.log(a);

Simplify

❌ Example of incorrect code

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

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

✅ Example of correct code

zone?.tooltipCallback(e);

alert('hello');

License

MIT

Keywords

FAQs

Package last updated on 11 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc