@putout/plugin-remove-nested-blocks

putout plugin adds ability to find and remove nested blocks

Usage no npm install needed!

<script type="module">
  import putoutPluginRemoveNestedBlocks from 'https://cdn.skypack.dev/@putout/plugin-remove-nested-blocks';
</script>

README

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

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

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;
}
}

License

MIT