Фикс против пидоров, которые не хотят поддерживать скобки с новой строки
parent
82257bc091
commit
1916966910
|
@ -1056,22 +1056,22 @@ function printPathNoParens(path, options, print, args) {
|
||||||
!hasDirectives &&
|
!hasDirectives &&
|
||||||
!hasDanglingComments(n) &&
|
!hasDanglingComments(n) &&
|
||||||
(parent.type === "ArrowFunctionExpression" ||
|
(parent.type === "ArrowFunctionExpression" ||
|
||||||
parent.type === "FunctionExpression" ||
|
0 && parent.type === "FunctionExpression" ||
|
||||||
parent.type === "FunctionDeclaration" ||
|
0 && parent.type === "FunctionDeclaration" ||
|
||||||
parent.type === "ObjectMethod" ||
|
0 && parent.type === "ObjectMethod" ||
|
||||||
parent.type === "ClassMethod" ||
|
0 && parent.type === "ClassMethod" ||
|
||||||
parent.type === "ClassPrivateMethod" ||
|
0 && parent.type === "ClassPrivateMethod" ||
|
||||||
parent.type === "ForStatement" ||
|
0 && parent.type === "ForStatement" ||
|
||||||
parent.type === "WhileStatement" ||
|
0 && parent.type === "WhileStatement" ||
|
||||||
parent.type === "DoWhileStatement" ||
|
parent.type === "DoWhileStatement" ||
|
||||||
parent.type === "DoExpression" ||
|
parent.type === "DoExpression" ||
|
||||||
(parent.type === "CatchClause" && !parentParent.finalizer) ||
|
0 && (parent.type === "CatchClause" && !parentParent.finalizer) ||
|
||||||
parent.type === "TSModuleDeclaration")
|
parent.type === "TSModuleDeclaration")
|
||||||
) {
|
) {
|
||||||
return "{}";
|
return "{}";
|
||||||
}
|
}
|
||||||
|
|
||||||
parts.push("{");
|
parts.push(hardline, "{");
|
||||||
|
|
||||||
// Babel 6
|
// Babel 6
|
||||||
if (hasDirectives) {
|
if (hasDirectives) {
|
||||||
|
@ -1795,7 +1795,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
comment.trailing && !handleComments.isBlockComment(comment)
|
comment.trailing && !handleComments.isBlockComment(comment)
|
||||||
)) ||
|
)) ||
|
||||||
needsHardlineAfterDanglingComment(n);
|
needsHardlineAfterDanglingComment(n);
|
||||||
const elseOnSameLine =
|
const elseOnSameLine = 0 &&
|
||||||
n.consequent.type === "BlockStatement" && !commentOnOwnLine;
|
n.consequent.type === "BlockStatement" && !commentOnOwnLine;
|
||||||
parts.push(elseOnSameLine ? " " : hardline);
|
parts.push(elseOnSameLine ? " " : hardline);
|
||||||
|
|
||||||
|
@ -1975,7 +1975,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
"try ",
|
"try ",
|
||||||
path.call(print, "block"),
|
path.call(print, "block"),
|
||||||
n.handler ? concat([" ", path.call(print, "handler")]) : "",
|
n.handler ? concat([" ", path.call(print, "handler")]) : "",
|
||||||
n.finalizer ? concat([" finally ", path.call(print, "finalizer")]) : ""
|
n.finalizer ? concat([hardline, "finally ", path.call(print, "finalizer")]) : ""
|
||||||
]);
|
]);
|
||||||
case "CatchClause":
|
case "CatchClause":
|
||||||
if (n.param) {
|
if (n.param) {
|
||||||
|
@ -1994,6 +1994,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
const param = path.call(print, "param");
|
const param = path.call(print, "param");
|
||||||
|
|
||||||
return concat([
|
return concat([
|
||||||
|
hardline,
|
||||||
"catch ",
|
"catch ",
|
||||||
hasComments
|
hasComments
|
||||||
? concat(["(", indent(concat([softline, param])), softline, ") "])
|
? concat(["(", indent(concat([softline, param])), softline, ") "])
|
||||||
|
@ -2318,7 +2319,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
case "ClassBody":
|
case "ClassBody":
|
||||||
if (!n.comments && n.body.length === 0) {
|
if (0 && !n.comments && n.body.length === 0) {
|
||||||
return "{}";
|
return "{}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4612,7 +4613,7 @@ function printClass(path, options, print) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
n.body &&
|
1 || n.body &&
|
||||||
n.body.comments &&
|
n.body.comments &&
|
||||||
hasLeadingOwnLineComment(options.originalText, n.body, options)
|
hasLeadingOwnLineComment(options.originalText, n.body, options)
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue