@putout/plugin-remove-nested-blocks
v6.3.0
Published
šPutout plugin adds ability to find and remove nested blocks
Downloads
53,700
Maintainers
Readme
@putout/plugin-remove-nested-blocks
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
Linter | Rule | Fix
--------|-------|------------|
š Putout| remove-nested-blocks
| ā
ā£ ESLint | no-lone-blocks
| ā
License
MIT