Open munificent opened 3 months ago
This issue is somewhat similar to #1465. Where that one relates to conditional expressions on the right-hand side of "assignments" (=, :, =>), this is about method chains. A method chain can split in a few ways:
=
:
=>
// Unsplit: target.method(arg).another(arg); // Block split: target.method(arg).another( arg, ); // Chain split: target .method(arg) .another(arg);
Currently, if the right-hand side of an assignment is a method chain that chain splits, it also splits the assignment, like:
thing = target .method(arg) .another(arg);
It would be nice to allow the target to stay on the same line as the assignment:
This would only apply if the target itself doesn't split. A split in the target would still force the assignment to split. So:
// Disallowed: thing = (veryLong + targetExpression) .method(arg) .another(arg); // Allowed: thing = (veryLong + targetExpression) .method(arg) .another(arg);
This issue is somewhat similar to #1465. Where that one relates to conditional expressions on the right-hand side of "assignments" (
=
,:
,=>
), this is about method chains. A method chain can split in a few ways:Currently, if the right-hand side of an assignment is a method chain that chain splits, it also splits the assignment, like:
It would be nice to allow the target to stay on the same line as the assignment:
This would only apply if the target itself doesn't split. A split in the target would still force the assignment to split. So: