improve --beautify bracketize
reduce whitespaces from if-else statements fixes #1482 closes #1483
This commit is contained in:
73
test/input/issue-1482/bracketize.js
Normal file
73
test/input/issue-1482/bracketize.js
Normal file
@@ -0,0 +1,73 @@
|
||||
if (x) {
|
||||
foo();
|
||||
}
|
||||
|
||||
if (x) {
|
||||
foo();
|
||||
} else {
|
||||
baz();
|
||||
}
|
||||
|
||||
if (x) {
|
||||
foo();
|
||||
} else if (y) {
|
||||
bar();
|
||||
} else {
|
||||
baz();
|
||||
}
|
||||
|
||||
if (x) {
|
||||
if (y) {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
} else {
|
||||
baz();
|
||||
}
|
||||
|
||||
if (x) {
|
||||
foo();
|
||||
} else if (y) {
|
||||
bar();
|
||||
} else if (z) {
|
||||
baz();
|
||||
} else {
|
||||
moo();
|
||||
}
|
||||
|
||||
function f() {
|
||||
if (x) {
|
||||
foo();
|
||||
}
|
||||
if (x) {
|
||||
foo();
|
||||
} else {
|
||||
baz();
|
||||
}
|
||||
if (x) {
|
||||
foo();
|
||||
} else if (y) {
|
||||
bar();
|
||||
} else {
|
||||
baz();
|
||||
}
|
||||
if (x) {
|
||||
if (y) {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
} else {
|
||||
baz();
|
||||
}
|
||||
if (x) {
|
||||
foo();
|
||||
} else if (y) {
|
||||
bar();
|
||||
} else if (z) {
|
||||
baz();
|
||||
} else {
|
||||
moo();
|
||||
}
|
||||
}
|
||||
17
test/input/issue-1482/default.js
Normal file
17
test/input/issue-1482/default.js
Normal file
@@ -0,0 +1,17 @@
|
||||
if (x) foo();
|
||||
|
||||
if (x) foo(); else baz();
|
||||
|
||||
if (x) foo(); else if (y) bar(); else baz();
|
||||
|
||||
if (x) if (y) foo(); else bar(); else baz();
|
||||
|
||||
if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
|
||||
|
||||
function f() {
|
||||
if (x) foo();
|
||||
if (x) foo(); else baz();
|
||||
if (x) foo(); else if (y) bar(); else baz();
|
||||
if (x) if (y) foo(); else bar(); else baz();
|
||||
if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
|
||||
}
|
||||
12
test/input/issue-1482/input.js
Normal file
12
test/input/issue-1482/input.js
Normal file
@@ -0,0 +1,12 @@
|
||||
if (x) foo();
|
||||
if (x) foo(); else baz();
|
||||
if (x) foo(); else if (y) bar(); else baz();
|
||||
if (x) if (y) foo(); else bar(); else baz();
|
||||
if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
|
||||
function f() {
|
||||
if (x) foo();
|
||||
if (x) foo(); else baz();
|
||||
if (x) foo(); else if (y) bar(); else baz();
|
||||
if (x) if (y) foo(); else bar(); else baz();
|
||||
if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
|
||||
}
|
||||
Reference in New Issue
Block a user