Closed Bug 1486741 Opened 6 years ago Closed 6 years ago

Enable ESLint rule comma-dangle for all of mozilla-central

Categories

(Core :: General, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox63 --- wontfix
firefox64 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(3 files, 1 obsolete file)

As discussed on firefox-dev and dev.platform, we should require dangling commas for multi-line object/arrays in Javascript code for mozilla-central.

Why:

- Multiple components in toolkit/ and browser/ already have comma-dangle enabled.
- Having asked around in a few locations, I'm seeing support from the Firefox developer team and others in favour of enabling it.
- It helps make blame cleaner.
- It makes editing easier, and helps for a consistent style.
- Having automation available to cover the requirement reduces the need for review nits.

This bug is for the second half of the files, those not already enabled by bug 1486739.

I am hoping to land this bug on Friday 19 October (GMT timezone), ahead of the 64 merges.
This auto-rewriting won't touch anything in js/src/tests or js/src/jit-test, will it?  Absence of a trailing comma can't be presumed to be meaningless there, and much of the former is imported anyway.
(In reply to Jeff Walden [:Waldo] from comment #1)
> This auto-rewriting won't touch anything in js/src/tests or js/src/jit-test,
> will it?  Absence of a trailing comma can't be presumed to be meaningless
> there, and much of the former is imported anyway.

They are ignored by default for ESLint, so they won't be touched: https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/.eslintignore#284,292,294
I hope this change will also be applied to /testing?  Specifically
for testing/marionette we want to adopt as much of the repository-wide
lint rules as possible.
(In reply to Andreas Tolfsen ﹝:ato﹞ from comment #3)
> I hope this change will also be applied to /testing?  Specifically
> for testing/marionette we want to adopt as much of the repository-wide
> lint rules as possible.

It will be applied for everywhere that ESLint is enabled (i.e. anywhere not ignored by .eslintignore). Note: comma-dangle is already enabled for testing/marionette, so all that will happen there is the sub-directory specific configuration will be removed in preference to the main one (tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js).
Depends on: 1493967
Priority: -- → P1
Attachment #9016296 - Attachment is obsolete: true
Note: Aiming for landing next Friday (19th Oct)
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/edc4ae8f78e2
Enable ESLint rule comma-dangle for all of mozilla-central (automatic fixes). r=mossop
https://hg.mozilla.org/integration/autoland/rev/988056e6d054
Enable ESLint rule comma-dangle for all of mozilla-central (manual fixes). r=mossop
https://hg.mozilla.org/integration/autoland/rev/1ac84aa579d6
Enable ESLint rule comma-dangle for all of mozilla-central (setup ESLint). r=mossop
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: