@putout/plugin-labels

1.0.0 • Public • Published

@putout/plugin-labels NPM version

A labeled statement is any statement that is prefixed with an identifier. You can jump to this label using a break or continue statement nested within the labeled statement. (c) MDN

🐊Putout plugin adds ability to find and remove unused label statement.

Install

npm i @putout/plugin-labels -D

Rules

Config

{
    "rules": {
        "labels/convert-to-object": "on",
        "labels/remove-unused": "on"
    }
}

☝️ If you want to override any of it, update .putout.json in the directory near your files.

🦉 Configuration section of 🐊Putout documentation tell you more about all configuration options supported.

convert-to-object

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

const a = () => {
    hello: 'world';
    x: 'm';
};

✅ Example of correct code

const a = () => ({
    hello: 'world',
    x: 'm',
});

remove-unused

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

hello: while (true) {
    break;
}

✅ Example of correct code

while (true) {
    break;
}

Comparison

Linter Rule Fix
🐊 Putout remove-unused-labels
ESLint no-unused-labels
🦕 Deno no-unused-labels

License

MIT

Package Sidebar

Install

npm i @putout/plugin-labels

Weekly Downloads

3,571

Version

1.0.0

License

MIT

Unpacked Size

7.22 kB

Total Files

6

Last publish

Collaborators

  • coderaiser