New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@putout/plugin-remove-empty

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/plugin-remove-empty

putout plugin adds ability to find and remove blocks with empty body


Version published
Maintainers
1
Created

putout-plugin-remove-empty NPM version Dependency Status

putout plugin adds ability to find and remove:

  • empty block statements;
  • empty patterns;
  • empty imports;

Install

npm i @putout/plugin-remove-empty

Rule

Rules remove-empty is enabled by default, to disable add to .putout.json:

{
    "rules": {
        "remove-empty/block": false,
        "remove-empty/pattern": false
        "remove-empty/import": false
    }
}

Code Example

const {readFileSync} = require('fs');
const source = readFileSync('./1.js', 'utf8');

const putout = require('putout');

console.log(source);
// outputs
`
if (2 > 3) {
}
`

const result = putout(source, {
    plugins: [
        'remove-empty'
    ]
});
// returns
''

License

MIT

FAQs

Package last updated on 28 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts