Comparing ReScript's behavior to Prettier's, Prettier is consistent for types and values, but ReScript is not.
My proposal is to standardize on Prettier's behavior, also because it seems to follow user intention better. If the user put the first record field on a separate line, we may assume that they intend to keep the formatting multiline and/or add more fields later.
Prettier
Types
type X = { a: number };
type Y = { a: number
};
type Z = {
a: number
};
reformats to
type X = { a: number };
type Y = { a: number };
type Z = {
a: number;
};
Values
let x = { a: 2 };
let x = { a: 2,
};
let x = {
a: 2,
};
reformats to
let x = { a: 2 };
let x = { a: 2 };
let x = {
a: 2,
};
ReScript
Types
type x = {a: int}
type y = {a: int
}
type z = {
a: int,
}
reformats to
type x = {a: int}
type y = {a: int}
type z = {a: int}
Values
let x = {a: 2}
let x = {a: 2
}
let x = {
a: 2
}
reformats to
let x = {a: 2}
let x = {
a: 2,
}
let x = {
a: 2,
}
Comparing ReScript's behavior to Prettier's, Prettier is consistent for types and values, but ReScript is not.
My proposal is to standardize on Prettier's behavior, also because it seems to follow user intention better. If the user put the first record field on a separate line, we may assume that they intend to keep the formatting multiline and/or add more fields later.
Prettier
Types
reformats to
Values
reformats to
ReScript
Types
reformats to
Values
reformats to