-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object-curly-spacing possible bug with destructuring and trailing commas #2647
Comments
I just verified it, and it does error out. However, I think the error is correct, the message is wrong though. I think it's erroring on a let statement, because with |
Isn't this rule specifically about the curlies? Why would it care about commas at all? |
I assume that's a typo, but will double check. |
Here's what I get with
Using this command Super weird! |
Here's what up:
It wouldn't be hard to add explicit support for trailing commas, though I'm not actually sure how that would work here. I suppose we should just pretend the |
Hmmm.. I don't think adding explicit support for trailing commas would work. What about something like this: { name: something ? something : other } or { name: name || "empty" } It feels like we should find closing brace and check if the previous character is space. |
I put together a quick PR which does it the way I described, feel free to comment in there with any feedback which I'll gladly apply |
Nevermind, I just checked the examples I wrote, and they all work fine. |
Fix: trailing commas in object-curly-spacing (fixes #2647)
I have the following code:
With the new object-curly-spacing rule set to
always
in ESLint 0.22.1, I see the following output:I wasn't able to find any mention of this in the documentation for the rule, so I'm not sure if it was intentional or not, but it seems a bit strange to me so I thought it might be a bug.
Thanks for all of your great work on this tool!
The text was updated successfully, but these errors were encountered: