Bug 1486739 - Enable ESLint rule comma-dangle for browser/, services/, taskcluster/ and toolkit/ directories. r=mossop
authorMark Banner <standard8@mozilla.com>
Fri, 31 Aug 2018 06:06:08 +0000
changeset 434197 1bc6d1a2d201
parent 434196 d7fcfbc15cfe
child 434198 7a65516025af
push id68587
push usermbanner@mozilla.com
push dateFri, 31 Aug 2018 06:10:03 +0000
treeherderautoland@1bc6d1a2d201 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1486739
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1486739 - Enable ESLint rule comma-dangle for browser/, services/, taskcluster/ and toolkit/ directories. r=mossop Enable globally by default by blacklist directories outside of the ones we're enabling. Remove now unnecessary existing configurations. Differential Revision: https://phabricator.services.mozilla.com/D4440
.eslintrc.js
browser/components/extensions/test/browser/browser_ext_browserAction_pageAction_icon.js
browser/components/migration/.eslintrc.js
browser/components/payments/.eslintrc.js
browser/components/places/.eslintrc.js
browser/extensions/formautofill/.eslintrc.js
devtools/.eslintrc.js
toolkit/components/extensions/.eslintrc.js
toolkit/components/narrate/.eslintrc.js
toolkit/components/places/.eslintrc.js
toolkit/components/satchel/.eslintrc.js
tools/lint/eslint/.eslintrc.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
tools/lint/eslint/eslint-plugin-mozilla/package.json
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -34,10 +34,32 @@ module.exports = {
       "browser/base/content/urlbarBindings.xml",
       "browser/components/search/content/search.xml",
       "browser/components/translation/translation-infobar.xml",
       "toolkit/components/prompts/content/tabprompts.xml"
     ],
     "env": {
       "mozilla/browser-window": true
     }
+  }, {
+    // XXX Bug 1486741 - We've not rolled out comma-dangle to these directories
+    // yet, so turn it off for now.
+    "files": [
+      "accessible/**",
+      "caps/**",
+      "chrome/**",
+      "devtools/**",
+      "dom/**",
+      "extensions/**",
+      "intl/**",
+      "js/**",
+      "mobile/**",
+      "security/**",
+      "storage/**",
+      "testing/**",
+      "tools/**",
+      "xpcom/**",
+    ],
+    "rules": {
+      "comma-dangle": "off",
+    }
   }]
 };
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_pageAction_icon.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_pageAction_icon.js
@@ -23,17 +23,17 @@ add_task(async function testDetailsObjec
       };
     }
 
     let imageData = {
       red: getImageData("red"),
       green: getImageData("green"),
     };
 
-    /* eslint-disable comma-dangle, indent, indent-legacy */
+    /* eslint-disable indent, indent-legacy */
     let iconDetails = [
       // Only paths.
       {details: {"path": "a.png"},
         resolutions: {
           "1": browser.runtime.getURL("data/a.png"),
           "2": browser.runtime.getURL("data/a.png")}},
       {details: {"path": "/a.png"},
         resolutions: {
@@ -161,16 +161,17 @@ add_task(async function testDetailsObjec
         "18": "18.png",
         "32": "32.png",
         "48": "48.png",
         "128": "128.png"}},
         resolutions: {
           "1": browser.runtime.getURL("data/32.png"),
           "2": browser.runtime.getURL("data/32.png")}},
     ];
