consume-join
Keeping a value next to the return or switch that reads it.
a single-line declaration or assignment is followed directly by a return or switch that references what it binds
The same shape as guard-join with a return or a switch as the reader: a single-line declaration or assignment, then a return or switch that reads a name it binds, and the blank line between them goes. Only the declaration has to fit on one line. A multi-line return, like the object literal in the example, still joins.
throw is not a consumer. const error = new Error(message) followed by throw error is not joined by this rule (a two statement body still ends up tight, through short-body).
Outranked by short-body and after-multiline. A return that mentions the name only inside a callback, as in return () => use(kind), does not read it and does not join.
Example
function summary(order: Order) {
const total = sum(order.lines);
return {
id: order.id,
total,
};
}function summary(order: Order) {
const total = sum(order.lines);
return {
id: order.id,
total,
};
}