@putout/plugin-remove-nested-blocks
🐊Putout plugin adds ability to find and remove nested blocks
Last updated 2 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-remove-nested-blocks 
SYNC missed versions from official npm registry.

@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

Linter Rule Fix
🐊 Putout remove-nested-blocks ✅
⏣ ESLint no-lone-blocks ❌

License

MIT

Current Tags

  • 9.1.0                                ...           latest (a year ago)

19 Versions

  • 9.1.0                                ...           a year ago
  • 9.0.0                                ...           2 years ago
  • 8.1.0                                ...           2 years ago
  • 8.0.0                                ...           2 years ago
  • 7.1.0                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 6.3.0                                ...           4 years ago
  • 6.2.0                                ...           4 years ago
  • 6.1.0                                ...           5 years ago
  • 6.0.0                                ...           5 years ago
  • 5.0.1                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.1.0                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.1.0                                ...           5 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 35
Today 0
This Week 0
This Month 23
Last Day 0
Last Week 4
Last Month 9
Dependencies (0)
None
Dev Dependencies (12)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE