-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add ESLint comma-dangle
rule
#741
Conversation
Hoping this was a simple |
I know it's a style preference and all, but looking through the changes, I just can't help but feel that all the extra noise is not worth the insignificant benefit it brings. |
Yes :)
I think this has a decent amount of practical benefit beyond just being a style preference. Quoting from #612:
Also, part of the reason you're seeing so much churn here is simply that we have a whole lot of code :) |
Sorry, I didn't mean to suggest the benefits are purely cosmetic. I understand they exist, but I don't find them particularly compelling. And it's not so much the number of changes, rather that it feels unnatural in many circumstances. For example, I'd never have thought to put a comma here: https://github.com/WordPress/gutenberg/blob/34586fc/blocks/library/embed/index.js#L82 Perhaps it will just take time to adjust. And at least we have ESLint to enforce it if it comes to be overlooked. |
34586fc
to
6671682
Compare
I still think we should do this. Your example doesn't look too bad to me, in fact I think it's pretty natural and also serves to indicate "yes there's more stuff above at this nesting level". Granted I probably wouldn't be pushing for this change except for the fact that I've already adopted this rule in my preferred coding style personally... though I do find it quite nice to have cleaner diffs when modifying lists of things, like To update this PR later on (starting with a clean working tree): git fetch origin && git checkout origin/master -B master
git show add/eslint-comma-dangle .eslintrc.json | git apply
git checkout -B add/eslint-comma-dangle
./node_modules/.bin/eslint . --fix
git commit -am 'Add ESLint `comma-dangle` rule'
git push -f |
6671682
to
9ef0f1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If we're going to do this, may as well do it now, the change no doubt will affect existing PRs and they will need to be updated. I'm happy to update the changes back to the handbook and add this rule to Unfortunately I missed the #Core JS chat last night, but I've caught up and read through the chat, if we're going to start updating the JS coding standards, then updating one of those said standards this week in preparation for next weeks chat would be 👌 . I say this as it will give us (rather me) an opportunity to show the workflow and processes of what's required to make a change to the standards. |
9ef0f1b
to
9bd792b
Compare
Enforce trailing comma syntax for JavaScript arrays and objects:
Closes #612 - more discussion over there.