Open
Description
I am experiencing some weird indentation issues. Not using any plugins to prettify or similar.
if (condition) {
return; // <-- correct indentation
}
if(condition)
return; // <-- incorrect indentation
Some ppl claim this should be avoided. I don't agree. Using pair of { } for simple early exits messes up code. Putting the return on the end of the same line can be hard to read if the condition is long.
This is not exclusive to return. Applies to all single lines.
same problems apply to for, while, etc.
var transformedValues =
originalValues <-- incorrect should be indented one level.
.where(condition) <-- incorrect, should be indented two levels.
.select(transform); <-- incorrect, should be indented two levels.
function someFunction() {
callToSomeOtherFunction(
variableWithLongNameWhichRequiresASeparateLine,
anotherVariableWithLongNameWhichRequiresASeparateLine);
} <-- incorrect should not be indented.
function ... <-- incorrect the rest of the file is indented.