jstoolnpp icon indicating copy to clipboard operation
jstoolnpp copied to clipboard

Incorrect indents?

Open andr11b opened this issue 8 years ago • 4 comments

Hi! It seems there is a problem with the indentation 1.

var a = 0,
b = 1;

should be

var a = 0,
    b = 1;
a += v1 + v2 +... +
v7 + v8

should be

a += v1 + v2 +... +
     v7 + v8
$Window.off('click')
 ? true
 : false;

should be

$Window.off('click')
    ? true
    : false;
$Pic.removeAttr('src')
.removeProp('title')
.hide();

should be

$Pic.removeAttr('src')
    .removeProp('title')
    .hide();
switch (foo) {
case 1:
    bar = 1;
    break;
default:
    bar = 2;
}

should be

switch (foo) {
    case 1:
        bar = 1;
        break;
    default:
        bar = 2;
}

andr11b avatar Oct 25 '16 15:10 andr11b

I'll see what i can do to enhance format.

sunjw avatar Oct 27 '16 17:10 sunjw

I forgot about another case:

return (typeof value === "number")
 ? Math.floor(value)
 : (typeof value === "string")
 ? value.charCodeAt(0)
 : default_value;

should be

return (typeof value === "number")
    ? Math.floor(value)
    : (typeof value === "string")
        ? value.charCodeAt(0)
        : default_value;

Thanks!

andr11b avatar Oct 27 '16 18:10 andr11b

@underr-ua The title of your issue should be "Incorrect indents?". Perhaps you should correct it.

NudeSpoons avatar Feb 23 '19 23:02 NudeSpoons

@sunjw - just downloaded the tool, works great but I can second the indentation issues. "Dependent" code (like continued lines) needs to be indented, this is quite important for readability.

DBa2016 avatar Sep 07 '22 15:09 DBa2016