Would you consider turning off the warning for "Unexpected trailing comma" ??
I save time and mental load when reordering lists by not having to track that last comma. I'm not aware of any issues that could be caused by allowing this extra comma.
module.exports = {
languages: [
'chinese_simplified',
'chinese_traditional',
'japanese',
'english',
'italian',
'french',
'spanish', // <= This is good
], // <= This is good
}
Hi @jcalfee! Thanks for the thoughtful feedback!
This rule change has been discussed previously, and here was the decision we came to at that time:
If there's two ways to do something and there's no difference in correctness or chance of introducing a bug, then standard tends to 'just pick something'. So, relaxing the rule to allow either style isn't really a viable option.
Given that it's gotta be either 'disallow' or 'enforce', I think disallow is the least controversial option. Enforcing trailing commas would confuse a lot of beginners to programming or JS, IMO.
With the above in mind I'm going to close this issue now, but please feel free to continue the conversation!
I agree that with only disallow and enforce, it should be disallow. But I'd rather have it be optional. I鈥檓 not opinionated enough to say we should have them, but I am opinionated enough to say we should not force people to have/not have them. I understand though that Standard is meant to say 'disallow' or 'enforce'.
Also reordering a list is a common activity and not having a trailing comma would increase chances of introducing a bug, as I well know from occasionally forgetting to delete / insert a comma at the right place. It also increases the commit diff noise.
A good list of these points is also made here: https://github.com/standard/standard/issues/907
I personally would love to have trailing comma enforced, but I don't think that making this optional is the way to go.
[...] but I am opinionated enough to say we should not force people to have/not have them.
The whole point of standard is to be opinionated and to pick one way. Otherwise, that same argument could be made about semicolons, space vs. tabs, and basically every other rule. I think it's important that standard enforces one of them.
Most helpful comment
I personally would love to have trailing comma enforced, but I don't think that making this optional is the way to go.
The whole point of standard is to be opinionated and to pick one way. Otherwise, that same argument could be made about semicolons, space vs. tabs, and basically every other rule. I think it's important that standard enforces one of them.