Socket
Book a DemoInstallSign in
Socket

@putout/plugin-remove-empty

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

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

latest
Source
npmnpm
Version
15.0.0
Version published
Weekly downloads
6.9K
5.92%
Maintainers
1
Weekly downloads
 
Created
Source

@putout/plugin-remove-empty NPM version

🐊Putout plugin adds ability to find and remove:

  • empty blocks;
  • empty static blocks;
  • empty patterns;
  • empty arguments;

Install

npm i @putout/plugin-remove-empty

Rules

Config

{
    "rules": {
        "remove-empty/block": "on",
        "remove-empty/static-block": "on",
        "remove-empty/pattern": "on",
        "remove-empty/nested-pattern": "on",
        "remove-empty/argument": "on"
    }
}

block

-if (2 > 3) {}

static-block

Check it out in 🐊Putout Editor.

class Hello {
-    static {
-    }
}

pattern

-const [] = array;
-const {} = object;

nested-pattern

❌ Example of incorrect code

export const func = (param) => {
    const {
        a: {
        },
        c,
    } = param;
    
    return c;
};

✅ Example of correct code

export const func = (param) => {
    const {c} = param;
    return c;
};

arguments

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

const create = ({} = {}) => 'hello';

module.exports = ({rule, plugin, msg, options}, {}) => {};

const a = {
    EmptyStatement({}) {},
};

✅ Example of correct code

const create = () => 'hello';

module.exports = ({rule, plugin, msg, options}) => {};

const a = {
    EmptyStatement() {},
};

License

MIT

Keywords

putout

FAQs

Package last updated on 31 May 2025

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