1.0.5 β€’ Published 12 months ago

@putout/plugin-convert-break-to-return v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@putout/plugin-convert-break-to-return NPM version

The break statement terminates the current loop or switch statement and transfers program control to the statement following the terminated statement.

(c) MDN

SyntaxError: unlabeled break must be inside loop or switch

(c) MDN

🐊Putout plugin adds ability to convert break to return. Checkout in 🐊Putout Editor. Merged with @putout/plugin-return.

Install

npm i @putout/plugin-convert-break-to-return -D

Rule

{
    "rules": {
        "convert-break-to-return": "on"
    }
}

❌ Example of incorrect code

function x() {
    if (a)
        break;
    
    return false;
}

βœ… Example of correct code

function x() {
    if (a)
        return;
    
    return false;
}

License

MIT

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago