Bug 1440379 - Tidy up ESlint no-unused-vars definitions wrt Ci/Cu/Cr/Cc usage for varsIgnorePattern. r=florian
authorMark Banner <standard8@mozilla.com>
Thu, 22 Feb 2018 16:55:36 +0000
changeset 457750 0dfc8b69311128b0b4cf356a6b7151daf77fa986
parent 457749 3fa2cac0f4b8ec197c1a271b9fd2c1faed738665
child 457751 e3cce6ae4b1569a180aba116908d432483fa7b04
push id8799
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 16:46:23 +0000
treeherdermozilla-beta@15334014dc67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1440379
milestone60.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 1440379 - Tidy up ESlint no-unused-vars definitions wrt Ci/Cu/Cr/Cc usage for varsIgnorePattern. r=florian MozReview-Commit-ID: HmliR8iNRDq
.eslintrc.js
browser/base/content/test/static/browser_misused_characters_in_strings.js
browser/components/migration/.eslintrc.js
browser/experiments/.eslintrc.js
browser/extensions/formautofill/.eslintrc.js
browser/tools/mozscreenshots/.eslintrc.js
devtools/.eslintrc.js
dom/indexedDB/test/unit/xpcshell-head-child-process.js
mobile/android/modules/FxAccountsWebChannel.jsm
services/sync/tps/extensions/tps/resource/tps.jsm
toolkit/components/extensions/.eslintrc.js
toolkit/components/extensions/test/mochitest/chrome_head.js
toolkit/components/narrate/.eslintrc.js
toolkit/components/payments/.eslintrc.js
toolkit/components/satchel/.eslintrc.js
toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
toolkit/mozapps/extensions/.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
tools/lint/eslint/modules.json
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -57,17 +57,17 @@ module.exports = {
       "browser/extensions/**/*.jsm",
       "toolkit/**/*.jsm",
     ],
     "rules": {
       "mozilla/mark-exported-symbols-as-used": "error",
       "no-unused-vars": ["error", {
         "args": "none",
         "vars": "local",
-        "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS"
+        "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
       }]
     }
   }, {
     // XXX Bug 1433175. These directories are still being fixed, so turn off
     // mozilla/use-cc-etc for now.
     "files": [
       "accessible/**",
       "browser/**",
--- a/browser/base/content/test/static/browser_misused_characters_in_strings.js
+++ b/browser/base/content/test/static/browser_misused_characters_in_strings.js
@@ -198,17 +198,17 @@ async function getAllTheFiles(extension)
   if (appDirGreD.contains(appDirXCurProcD)) {
     return generateURIsFromDirTree(appDirGreD, [extension]);
   }
   if (appDirXCurProcD.contains(appDirGreD)) {
     return generateURIsFromDirTree(appDirXCurProcD, [extension]);
   }
   let urisGreD = await generateURIsFromDirTree(appDirGreD, [extension]);
   let urisXCurProcD = await generateURIsFromDirTree(appDirXCurProcD, [extension]);
-  return Array.from(new Set(urisGreD.concat(appDirXCurProcD)));
+  return Array.from(new Set(urisGreD.concat(urisXCurProcD)));
 }
 
 add_task(async function checkAllTheProperties() {
   // This asynchronously produces a list of URLs (sadly, mostly sync on our
   // test infrastructure because it runs against jarfiles there, and
   // our zipreader APIs are all sync)
   let uris = await getAllTheFiles(".properties");
   ok(uris.length, `Found ${uris.length} .properties files to scan for misused characters`);
--- a/browser/components/migration/.eslintrc.js
+++ b/browser/components/migration/.eslintrc.js
@@ -10,16 +10,16 @@ module.exports = {
     "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",
     "no-sequences": "error",
     "no-shadow": "error",
     "no-throw-literal": "error",
-    "no-unused-vars": ["error", { "varsIgnorePattern": "^EXPORTED_SYMBOLS$" }],
+    "no-unused-vars": ["error", { "args": "after-used", "varsIgnorePattern": "^EXPORTED_SYMBOLS$", "vars": "all" }],
     "padded-blocks": ["error", "never"],
     "semi-spacing": ["error", {"before": false, "after": true}],
     "space-in-parens": ["error", "never"],
     "strict": ["error", "global"],
     "yoda": "error"
   }
 };
--- a/browser/experiments/.eslintrc.js
+++ b/browser/experiments/.eslintrc.js
@@ -1,11 +1,11 @@
 "use strict";
 
 module.exports = {
   "rules": {
     "no-unused-vars": ["error", {
+      "args": "none",
       "vars": "all",
-      "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
-      "args": "none"
+      "varsIgnorePattern": "^EXPORTED_SYMBOLS$",
     }]
   }
 };
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -39,17 +39,19 @@ module.exports = {
 
     // Always require parenthesis for new calls
     "new-parens": "error",
 
     // No expressions where a statement is expected
     "no-unused-expressions": "error",
 
     // No declaring variables that are never used
-    "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
+    "no-unused-vars": ["error", {
+      "args": "none", "vars": "all", "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
+    }],
 
     // 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",
 
--- a/browser/tools/mozscreenshots/.eslintrc.js
+++ b/browser/tools/mozscreenshots/.eslintrc.js
@@ -2,14 +2,14 @@
 
 module.exports = {
   "extends": [
     "plugin:mozilla/browser-test"
   ],
 
   "rules": {
     "no-unused-vars": ["error", {
+      "args": "none",
       "vars": "all",
-      "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
-      "args": "none"
+      "varsIgnorePattern": "^EXPORTED_SYMBOLS$",
     }]
   }
 };
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -210,17 +210,17 @@ module.exports = {
     // throw new Error("error")).
     "no-throw-literal": "error",
     // Allow dangling underscores in identifiers (for privates).
     "no-underscore-dangle": "off",
     // Allow use of undefined variable.
     "no-undefined": "off",
     // Disallow global and local variables that aren't used, but allow unused
     // function arguments.
-    "no-unused-vars": ["error", {"vars": "all", "args": "none"}],
+    "no-unused-vars": ["error", {"args": "none", "vars": "all"}],
     // Allow using variables before they are defined.
     "no-use-before-define": "off",
     // We use var-only-at-top-level instead of no-var as we allow top level
     // vars.
     "no-var": "off",
     // Allow using TODO/FIXME comments.
     "no-warning-comments": "off",
     // Don't require method and property shorthand syntax for object literals.
--- a/dom/indexedDB/test/unit/xpcshell-head-child-process.js
+++ b/dom/indexedDB/test/unit/xpcshell-head-child-process.js
@@ -1,16 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 function run_test() {
-  const { "classes": Cc, "interfaces": Ci, "utils": Cu } = Components;
-
   ChromeUtils.import("resource://gre/modules/Services.jsm");
 
   const INDEXEDDB_HEAD_FILE = "xpcshell-head-parent-process.js";
   const INDEXEDDB_PREF_EXPERIMENTAL = "dom.indexedDB.experimental";
 
   // IndexedDB needs a profile.
   do_get_profile();
 
--- a/mobile/android/modules/FxAccountsWebChannel.jsm
+++ b/mobile/android/modules/FxAccountsWebChannel.jsm
@@ -7,39 +7,37 @@
 /**
  * Firefox Accounts Web Channel.
  *
  * Use the WebChannel component to receive messages about account
  * state changes.
  */
 var EXPORTED_SYMBOLS = ["EnsureFxAccountsWebChannel"];
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; /* global Components */
-
-ChromeUtils.import("resource://gre/modules/Accounts.jsm"); /* global Accounts */
-ChromeUtils.import("resource://gre/modules/Services.jsm"); /* global Services */
-ChromeUtils.import("resource://gre/modules/WebChannel.jsm"); /* global WebChannel */
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
+ChromeUtils.import("resource://gre/modules/Accounts.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/WebChannel.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const log = ChromeUtils.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("FxAccounts");
 
 const WEBCHANNEL_ID = "account_updates";
 
 const COMMAND_LOADED               = "fxaccounts:loaded";
 const COMMAND_CAN_LINK_ACCOUNT     = "fxaccounts:can_link_account";
 const COMMAND_LOGIN                = "fxaccounts:login";
 const COMMAND_CHANGE_PASSWORD      = "fxaccounts:change_password";
 const COMMAND_DELETE_ACCOUNT       = "fxaccounts:delete_account";
 const COMMAND_PROFILE_CHANGE       = "profile:change";
 const COMMAND_SYNC_PREFERENCES     = "fxaccounts:sync_preferences";
 
 const PREF_LAST_FXA_USER           = "identity.fxaccounts.lastSignedInUserHash";
 
 XPCOMUtils.defineLazyGetter(this, "strings",
-                            () => Services.strings.createBundle("chrome://browser/locale/aboutAccounts.properties")); /* global strings */
+                            () => Services.strings.createBundle("chrome://browser/locale/aboutAccounts.properties"));
 
 ChromeUtils.defineModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
 ChromeUtils.defineModuleGetter(this, "Prompt", "resource://gre/modules/Prompt.jsm");
 ChromeUtils.defineModuleGetter(this, "UITelemetry", "resource://gre/modules/UITelemetry.jsm");
 
 this.FxAccountsWebChannelHelpers = function() {
 };
 
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
  /* This is a JavaScript module (JSM) to be imported via
   * Components.utils.import() and acts as a singleton. Only the following
   * listed symbols will exposed on import, and only when and where imported.
   */
 
 var EXPORTED_SYMBOLS = [
-  "ACTIONS", "Addons", "Addresses", "Bookmarks",
+  "ACTIONS", "Addons", "Addresses", "Bookmarks", "CreditCards",
   "Formdata", "History", "Passwords", "Prefs",
   "Tabs", "TPS", "Windows"
 ];
 
 var module = this;
 
 // Global modules
 ChromeUtils.import("resource://formautofill/FormAutofillSync.jsm");
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/extensions/.eslintrc.js
@@ -87,17 +87,19 @@ module.exports = {
     // array or object items, etc.). It's hard to maintain and doesn't add that
     // much benefit.
     "no-multi-spaces": "error",
 
     // No expressions where a statement is expected
     "no-unused-expressions": "error",
 
     // No declaring variables that are never used
-    "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
+    "no-unused-vars": ["error", {
+      "args": "none", "vars": "all", "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
+    }],
 
     // No using variables before defined
     "no-use-before-define": "error",
 
     // Never use spaces before function parentheses
     "space-before-function-paren": ["error", {"anonymous": "never", "named": "never"}],
 
     // ++ and -- should not need spacing
--- a/toolkit/components/extensions/test/mochitest/chrome_head.js
+++ b/toolkit/components/extensions/test/mochitest/chrome_head.js
@@ -1,12 +1,4 @@
 "use strict";
 
-const {
-  classes: Cc,
-  interfaces: Ci,
-  utils: Cu,
-  results: Cr,
-} = Components;
-
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
-
--- a/toolkit/components/narrate/.eslintrc.js
+++ b/toolkit/components/narrate/.eslintrc.js
@@ -22,17 +22,16 @@ module.exports = {
     "no-mixed-spaces-and-tabs": "error",
     "no-multi-spaces": "error",
     "no-multi-str": "error",
     "no-multiple-empty-lines": ["error", {"max": 1}],
     "no-return-assign": "error",
     "no-sequences": "error",
     "no-shadow": "error",
     "no-throw-literal": "error",
-    "no-unused-vars": "error",
     "padded-blocks": ["error", "never"],
     "quotes": ["error", "double", "avoid-escape"],
     "semi-spacing": ["error", {"before": false, "after": true}],
     "space-in-parens": ["error", "never"],
     "strict": ["error", "global"],
     "yoda": "error"
   }
 };
--- a/toolkit/components/payments/.eslintrc.js
+++ b/toolkit/components/payments/.eslintrc.js
@@ -36,17 +36,18 @@ module.exports = {
     "no-multiple-empty-lines": ["error", {
       max: 2,
     }],
     "no-proto": "error",
     "no-throw-literal": "error",
     "no-unused-expressions": "error",
     "no-unused-vars": ["error", {
       args: "none",
-      varsIgnorePattern: "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
+      vars: "all",
+      varsIgnorePattern: "^EXPORTED_SYMBOLS$",
     }],
     "no-use-before-define": ["error", {
       functions: false,
     }],
     "padded-blocks": ["error", "never"],
     radix: "error",
     "semi-spacing": ["error", {"before": false, "after": true}],
     "space-in-parens": ["error", "never"],
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -37,17 +37,18 @@ module.exports = {
     "no-multiple-empty-lines": ["error", {
       max: 2,
     }],
     "no-proto": "error",
     "no-throw-literal": "error",
     "no-unused-expressions": "error",
     "no-unused-vars": ["error", {
       args: "none",
-      varsIgnorePattern: "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
+      vars: "all",
+      varsIgnorePattern: "^EXPORTED_SYMBOLS$",
     }],
     "no-use-before-define": ["error", {
       functions: false,
     }],
     "padded-blocks": ["error", "never"],
     radix: "error",
     semi: ["error", "always"],
     "semi-spacing": ["error", {"before": false, "after": true}],
--- a/toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
+++ b/toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
@@ -138,17 +138,16 @@ add_task(async function test_aggregation
       keyed: false,
       record_on_release: true
     },
   });
 
   const SCALAR_FULL_NAME = "telemetry.cheattest.dynamic.test_aggregation";
   Services.telemetry.scalarAdd(SCALAR_FULL_NAME, 1);
 
-  let processCreated = TestUtils.topicObserved(CONTENT_CREATED);
   await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank", forceNewProcess: true },
                                     async function(browser) {
       // Accumulate from the content process into both dynamic scalars.
       await ContentTask.spawn(browser, SCALAR_FULL_NAME, async function(aName) {
         Services.telemetry.scalarAdd(aName, 3);
       });
   });
 
--- a/toolkit/mozapps/extensions/.eslintrc.js
+++ b/toolkit/mozapps/extensions/.eslintrc.js
@@ -2,11 +2,15 @@
 
 module.exports = {
   "rules": {
     // Warn about cyclomatic complexity in functions.
     // XXX Bug 1326071 - This should be reduced down - probably to 20 or to
     // be removed & synced with the mozilla/recommended value.
     "complexity": ["error", {"max": 68}],
 
-    "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
+    "no-unused-vars": ["error", {
+      "args": "none",
+      "vars": "all",
+      "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
+    }],
   }
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -73,17 +73,17 @@ module.exports = {
       "mozilla/jsm": true
     },
     "files": "**/*.jsm",
     "rules": {
       "mozilla/mark-exported-symbols-as-used": "error",
       "no-unused-vars": ["error", {
         "args": "none",
         "vars": "all",
-        "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS"
+        "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
       }]
     }
   }],
 
   "parserOptions": {
     "ecmaVersion": 9
   },
 
@@ -350,17 +350,17 @@ module.exports = {
     // cf. https://github.com/mozilla/eslint-plugin-no-unsanitized#rule-details
     "no-unsanitized/method": "error",
     "no-unsanitized/property": "error",
 
     // No declaring variables that are never used
     "no-unused-vars": ["error", {
       "args": "none",
       "vars": "local",
-      "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS"
+      "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
     }],
 
     // No using variables before defined
     // "no-use-before-define": ["error", "nofunc"],
 
     // Disallow unnecessary .call() and .apply()
     "no-useless-call": "error",
 
--- 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.9.0",
+  "version": "0.9.1",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
     "acorn": {
       "version": "5.4.1",
       "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.1.tgz",
       "integrity": "sha512-XLmq3H/BVvW6/GbxKryGxWORz1ebilSsUDlyC27bXhWGWAZWkGwS6FLHjOlwFXNFoWFQEO/Df4u0YYd0K3BQgQ==",
       "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.9.0",
+  "version": "0.9.1",
   "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
   "keywords": [
     "eslint",
     "eslintplugin",
     "eslint-plugin",
     "mozilla",
     "firefox"
   ],
--- a/tools/lint/eslint/modules.json
+++ b/tools/lint/eslint/modules.json
@@ -200,17 +200,17 @@
   "tcpsocket_test.jsm": ["createSocket", "createServer", "enablePrefsAndPermissions", "socketCompartmentInstanceOfArrayBuffer"],
   "telemetry.js": ["SyncTelemetry"],
   "test.jsm": ["Foo"],
   "test2.jsm": ["Bar"],
   "test_bug883784.jsm": ["Test"],
   "Timer.jsm": ["setTimeout", "setTimeoutWithTarget", "clearTimeout", "setInterval", "setIntervalWithTarget", "clearInterval"],
   "tokenserverclient.js": ["TokenServerClient", "TokenServerClientError", "TokenServerClientNetworkError", "TokenServerClientServerError"],
   "ToolboxProcess.jsm": ["BrowserToolboxProcess"],
-  "tps.jsm": ["ACTIONS", "TPS"],
+  "tps.jsm": ["ACTIONS", "Addons", "Addresses", "Bookmarks", "CreditCards", "Formdata", "History", "Passwords", "Prefs", "Tabs", "TPS", "Windows"],
   "Translation.jsm": ["Translation", "TranslationTelemetry"],
   "Traversal.jsm": ["TraversalRules", "TraversalHelper"],
   "UpdateTelemetry.jsm": ["AUSTLMY"],
   "UpdateTopLevelContentWindowIDHelper.jsm": ["trackBrowserWindow"],
   "util.js": ["getChromeWindow", "Utils", "Svc", "SerializableSet"],
   "utils.js": ["btoa", "encryptPayload", "makeIdentityConfig", "makeFxAccountsInternalMock", "configureFxAccountIdentity", "configureIdentity", "SyncTestingInfrastructure", "waitForZeroTimer", "Promise", "MockFxaStorageManager", "AccountState", "sumHistogram", "CommonUtils", "CryptoUtils", "TestingUtils", "promiseZeroTimer", "promiseNamedTimer", "getLoginTelemetryScalar", "syncTestLogging"],
   "Utils.jsm": ["Utils", "Logger", "PivotContext", "PrefCache"],
   "VariablesView.jsm": ["VariablesView", "escapeHTML"],