@putout/plugin-apply-consistent-blocks
v1.2.1
Published
šPutout plugin adds ability to apply consistent blocks
Downloads
6
Maintainers
Readme
@putout/plugin-apply-consistent-blocks
A block statement is used to group zero or more statements. The block is delimited by a pair of braces ("curly braces") and contains a list of zero or more statements and declarations.
(c) MDN
šPutout plugin adds ability to apply consistent blocks. Check out in šPutout Editor. Merged to @putout/plugin-conditions.
Install
npm i @putout/plugin-apply-consistent-blocks
Rule
{
"rules": {
"apply-consistent-blocks": "on"
}
}
ā Example of incorrect code
if (a > 3) {
m();
}
if (a > 3)
b = 5;
else {
b = 6;
}
if (a > 3)
b = 5;
else {
b = 6;
fn();
}
ā Example of correct code
if (a > 3)
m();
if (a > 3)
b = 5;
else
b = 6;
if (a > 3) {
b = 5;
} else {
b = 6;
fn();
}
License
MIT