prettier / plugin-ruby

Prettier Ruby Plugin
MIT License
1.47k stars 98 forks source link

Change defaultOption.trailingComma to "all" to match Prettier for better diffs and easier code manipulation #1391

Closed ghost closed 1 year ago

ghost commented 1 year ago

As described in this excellent blog post from Nik Graf, trailing commas result in cleaner diffs and easier code manipulations. That is why Prettier changed their default to "all" with the release of V3. See also this discussion.

The rationale for Javascript applies to Ruby as well. It would be great for plugin-ruby to be consistent with Prettier.

kddnewton commented 1 year ago

We have lots of things that are different from default prettier because Ruby is a different language with different considerations. (For example, you can't always add a trailing comma in the event of a heredoc.) For that reason, we're going to keep it the same.

ghost commented 1 year ago

I agree that it's not important to be consistent with Prettier Javascript.

What do you think about the "cleaner diffs and easier code manipulations" though? Doesn't that also apply to Ruby too, even if we can't always add a trailing comma?

kddnewton commented 1 year ago

I agree that that is a concern that some folks have, which is why I provided the option in the first place. I wouldn't have added the option if the argument didn't have merit.