@putout/plugin-remove-empty

12.1.0 • Public • Published

@putout/plugin-remove-empty NPM version

🐊Putout plugin adds ability to find and remove:

  • empty blocks;
  • empty static blocks;
  • empty patterns;
  • empty imports;
  • empty arguments;
  • empty exports;

Install

npm i @putout/plugin-remove-empty

Rules

{
    "rules": {
        "remove-empty/block": "on",
        "remove-empty/static-block": "on",
        "remove-empty/pattern": "on",
        "remove-empty/nested-pattern": "on",
        "remove-empty/argument": "on",
        "remove-empty/export": "on",
        "remove-empty/import": ["on", {
            "ignore": []
        }]
    }
}

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;
};

export

-export {};

import

-import 'abc';

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

Package Sidebar

Install

npm i @putout/plugin-remove-empty

Weekly Downloads

14,782

Version

12.1.0

License

MIT

Unpacked Size

13.6 kB

Total Files

11

Last publish

Collaborators

  • coderaiser