1.0.5 β’ Published 12 months ago
@putout/plugin-convert-break-to-return v1.0.5
@putout/plugin-convert-break-to-return 
The
breakstatement 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 -DRule
{
"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