-
Notifications
You must be signed in to change notification settings - Fork 889
trailing-comma: add option to forbid trailing comma after rest #3176
Conversation
Shouldn't be the problem, but tests can be added for combination of arguments destructuring and regular params later and vice versa function combined([a, ...arr], {b, ...obj}, regular) {}
~ [Missing trailing comma]
function combined([a, ...arr,], {b, ...obj,}, regular,) {}
~ [Forbidden trailing comma]
~ [Forbidden trailing comma] UPD. Is it worth to consider adding |
@IllusionMH I just added tests as suggested
We should definitely enable it for .js files. And to keep it consistent we should also enable it for .ts files. I'm thinking about renaming the option to something like |
What does |
It would enable you to consistently use traling commas everywhere in your TypeScript code. Not a great idea on second thought, since it's inconsistent with how JavaScript works. Renamed to |
master is broken (semantic merge conflict?) but this PR looks gtg |
That's not a merge conflict. The typescript@next changed the error message (and detection algorithm) for unused variables. |
Woohoo! |
PR checklist
Overview of change:
Add an option
"specCompliant"
to the rule. Enabling that option forbids trailing commas after object and array rest as well as rest parameters. That makes the linted code compatible with the ES spec and the implementation in JS VMs.Fixes: #3147
Is there anything you'd like reviewers to focus on?
Do you know a better option name than
specCompliant
?CHANGELOG.md entry:
[new-rule-option]
trailing-comma
adds option"esSpecCompliant"
to make it compatible with the ES spec regarding trailing commas after object/array rest and rest parameters.