@putout/plugin-remove-nested-blocks
Delimited by a pair of curly brackets block statement is used to group zero or more statements.
(c) MDN
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 |
---|---|---|
|
remove-nested-blocks |
|
⏣ ESLint | no-lone-blocks |
License
MIT