Socket
Socket
Sign inDemoInstall

@putout/plugin-remove-nested-blocks

Package Overview
Dependencies
393
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/plugin-remove-nested-blocks

🐊Putout plugin adds ability to find and remove nested blocks


Version published
Weekly downloads
11K
decreased by-46.63%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@putout/plugin-remove-nested-blocks NPM version

Delimited by a pair of curly brackets block statement is used to group zero or more statements.

(c) MDN

🐊Putout plugin adds ability to find and remove nested bocks.

☝️Remember, when you writing a transform you can skip all parts related to removing nested blocks and just reuse current plugin it will make your code simpler and less error prone.

Install

npm i @putout/plugin-remove-nested-blocks

Rule

{
    "rules": {
        "remove-nested-blocks": "on"
    }
}

❌ Example of incorrect code

for (const x of Object.keys(a)) {
    {
        console.log(x);
        console.log(xxx);
    }
}

✅ Example of correct code

for (const x of Object.keys(a)) {
    console.log(x);
    console.log(xxx);
}

switch(x) {
case 1: {
    const m = 5;
}
}

Comparison

LinterRuleFix
🐊 Putoutremove-nested-blocks
ESLintno-lone-blocks

License

MIT

Keywords

FAQs

Last updated on 12 Jul 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc