Bug 1359011 - Make the mozilla/recommended eslint configuration the default for the whole tree. r?Mossop draft
authorMark Banner <standard8@mozilla.com>
Tue, 25 Apr 2017 20:12:21 +0100
changeset 581042 ef537997fcf9f91a71ee6108da9429e851279151
parent 581041 de859ae644212accb6e706c2a8408df04f816573
child 629469 2d7f73dcbddee2f9e92028c265438181ec582cec
push id59752
push userbmo:standard8@mozilla.com
push dateFri, 19 May 2017 07:24:10 +0000
reviewersMossop
bugs1359011
milestone55.0a1
Bug 1359011 - Make the mozilla/recommended eslint configuration the default for the whole tree. r?Mossop MozReview-Commit-ID: HtUW43tCli1
.eslintrc.js
accessible/.eslintrc.js
browser/.eslintrc.js
caps/.eslintrc.js
dom/indexedDB/test/.eslintrc.js
js/src/builtin/.eslintrc.js
js/src/shell/.eslintrc.js
mobile/android/.eslintrc.js
security/.eslintrc.js
services/.eslintrc.js
storage/.eslintrc.js
taskcluster/docker/index-task/.eslintrc.js
toolkit/.eslintrc.js
tools/.eslintrc.js
tools/lint/eslint/.eslintrc.js
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,36 +1,19 @@
 "use strict";
 
 module.exports = {
-  // When adding items to this file please check for effects on sub-directories.
+  // New rules and configurations should generally be added in
+  // tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js to
+  // allow external repositories that use the plugin to pick them up as well.
+  "extends": [
+    "plugin:mozilla/recommended"
+  ],
   "plugins": [
     "mozilla"
   ],
-  "rules": {
-    "mozilla/avoid-removeChild": "error",
-    "mozilla/avoid-nsISupportsString-preferences": "error",
-    "mozilla/import-browser-window-globals": "error",
-    "mozilla/import-globals": "warn",
-    "mozilla/no-import-into-var-and-global": "error",
-    "mozilla/no-useless-parameters": "error",
-    "mozilla/no-useless-removeEventListener": "error",
-    "mozilla/use-default-preference-values": "error",
-    "mozilla/use-ownerGlobal": "error",
-    // No (!foo in bar) or (!object instanceof Class)
-    "no-unsafe-negation": "error",
-    // No eval() and no strings in the first param of setTimeout or setInterval
-    "no-implied-eval": "error",
-    "no-eval": "error",
-  },
   // The html plugin is enabled via a command line option on eslint. To avoid
   // bad interactions with the xml preprocessor in eslint-plugin-mozilla, we
   // turn off processing of the html plugin for .xml files.
   "settings": {
     "html/xml-extensions": [ ".xhtml" ]
   },
-  "env": {
-    "es6": true
-  },
-  "parserOptions": {
-    "ecmaVersion": 8,
-  },
 };