+    /* eslint-enable indent, indent-legacy */
 
     // Allow serializing ImageData objects for logging.
     ImageData.prototype.toJSON = () => "<ImageData>";
 
     let tabId;
 
     browser.test.onMessage.addListener((msg, test) => {
       if (msg != "setIcon") {
--- a/browser/components/migration/.eslintrc.js
+++ b/browser/components/migration/.eslintrc.js
@@ -1,14 +1,13 @@
 "use strict";
 
 module.exports = {
   "rules": {
     "block-scoped-var": "error",
-    "comma-dangle": ["error", "always-multiline"],
     "complexity": ["error", {"max": 22}],
     "indent-legacy": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
     "max-nested-callbacks": ["error", 3],
     "new-parens": "error",
     "no-extend-native": "error",
     "no-fallthrough": ["error", { "commentPattern": ".*[Ii]ntentional(?:ly)?\\s+fall(?:ing)?[\\s-]*through.*" }],
     "no-multi-str": "error",
     "no-return-assign": "error",
--- a/browser/components/payments/.eslintrc.js
+++ b/browser/components/payments/.eslintrc.js
@@ -16,17 +16,16 @@ module.exports = {
       },
     },
   ],
   rules: {
     "mozilla/var-only-at-top-level": "error",
 
     "array-bracket-spacing": ["error", "never"],
     "block-scoped-var": "error",
-    "comma-dangle": ["error", "always-multiline"],
     complexity: ["error", {
       max: 20,
     }],
     curly: ["error", "all"],
     "dot-location": ["error", "property"],
     "indent-legacy": ["error", 2, {
       SwitchCase: 1,
       CallExpression: {
deleted file mode 100644
--- a/browser/components/places/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "rules": {
-    "comma-dangle": ["error", "always-multiline"],
-  }
-};
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -50,20 +50,16 @@ module.exports = {
 
     // No using variables before defined
     "no-use-before-define": "error",
 
     // Disallow using variables outside the blocks they are defined (especially
     // since only let and const are used, see "no-var").
     "block-scoped-var": "error",
 
-    // Allow trailing commas for easy list extension.  Having them does not
-    // impair readability, but also not required either.
-    "comma-dangle": ["error", "always-multiline"],
-
     // Warn about cyclomatic complexity in functions.
     "complexity": ["error", {"max": 26}],
 
     // Enforce dots on the next line with property name.
     "dot-location": ["error", "property"],
 
     // Maximum length of a line.
     // This should be 100 but too many lines were longer than that so set a
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -233,19 +233,16 @@ module.exports = {
     // Disallow using variables outside the blocks they are defined (especially
     // since only let and const are used, see "no-var").
     "block-scoped-var": "error",
     // Enforce one true brace style (opening brace on the same line) and avoid
     // start and end braces on the same line.
     "brace-style": ["error", "1tbs", {"allowSingleLine": false}],
     // Require camel case names
     "camelcase": "error",
-    // Allow trailing commas for easy list extension.  Having them does not
-    // impair readability, but also not required either.
-    "comma-dangle": "off",
     // Warn about cyclomatic complexity in functions.
     "complexity": ["error", 53],
     // Don't warn for inconsistent naming when capturing this (not so important
     // with auto-binding fat arrow functions).
     "consistent-this": "off",
     // Enforce curly brace conventions for all control statements.
     "curly": "error",
     // Don't require a default case in switch statements. Avoid being forced to
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/extensions/.eslintrc.js
@@ -104,20 +104,16 @@ module.exports = {
 
     // ++ and -- should not need spacing
     "space-unary-ops": ["error", {"nonwords": false, "words": true, "overrides": {"typeof": false}}],
 
     // Disallow using variables outside the blocks they are defined (especially
     // since only let and const are used, see "no-var").
     "block-scoped-var": "error",
 
-    // Allow trailing commas for easy list extension.  Having them does not
-    // impair readability, but also not required either.
-    "comma-dangle": ["error", "always-multiline"],
-
     // Warn about cyclomatic complexity in functions.
     "complexity": "error",
 
     // Don't warn for inconsistent naming when capturing this (not so important
     // with auto-binding fat arrow functions).
     // "consistent-this": ["error", "self"],
 
     // Don't require a default case in switch statements. Avoid being forced to
--- a/toolkit/components/narrate/.eslintrc.js
+++ b/toolkit/components/narrate/.eslintrc.js
@@ -2,17 +2,16 @@
 
 module.exports = {
   "rules": {
     "mozilla/no-aArgs": "error",
     "mozilla/reject-importGlobalProperties": "error",
     "mozilla/var-only-at-top-level": "error",
     "block-scoped-var": "error",
     "camelcase": "error",
-    "comma-dangle": "off",
     "complexity": ["error", {"max": 20}],
     "curly": "error",
     "dot-location": ["error", "property"],
     "indent-legacy": ["error", 2, {"SwitchCase": 1}],
     "max-len": ["error", 80, 2, {"ignoreUrls": true}],
     "max-nested-callbacks": ["error", 3],
     "new-cap": ["error", {"capIsNew": false}],
     "new-parens": "error",
deleted file mode 100644
--- a/toolkit/components/places/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "rules": {
-    "comma-dangle": ["error", "always-multiline"],
-  }
-};
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -2,17 +2,16 @@
 
 module.exports = {
   rules: {
     "mozilla/balanced-listeners": "error",
     "mozilla/var-only-at-top-level": "error",
 
     "array-bracket-spacing": ["error", "never"],
     "block-scoped-var": "error",
-    "comma-dangle": ["error", "always-multiline"],
     complexity: ["error", {
       max: 23,
     }],
     curly: ["error", "all"],
     "dot-location": ["error", "property"],
     "indent-legacy": ["error", 2, {
       SwitchCase: 1,
       CallExpression: {
--- a/tools/lint/eslint/.eslintrc.js
+++ b/tools/lint/eslint/.eslintrc.js
@@ -11,17 +11,16 @@
 
 module.exports = {
   "env": {
     "node": true
   },
 
   "rules": {
     "camelcase": "error",
-    "comma-dangle": ["error", "never"],
     "curly": ["error", "multi-line"],
     "handle-callback-err": ["error", "er"],
     "indent-legacy": ["error", 2, {"SwitchCase": 1}],
     // Longer max-len due to AST selectors
     "max-len": ["error", 150, 2],
     "no-multiple-empty-lines": ["error", {"max": 1}],
     "no-shadow": "error",
     "no-undef-init": "error",
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -111,16 +111,19 @@ module.exports = {
     // "arrow-body-style": ["error", "as-needed"]
 
     // Always require spacing around a single line block
     "block-spacing": "error",
 
     // No newline before open brace for a block
     "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
 
+    // Require trailing commas for easy list extension and consistent style.
+    "comma-dangle": ["error", "always-multiline"],
+
     // No space before always a space after a comma
     "comma-spacing": ["error", {"after": true, "before": false}],
 
     // Commas at the end of the line not the start
     "comma-style": "error",
 
     // Warn about cyclomatic complexity in functions.
     // XXX Get this down to 20?
--- a/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "0.15.1",
+  "version": "0.15.3",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
     "acorn": {
       "version": "5.7.1",
       "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz",
       "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==",
       "dev": true
--- a/tools/lint/eslint/eslint-plugin-mozilla/package.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "0.15.1",
+  "version": "0.15.3",
   "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
   "keywords": [
     "eslint",
     "eslintplugin",
     "eslint-plugin",
     "mozilla",
     "firefox"
   ],