Bug 1347712 - Change the testing configurations into ESLint configurations within eslint-plugin-mozilla - structural changes. r?jaws draft
authorMark Banner <standard8@mozilla.com>
Tue, 21 Mar 2017 16:43:01 +0100
changeset 502278 d951b2ba9c04bffe7d6bd6c21b3ac848b55d2419
parent 502245 bd4f3810b402147f8656390555b29502ce5e2644
child 502279 be237e9810df911032aee043163ec1098ee0e2d4
child 502760 1e2cdbc6e2dce74c95513b46730351f5382f794e
push id50239
push usermbanner@mozilla.com
push dateTue, 21 Mar 2017 15:45:54 +0000
reviewersjaws
bugs1347712
milestone55.0a1
Bug 1347712 - Change the testing configurations into ESLint configurations within eslint-plugin-mozilla - structural changes. r?jaws MozReview-Commit-ID: HmNYrVyNiMr
testing/mochitest/browser.eslintrc.js
testing/mochitest/chrome.eslintrc.js
testing/mochitest/mochitest.eslintrc.js
testing/xpcshell/xpcshell.eslintrc.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
rename from testing/mochitest/browser.eslintrc.js
rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
--- a/testing/mochitest/browser.eslintrc.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
@@ -1,19 +1,21 @@
 // Parent config file for all browser-chrome files.
+"use strict";
+
 module.exports = {
   "rules": {
     "mozilla/import-headjs-globals": "warn",
-    "mozilla/mark-test-function-used": "warn",
+    "mozilla/mark-test-function-used": "warn"
   },
 
   "env": {
     "browser": true,
     "mozilla/browser-window": true,
-    "mozilla/simpletest": true,
+    "mozilla/simpletest": true
     //"node": true
   },
 
   "plugins": [
     "mozilla"
   ],
 
   // All globals made available in the test environment.
@@ -49,11 +51,11 @@ module.exports = {
     "SpecialPowers": false,
     "TestUtils": false,
     "thisTestLeaksUncaughtRejectionsAndShouldBeFixed": false,
     "todo": false,
     "todo_is": false,
     "todo_isnot": false,
     "waitForClipboard": false,
     "waitForExplicitFinish": false,
-    "waitForFocus": false,
+    "waitForFocus": false
   }
 };
rename from testing/mochitest/chrome.eslintrc.js
rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
--- a/testing/mochitest/chrome.eslintrc.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
@@ -1,19 +1,21 @@
 // Parent config file for all mochitest files.
