Bug 1229142: Add shared eslintrc files for the different test suites. r=Standard8
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 17 Dec 2015 15:28:06 -0800
changeset 313447 f13750b0247d0decc640ea858b4df98539c40969
parent 313446 7417b352c32d838585075c59bb2435902ef1675f
child 313448 f52dbc5e835f24bf14ae13ccb082f6c2c51573ec
push id5703
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:18:41 +0000
treeherdermozilla-beta@31e373ad5b5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1229142
milestone46.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 1229142: Add shared eslintrc files for the different test suites. r=Standard8
.eslintrc
devtools/.eslintrc
devtools/.eslintrc.mochitests
devtools/.eslintrc.xpcshell
testing/mochitest/browser.eslintrc
testing/mochitest/chrome.eslintrc
testing/mochitest/mochitest.eslintrc
testing/xpcshell/xpcshell.eslintrc
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,9 +1,13 @@
 {
   // When adding items to this file please check for effects on sub-directories.
   "plugins": [
     "mozilla"
   ],
+  "rules": {
+    "mozilla/components-imports": 1,
+    "mozilla/import-globals-from": 1,
+  },
   "env": {
     "es6": true
   },
 }
--- a/devtools/.eslintrc
+++ b/devtools/.eslintrc
@@ -19,19 +19,16 @@
     "XPCOMUtils": true,
   },
   "rules": {
     // These are the rules that have been configured so far to match the
     // devtools coding style.
 
     // Rules from the mozilla plugin
     "mozilla/balanced-listeners": 2,
-    "mozilla/components-imports": 1,
-    "mozilla/import-globals-from": 1,
-    "mozilla/import-headjs-globals": 1,
     "mozilla/mark-test-function-used": 1,
     "mozilla/no-aArgs": 1,
     "mozilla/no-cpows-in-tests": 1,
     "mozilla/var-only-at-top-level": 1,
 
     // Disallow using variables outside the blocks they are defined (especially
     // since only let and const are used, see "no-var").
     "block-scoped-var": 2,
--- a/devtools/.eslintrc.mochitests
+++ b/devtools/.eslintrc.mochitests
@@ -1,44 +1,10 @@
 // Parent config file for all devtools browser mochitest files.
 {
-  "rules": {
-    // Only disallow non-global unused vars, so that head.js does not produce
-    // errors.
-    "no-unused-vars": [2, {"vars": "local"}]
-  },
+  "extends": [
+    "../testing/mochitest/browser.eslintrc"
+  ],
   // All globals made available in the test environment.
   "globals": {
-    "add_task": true,
-    "Assert": true,
-    "BrowserTestUtils": true,
-    "content": true,
-    "ContentTask": true,
-    "document": true,
-    "EventUtils": true,
-    "executeSoon": true,
-    "export_assertions": true,
-    "finish": true,
-    "gBrowser": true,
     "gDevTools": true,
-    "getRootDirectory": true,
-    "getTestFilePath": true,
-    "gTestPath": true,
-    "info": true,
-    "is": true,
-    "isnot": true,
-    "navigator": true,
-    "ok": true,
-    "promise": true,
-    "registerCleanupFunction": true,
-    "requestLongerTimeout": true,
-    "setTimeout": true,
-    "SimpleTest": true,
-    "SpecialPowers": true,
-    "todo": true,
-    "todo_is": true,
-    "todo_isnot": true,
-    "waitForClipboard": true,
-    "waitForExplicitFinish": true,
-    "waitForFocus": true,
-    "window": true,
   }
 }
--- a/devtools/.eslintrc.xpcshell
+++ b/devtools/.eslintrc.xpcshell
@@ -1,51 +1,17 @@
 // Parent config file for all devtools browser mochitest files.
 {
+  "extends": [
+    "../testing/xpcshell/xpcshell.eslintrc"
+  ],
   "rules": {
     // Allow non-camelcase so that run_test doesn't produce a warning.
     "camelcase": 0,
-    // Only disallow non-global unused vars, so that things like the test
-    // function do not produce errors.
-    "no-unused-vars": [2, {"vars": "local"}],
     // Allow using undefined variables so that tests can refer to functions
     // and variables defined in head.js files, without having to maintain a
     // list of globals in each .eslintrc file.
     // Note that bug 1168340 will eventually help auto-registering globals
     // from head.js files.
     "no-undef": 0,
     "block-scoped-var": 0
-  },
-  // All globals made available in the test environment.
-  "globals": {
-    "add_task": true,
-    "add_test": true,
-    "Assert": true,
-    "deepEqual": true,
-    "do_check_eq": true,
-    "do_check_false": true,
-    "do_check_neq": true,
-    "do_check_null": true,
-    "do_check_true": true,
-    "do_execute_soon": true,
-    "do_get_cwd": true,
-    "do_get_file": true,
-    "do_get_idle": true,
-    "do_get_profile": true,
-    "do_load_module": true,
-    "do_parse_document": true,
-    "do_print": true,
-    "do_register_cleanup": true,
-    "do_test_finished": true,
-    "do_test_pending": true,
-    "do_throw": true,
-    "do_timeout": true,
-    "equal": true,
-    "load": true,
-    "notDeepEqual": true,
-    "notEqual": true,
-    "notStrictEqual": true,
-    "ok": true,
-    "run_next_test": true,
-    "run_test": true,
-    "strictEqual": true,
   }
-}
\ No newline at end of file
+}
new file mode 100644
--- /dev/null
+++ b/testing/mochitest/browser.eslintrc
@@ -0,0 +1,48 @@
+// Parent config file for all browser-chrome files.
+{
+  "rules": {
+    // Head files want to define globals so don't warn for unused globals
+    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
+    "mozilla/import-headjs-globals": 1,
+    "mozilla/import-browserjs-globals": 1,
+  },
+
+  "env": {
+    "browser": true,
+  },
+
+  // All globals made available in the test environment.
+  "globals": {
+    "add_task": false,
+    "Assert": false,
+    "BrowserTestUtils": false,
+    "ContentTask": false,
+    "EventUtils": false,
+    "executeSoon": false,
+    "export_assertions": false,
+    "finish": false,
+    "getRootDirectory": false,
+    "getTestFilePath": false,
+    "gTestPath": false,
+    "info": false,
+    "is": false,
+    "isnot": false,
+    "ok": false,
+    "promise": false,
+    "registerCleanupFunction": false,
+    "requestLongerTimeout": false,
+    "SimpleTest": false,
+    "SpecialPowers": false,
+    "todo": false,
+    "todo_is": false,
+    "todo_isnot": false,
+    "waitForClipboard": false,
+    "waitForExplicitFinish": false,
+    "waitForFocus": false,
+    "gBrowser": false,
+    "gNavToolbox": false,
+    "gURLBar": false,
+    "gNavigatorBundle": false,
+    "content": false,
+  }
+}
new file mode 100644
--- /dev/null
+++ b/testing/mochitest/chrome.eslintrc
@@ -0,0 +1,40 @@
+// Parent config file for all mochitest files.
+{
+  rules: {
+    // Head files want to define globals so don't warn for unused globals
+    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
+    "mozilla/import-headjs-globals": 1,
+  },
+
+  "env": {
+    "browser": true,
+  },
+
+  // All globals made available in the test environment.
+  "globals": {
+    "add_task": false,
+    "Assert": false,
+    "EventUtils": false,
+    "executeSoon": false,
+    "export_assertions": false,
+    "finish": false,
+    "getRootDirectory": false,
+    "getTestFilePath": false,
+    "gTestPath": false,
+    "info": false,
+    "is": false,
+    "isnot": false,
+    "ok": false,
+    "promise": false,
+    "registerCleanupFunction": false,
+    "requestLongerTimeout": false,
+    "SimpleTest": false,
+    "SpecialPowers": false,
+    "todo": false,
+    "todo_is": false,
+    "todo_isnot": false,
+    "waitForClipboard": false,
+    "waitForExplicitFinish": false,
+    "waitForFocus": false,
+  }
+}
new file mode 100644
--- /dev/null
+++ b/testing/mochitest/mochitest.eslintrc
@@ -0,0 +1,40 @@
+// Parent config file for all mochitest files.
+{
+  rules: {
+    // Head files want to define globals so don't warn for unused globals
+    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
+    "mozilla/import-headjs-globals": 1,
+  },
+
+  "env": {
+    "browser": true,
+  },
+
+  // All globals made available in the test environment.
+  "globals": {
+    "add_task": false,
+    "Assert": false,
+    "EventUtils": false,
+    "executeSoon": false,
+    "export_assertions": false,
+    "finish": false,
+    "getRootDirectory": false,
+    "getTestFilePath": false,
+    "gTestPath": false,
+    "info": false,
+    "is": false,
+    "isnot": false,
+    "ok": false,
+    "promise": false,
+    "registerCleanupFunction": false,
+    "requestLongerTimeout": false,
+    "SimpleTest": false,
+    "SpecialPowers": false,
+    "todo": false,
+    "todo_is": false,
+    "todo_isnot": false,
+    "waitForClipboard": false,
+    "waitForExplicitFinish": false,
+    "waitForFocus": false,
+  }
+}
new file mode 100644
--- /dev/null
+++ b/testing/xpcshell/xpcshell.eslintrc
@@ -0,0 +1,43 @@
+// Parent config file for all xpcshell files.
+{
+  rules: {
+    // Head files want to define globals so don't warn for unused globals
+    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
+    "mozilla/import-headjs-globals": 1,
+  },
+
+  // All globals made available in the test environment.
+  "globals": {
+    "add_task": false,
+    "add_test": false,
+    "Assert": false,
+    "deepEqual": false,
+    "do_check_eq": false,
+    "do_check_false": false,
+    "do_check_neq": false,
+    "do_check_null": false,
+    "do_check_true": false,
+    "do_execute_soon": false,
+    "do_get_cwd": false,
+    "do_get_file": false,
+    "do_get_idle": false,
+    "do_get_profile": false,
+    "do_load_module": false,
+    "do_parse_document": false,
+    "do_print": false,
+    "do_register_cleanup": false,
+    "do_test_finished": false,
+    "do_test_pending": false,
+    "do_throw": false,
+    "do_timeout": false,
+    "equal": false,
+    "load": false,
+    "notDeepEqual": false,
+    "notEqual": false,
+    "notStrictEqual": false,
+    "ok": false,
+    "run_next_test": false,
+    "run_test": false,
+    "strictEqual": false,
+  }
+}