}
]
},
+ {
+ code: "if (foo) if (bar) { baz() }",
+ output: "if (foo) if (bar) baz() ",
+ options: ["multi"],
+ errors: [
+ {
+ messageId: "unexpectedCurlyAfterCondition",
+ data: { name: "if" },
+ type: "IfStatement"
+ }
+ ]
+ },
+ {
+ code: "if (foo) if (bar) baz(); else if (quux) { quuux(); }",
+ output: "if (foo) if (bar) baz(); else if (quux) quuux(); ",
+ options: ["multi"],
+ errors: [
+ {
+ messageId: "unexpectedCurlyAfterCondition",
+ data: { name: "if" },
+ type: "IfStatement"
+ }
+ ]
+ },
{
code: "while (foo) { bar() }",
output: "while (foo) bar() ",
}
]
},
+ {
+ code: "if (foo) if (bar); else { baz() }",
+ output: "if (foo) if (bar); else baz() ",
+ options: ["multi"],
+ errors: [
+ {
+ messageId: "unexpectedCurlyAfter",
+ data: { name: "else" },
+ type: "IfStatement"
+ }
+ ]
+ },
{
code: "if (true) { if (false) console.log(1) }",
output: "if (true) if (false) console.log(1) ",
}
]
},
+ {
+ code: "if (true) if (true) foo(); else { bar(); baz(); }",
+ output: "if (true) if (true) {foo();} else { bar(); baz(); }",
+ options: ["multi", "consistent"],
+ errors: [
+ {
+ messageId: "missingCurlyAfterCondition",
+ data: { name: "if" },
+ type: "IfStatement"
+ }
+ ]
+ },
{
code: "do{foo();} while (bar)",
output: "do foo(); while (bar)",