Fix ternary format in function call (#4368)

* Fix ternary format in fn call

* Formatted to align with linter

* Update jsfmt.spec.js.snap

* Update jsfmt.spec.js.snap

* test: remove obsolete snapshot
master
Malcolm Groves 2018-08-15 11:29:04 -06:00 committed by Jed Fox
parent 1790211f76
commit d480858f01
3 changed files with 94 additions and 1 deletions

View File

@ -470,7 +470,8 @@ function printPathNoParens(path, options, print, args) {
(n === parent.body && parent.type === "ArrowFunctionExpression") ||
(n !== parent.body && parent.type === "ForStatement") ||
(parent.type === "ConditionalExpression" &&
parentParent.type !== "ReturnStatement");
(parentParent.type !== "ReturnStatement" &&
parentParent.type !== "CallExpression"));
const shouldIndentIfInlining =
parent.type === "AssignmentExpression" ||

View File

@ -140,6 +140,90 @@ room = room.map((row, rowIndex) =>
`;
exports[`func-call.js - flow-verify 1`] = `
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
`;
exports[`func-call.js - flow-verify 2`] = `
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
`;
exports[`func-call.js - flow-verify 3`] = `
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
`;
exports[`func-call.js - flow-verify 4`] = `
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);
`;
exports[`indent.js - flow-verify 1`] = `
aaaaaaaaaaaaaaa ? bbbbbbbbbbbbbbbbbb : ccccccccccccccc ? ddddddddddddddd : eeeeeeeeeeeeeee ? fffffffffffffff : gggggggggggggggg

View File

@ -0,0 +1,8 @@
fn(
bifornCringerMoshedPerplexSawder,
askTrovenaBeenaDependsRowans,
glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl &&
anodyneCondosMalateOverateRetinol
? annularCooeedSplicesWalksWayWay
: kochabCooieGameOnOboleUnweave
);