2.0.0 β’ Published 8 months ago
@putout/plugin-labels v2.0.0
@putout/plugin-labels 
A labeled statement is any
statementthat is prefixed with anidentifier. You can jump to this label using abreakorcontinuestatement nested within the labeled statement.(c) MDN
πPutout plugin adds ability to find and remove unused label statement.
Install
npm i @putout/plugin-labels -DRules
- β add-missing-async;
- β remove-unused;
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