diff --git a/src/generation/generate.rs b/src/generation/generate.rs index f978a04b..dadb6274 100644 --- a/src/generation/generate.rs +++ b/src/generation/generate.rs @@ -9793,8 +9793,8 @@ fn allows_inline_multi_line<'a>(node: Node<'a>, context: &Context<'a>, has_sibli _ => allows_inline_multi_line(as_expr.type_ann.into(), context, has_siblings), } } + Node::ArrowExpr(arrow) => matches!(arrow.body, BlockStmtOrExpr::BlockStmt(_)), Node::FnExpr(_) - | Node::ArrowExpr(_) | Node::ObjectLit(_) | Node::ArrayLit(_) | Node::ObjectPat(_) diff --git a/tests/specs/issues/issue0686.txt b/tests/specs/issues/issue0686.txt new file mode 100644 index 00000000..46d53cad --- /dev/null +++ b/tests/specs/issues/issue0686.txt @@ -0,0 +1,45 @@ +~~ lineWidth: 80, indentWidth: 2, memberExpression.linePerExpression: true ~~ +== generator == +const createTestData = () => + function*() { + const startingFrom = yield* Effect.map(DateTime.now, now => DateTime.startOf(now, "day")); + + return HashSet.make(DateTime.toEpochMillis(startingFrom)); + }; + + +[expect] +const createTestData = () => + function*() { + const startingFrom = yield* Effect.map( + DateTime.now, + now => DateTime.startOf(now, "day"), + ); + + return HashSet.make(DateTime.toEpochMillis(startingFrom)); + }; + +== function == +const func = () => + function() { + const startingFrom = Effect.map(DateTime.now, now => DateTime.startOf(now, 'day')) + + return myObj + .myMethod({ + missionType: otherObj.prop.nested, + }); + }; + +[expect] +const func = () => + function() { + const startingFrom = Effect.map( + DateTime.now, + now => DateTime.startOf(now, "day"), + ); + + return myObj + .myMethod({ + missionType: otherObj.prop.nested, + }); + }; diff --git a/tests/specs/issues/issue753.txt b/tests/specs/issues/issue753.txt new file mode 100644 index 00000000..926e6394 --- /dev/null +++ b/tests/specs/issues/issue753.txt @@ -0,0 +1,46 @@ +~~ lineWidth: 80, indentWidth: 2, memberExpression.linePerExpression: true ~~ +== function args == +const startingFrom = Mylib.map(DateTime.now, now => DateTime.startOf(now, "day")); + +const func = () => + function() { + const startingFrom = Mylib.map(DateTime.now, now => DateTime.startOf(now, "day")); + } + + +[expect] +const startingFrom = Mylib.map( + DateTime.now, + now => DateTime.startOf(now, "day"), +); + +const func = () => + function() { + const startingFrom = Mylib.map( + DateTime.now, + now => DateTime.startOf(now, "day"), + ); + }; + +== function args same line length == +const startingFroom = Mylib.map(DateTime.now, now => DateTime.startOf(now, "day")); + +const func = () => + function() { + const startingF = Mylib.map(DateTime.now, now => DateTime.startOf(now, "day")); + } + + +[expect] +const startingFroom = Mylib.map( + DateTime.now, + now => DateTime.startOf(now, "day"), +); + +const func = () => + function() { + const startingF = Mylib.map( + DateTime.now, + now => DateTime.startOf(now, "day"), + ); + };