--- a/accessible/.eslintrc.js
+++ b/accessible/.eslintrc.js
@@ -1,14 +1,11 @@
 "use strict";
 
 module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
   "rules": {
     // Warn about cyclomatic complexity in functions.
     "complexity": ["error", 42],
 
     // XXX These are rules that are enabled in the recommended configuration, but
     // disabled here due to failures when initially implemented. They should be
     // removed (and hence enabled) at some stage.
     "brace-style": "off",
--- a/browser/.eslintrc.js
+++ b/browser/.eslintrc.js
@@ -1,15 +1,11 @@
 "use strict";
 
 module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
-
   "rules": {
     // XXX Bug 1326071 - This should be reduced down - probably to 20 or to
     // be removed & synced with the mozilla/recommended value.
     "complexity": ["error", {"max": 40}],
 
     // Disallow empty statements. This will report an error for:
     // try { something(); } catch (e) {}
     // but will not report it for:
deleted file mode 100644
--- a/caps/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ]
-};
--- a/dom/indexedDB/test/.eslintrc.js
+++ b/dom/indexedDB/test/.eslintrc.js
@@ -1,13 +1,12 @@
 "use strict";
 
 module.exports = {
   "extends": [
-    "plugin:mozilla/recommended",
     "plugin:mozilla/browser-test",
     "plugin:mozilla/chrome-test",
     "plugin:mozilla/mochitest-test",
   ],
   "plugins": [
     "mozilla"
   ],
   "rules": {
--- a/js/src/builtin/.eslintrc.js
+++ b/js/src/builtin/.eslintrc.js
@@ -1,15 +1,11 @@
 "use strict";
 
 module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
-
   "plugins": [
     "spidermonkey-js"
   ],
 
   "rules": {
     // We should fix those at some point, but we use this to detect NaNs.
     "no-self-compare": "off",
     // Disabling these two make it easier to implement the spec.
--- a/js/src/shell/.eslintrc.js
+++ b/js/src/shell/.eslintrc.js
@@ -1,12 +1,8 @@
 "use strict";
 
 module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
-
   "rules": {
     // SpiderMonkey's style doesn't match any of the possible options.
     "brace-style": "off",
   }
 };
--- a/mobile/android/.eslintrc.js
+++ b/mobile/android/.eslintrc.js
@@ -1,15 +1,11 @@
 "use strict";
 
 module.exports = {
-  extends: [
-    "plugin:mozilla/recommended"
-  ],
-
   globals: {
     // TODO: Create custom rule for `Cu.import`
     "AddonManager": false,
     "AppConstants": false,
     "Downloads": false,
     "File": false,
     "FileUtils": false,
     "HelperApps": true, // TODO: Can be more specific here.
--- a/security/.eslintrc.js
+++ b/security/.eslintrc.js
@@ -1,14 +1,11 @@
 "use strict";
 
 module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
   "rules": {
     // Enforce return statements in callbacks of array methods.
     "array-callback-return": "error",
 
     // Braces only needed for multi-line arrow function blocks
     "arrow-body-style": ["error", "as-needed"],
 
     // Commas at the end of the line not the start
--- a/services/.eslintrc.js
+++ b/services/.eslintrc.js
@@ -1,11 +1,7 @@
 "use strict";
 
 module.exports = {
-  extends: [
-    "plugin:mozilla/recommended"
-  ],
-
   plugins: [
     "mozilla"
   ]
 }
deleted file mode 100644
--- a/storage/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
-};
--- a/taskcluster/docker/index-task/.eslintrc.js
+++ b/taskcluster/docker/index-task/.eslintrc.js
@@ -1,15 +1,7 @@
 "use strict";
 
 module.exports = {
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
-
-  "plugins": [
-    "mozilla"
-  ],
-
   "env": {
     "node": true
   }
 };
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -1,15 +1,11 @@
 "use strict";
 
 module.exports = {
-  extends: [
-    "plugin:mozilla/recommended"
-  ],
-
   rules: {
     // XXX Bug 1326071 - This should be reduced down - probably to 20 or to
     // be removed & synced with the mozilla/recommended value.
     "complexity": ["error", 41],
 
     "mozilla/no-task": "error",
   }
 };
deleted file mode 100644
--- a/tools/.eslintrc.js
+++ /dev/null
@@ -1,11 +0,0 @@
-"use strict";
-
-module.exports = {
-  extends: [
-    "plugin:mozilla/recommended"
-  ],
-
-  plugins: [
-    "mozilla"
-  ]
-}
--- a/tools/lint/eslint/.eslintrc.js
+++ b/tools/lint/eslint/.eslintrc.js
@@ -9,24 +9,16 @@
  *   - Functions should not have whitespace before params.
  */
 
 module.exports = {
   "env": {
     "node": true
   },
 
-  "plugins": [
-    "mozilla"
-  ],
-
-  "extends": [
-    "plugin:mozilla/recommended"
-  ],
-
   "rules": {
     "camelcase": "error",
     "comma-dangle": ["error", "never"],
     "comma-style": ["error", "last"],
     "curly": ["error", "multi-line"],
     "handle-callback-err": ["error", "er"],
     "indent": ["error", 2, {"SwitchCase": 1}],
     // Longer max-len due to AST selectors