jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

disallowTrailingComma doesn't understand array destructuring #2159

Closed artoale closed 8 years ago

artoale commented 8 years ago

This line:

let [firstElement,] = someFunction()

triggers the rule disallowTrailingComma. It is though a perfectly legit es6 syntax using destructuring assignment.

I believe this should be checked by its own rule

markelog commented 8 years ago

All trailing comma code is legit js, this is a comma and it is trailing

artoale commented 8 years ago

@markelog yeah - what you're saying is correct, but it makes sense to have separate rules for disallowing trailing commas in array literals and in destructuring assignment since reasons for allowing one or the other can be fairly different.

markelog commented 8 years ago

We don't accept new features at this time :/, see https://medium.com/@markelog/jscs-end-of-the-line-bc9bf0b3fdb2 and http://eslint.org/blog/2016/04/welcoming-jscs-to-eslint for more