I can't imagine caring that much about trailing commas. The point of a tool like prettier is to not sweat such irrelevant details.
Let’s say you have some code :
const foo = {
x: 1,
y: 2,
};
and you want to add a field : const foo = {
x: 1,
y: 2,
z: 3,
};
Without trailing commas, the diff is - y: 2
+ y: 2,
+ z: 3
With trailing commas : + z: 3,
The second diff is actually much clearer at what’s happening.This is why it irritates me when people forget the trailing comma. It’s not a problem in the moment. But I know it will be a small but avoidable cognitive burden on the next PR (wait, why did "y" changed ? Oh, right, it didn’t).
All that, just to not have to add a trailing comma ?
Certainly the idea has been suggested many times. I think people end up formatting both before/after and doing a diff on formatted before against formatted after. I've done that.