+"use strict";
+
 module.exports = {
   rules: {
     "mozilla/import-headjs-globals": "warn",
-    "mozilla/mark-test-function-used": "warn",
+    "mozilla/mark-test-function-used": "warn"
   },
 
   "env": {
     "browser": true,
     "mozilla/browser-window": true,
-    "mozilla/simpletest": true,
+    "mozilla/simpletest": true
   },
 
   "plugins": [
     "mozilla"
   ],
 
   // All globals made available in the test environment.
   "globals": {
@@ -42,11 +44,11 @@ module.exports = {
     "registerCleanupFunction": false,
     "requestLongerTimeout": false,
     "SpecialPowers": false,
     "todo": false,
     "todo_is": false,
     "todo_isnot": false,
     "waitForClipboard": false,
     "waitForExplicitFinish": false,
-    "waitForFocus": false,
+    "waitForFocus": false
   }
 };
rename from testing/mochitest/mochitest.eslintrc.js
rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js
--- a/testing/mochitest/mochitest.eslintrc.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js
@@ -1,19 +1,21 @@
 // Parent config file for all mochitest files.
+"use strict";
+
 module.exports = {
   "rules": {
     "mozilla/import-headjs-globals": "warn",
     "mozilla/mark-test-function-used": "warn",
-    "no-shadow": "error",
+    "no-shadow": "error"
   },
 
   "env": {
     "browser": true,
-    "mozilla/simpletest": true,
+    "mozilla/simpletest": true
   },
 
   "plugins": [
     "mozilla"
   ],
 
   // All globals made available in the test environment.
   "globals": {
@@ -39,11 +41,11 @@ module.exports = {
     "registerCleanupFunction": false,
     "requestLongerTimeout": false,
     "SpecialPowers": false,
     "todo": false,
     "todo_is": false,
     "todo_isnot": false,
     "waitForClipboard": false,
     "waitForExplicitFinish": false,
-    "waitForFocus": false,
+    "waitForFocus": false
   }
 };
rename from testing/xpcshell/xpcshell.eslintrc.js
rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
--- a/testing/xpcshell/xpcshell.eslintrc.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
@@ -1,14 +1,16 @@
 // Parent config file for all xpcshell files.
+"use strict";
+
 module.exports = {
   rules: {
     "mozilla/import-headjs-globals": "warn",
     "mozilla/mark-test-function-used": "warn",
-    "no-shadow": "error",
+    "no-shadow": "error"
   },
 
   // All globals made available in the test environment.
   "globals": {
     "_TEST_FILE": false,
     "add_task": false,
     "add_test": false,
     "Assert": false,
@@ -60,12 +62,13 @@ module.exports = {
     // Defined in XPCShellImpl.
     "sendCommand": false,
     "strictEqual": false,
     "throws": false,
     "todo": false,
     "todo_check_false": false,
     "todo_check_true": false,
     // Firefox specific function.
+    // eslint-disable-next-line max-len
     // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval
-    "uneval": false,
+    "uneval": false
   }
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
@@ -7,16 +7,22 @@
  */
 
 "use strict";
 
 //------------------------------------------------------------------------------
 // Plugin Definition
 //------------------------------------------------------------------------------
 module.exports = {
+  configs: {
+    "browser-test": require("../lib/configs/browser-test"),
+    "chrome-test": require("../lib/configs/chrome-test"),
+    "mochitest-test": require("../lib/configs/mochitest-test"),
+    "xpcshell-test": require("../lib/configs/xpcshell-test")
+  },
   environments: {
     "browser-window": require("../lib/environments/browser-window.js"),
     "chrome-worker": require("../lib/environments/chrome-worker.js"),
     "frame-script": require("../lib/environments/frame-script.js"),
     "places-overlay": require("../lib/environments/places-overlay.js"),
     "simpletest": require("../lib/environments/simpletest.js")
   },
   processors: {
@@ -42,27 +48,27 @@ module.exports = {
       require("../lib/rules/reject-importGlobalProperties"),
     "reject-some-requires": require("../lib/rules/reject-some-requires"),
     "use-default-preference-values":
       require("../lib/rules/use-default-preference-values"),
     "use-ownerGlobal": require("../lib/rules/use-ownerGlobal"),
     "var-only-at-top-level": require("../lib/rules/var-only-at-top-level")
   },
   rulesConfig: {
-    "avoid-removeChild": 0,
-    "avoid-nsISupportsString-preferences": 0,
-    "balanced-listeners": 0,
-    "import-globals": 0,
-    "import-headjs-globals": 0,
-    "mark-test-function-used": 0,
-    "no-aArgs": 0,
-    "no-cpows-in-tests": 0,
-    "no-single-arg-cu-import": 0,
-    "no-import-into-var-and-global": 0,
-    "no-useless-parameters": 0,
-    "no-useless-removeEventListener": 0,
-    "reject-importGlobalProperties": 0,
-    "reject-some-requires": 0,
-    "use-default-preference-values": 0,
-    "use-ownerGlobal": 0,
-    "var-only-at-top-level": 0
+    "avoid-removeChild": "off",
+    "avoid-nsISupportsString-preferences": "off",
+    "balanced-listeners": "off",
+    "import-globals": "off",
+    "import-headjs-globals": "off",
+    "mark-test-function-used": "off",
+    "no-aArgs": "off",
+    "no-cpows-in-tests": "off",
+    "no-single-arg-cu-import": "off",
+    "no-import-into-var-and-global": "off",
+    "no-useless-parameters": "off",
+    "no-useless-removeEventListener": "off",
+    "reject-importGlobalProperties": "off",
+    "reject-some-requires": "off",
+    "use-default-preference-values": "off",
+    "use-ownerGlobal": "off",
+    "var-only-at-top-level": "off"
   }
 };