Align boolean inside of arrow functions (#691)
We already do it for if/... but it looks weird for arrow function body.master
parent
b93a207bb2
commit
00e5014e00
|
@ -186,11 +186,12 @@ function genericPrintNoParens(path, options, print) {
|
||||||
// Avoid indenting sub-expressions in if/etc statements.
|
// Avoid indenting sub-expressions in if/etc statements.
|
||||||
if (
|
if (
|
||||||
shouldInlineLogicalExpression(n) ||
|
shouldInlineLogicalExpression(n) ||
|
||||||
|
n !== parent.body &&
|
||||||
(parent.type === "IfStatement" ||
|
(parent.type === "IfStatement" ||
|
||||||
parent.type === "WhileStatement" ||
|
parent.type === "WhileStatement" ||
|
||||||
parent.type === "DoStatement" ||
|
parent.type === "DoStatement" ||
|
||||||
parent.type === "ForStatement") &&
|
parent.type === "ForStatement") ||
|
||||||
n !== parent.body
|
n === parent.body && parent.type === "ArrowFunctionExpression"
|
||||||
) {
|
) {
|
||||||
return group(concat(parts));
|
return group(concat(parts));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
exports[`test arrow.js 1`] = `
|
||||||
|
"function f() {
|
||||||
|
const appEntitys = getAppEntitys(loadObject).filter(
|
||||||
|
entity => entity && entity.isInstallAvailable() && !entity.isQueue() && entity.isDisabled()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function f() {
|
||||||
|
const appEntitys = getAppEntitys(loadObject).filter(
|
||||||
|
entity =>
|
||||||
|
entity &&
|
||||||
|
entity.isInstallAvailable() &&
|
||||||
|
!entity.isQueue() &&
|
||||||
|
entity.isDisabled()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`test inline-object-array.js 1`] = `
|
exports[`test inline-object-array.js 1`] = `
|
||||||
"prevState = prevState || {
|
"prevState = prevState || {
|
||||||
catalogs: [],
|
catalogs: [],
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
function f() {
|
||||||
|
const appEntitys = getAppEntitys(loadObject).filter(
|
||||||
|
entity => entity && entity.isInstallAvailable() && !entity.isQueue() && entity.isDisabled()
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in New Issue