🐊Putout plugin adds ability to find and remove nested blocks
npm install @putout/plugin-remove-nested-blocks[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-nested-blocks.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-nested-blocks "npm"
> 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.
```
npm i @putout/plugin-remove-nested-blocks
`json`
{
"rules": {
"remove-nested-blocks": "on"
}
}
`js`
for (const x of Object.keys(a)) {
{
console.log(x);
console.log(xxx);
}
}
`js
for (const x of Object.keys(a)) {
console.log(x);
console.log(xxx);
}
switch(x) {
case 1: {
const m = 5;
}
}
`
Linter | Rule | Fix
--------|-------|------------|
🐊 Putout| remove-nested-blocks| ✅
⏣ ESLint | no-lone-blocks` | ❌
MIT