Align boolean inside of arrow functions (#691)

We already do it for if/... but it looks weird for arrow function body.
master
Christopher Chedeau 2017-02-15 20:00:02 -08:00 committed by GitHub
parent b93a207bb2
commit 00e5014e00
3 changed files with 27 additions and 2 deletions

View File

@ -186,11 +186,12 @@ function genericPrintNoParens(path, options, print) {
// Avoid indenting sub-expressions in if/etc statements.
if (
shouldInlineLogicalExpression(n) ||
n !== parent.body &&
(parent.type === "IfStatement" ||
parent.type === "WhileStatement" ||
parent.type === "DoStatement" ||
parent.type === "ForStatement") &&
n !== parent.body
parent.type === "ForStatement") ||
n === parent.body && parent.type === "ArrowFunctionExpression"
) {
return group(concat(parts));
}

View File

@ -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`] = `
"prevState = prevState || {
catalogs: [],

View File

@ -0,0 +1,5 @@
function f() {
const appEntitys = getAppEntitys(loadObject).filter(
entity => entity && entity.isInstallAvailable() && !entity.isQueue() && entity.isDisabled()
)
}