Bug 1434446 - Enable no-unused-vars for global scope on jsm files in browser/. r?Mossop draft
authorMark Banner <standard8@mozilla.com>
Thu, 01 Mar 2018 20:06:06 +0000
changeset 762090 c39c327fd40b0067c69d064e959c6fccd7d6910c
parent 761787 e33efdb3e1517d521deb949de3fcd6d9946ea440
push id101082
push userbmo:standard8@mozilla.com
push dateThu, 01 Mar 2018 20:16:14 +0000
reviewersMossop
bugs1434446
milestone60.0a1
Bug 1434446 - Enable no-unused-vars for global scope on jsm files in browser/. r?Mossop MozReview-Commit-ID: ERT1Fili25d
.eslintrc.js
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/PanelMultiView.jsm
browser/components/downloads/DownloadsCommon.jsm
browser/components/downloads/DownloadsSubview.jsm
browser/components/sessionstore/SessionSaver.jsm
browser/components/translation/YandexTranslator.jsm
browser/extensions/pocket/content/pktApi.jsm
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -45,31 +45,16 @@ module.exports = {
     "files": [
       "extensions/pref/**",
       "mobile/android/**",
     ],
     "rules": {
       "mozilla/use-services": "off",
     }
   }, {
-    // XXX Bug 1434446. These directories have jsm files still being fixed, so
-    // turn off global no-unused-vars checking for them.
-    "files": [
-      "browser/components/**/*.jsm",
-      "browser/extensions/**/*.jsm",
-    ],
-    "rules": {
-      "mozilla/mark-exported-symbols-as-used": "error",
-      "no-unused-vars": ["error", {
-        "args": "none",
-        "vars": "local",
-        "varsIgnorePattern": "^EXPORTED_SYMBOLS$"
-      }]
-    }
-  }, {
     // XXX Bug 1436303. These directories are still being fixed, so turn off
     // mozilla/no-cc-etc for now.
     "files": [
       "devtools/**"
     ],
     "rules": {
       "mozilla/no-define-cc-etc": "off",
     }
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -7,17 +7,16 @@
 var EXPORTED_SYMBOLS = ["CustomizeMode"];
 
 const kPrefCustomizationDebug = "browser.uiCustomization.debug";
 const kPaletteId = "customization-palette";
 const kDragDataTypePrefix = "text/toolbarwrapper-id/";
 const kSkipSourceNodePref = "browser.uiCustomization.skipSourceNodeCheck";
 const kDrawInTitlebarPref = "browser.tabs.drawInTitlebar";
 const kExtraDragSpacePref = "browser.tabs.extraDragSpace";
-const kMaxTransitionDurationMs = 2000;
 const kKeepBroadcastAttributes = "keepbroadcastattributeswhencustomizing";
 
 const kPanelItemContextMenu = "customizationPanelItemContextMenu";
 const kPaletteItemContextMenu = "customizationPaletteItemContextMenu";
 
 const kDownloadAutohideCheckboxId = "downloads-button-autohide-checkbox";
 const kDownloadAutohidePanelId = "downloads-button-autohide-panel";
 const kDownloadAutoHidePref = "browser.download.autohideButton";
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -262,17 +262,17 @@ var AssociatedToNode = class {
       return cancel;
     });
   }
 };
 
 /**
  * This is associated to <panelmultiview> elements.
  */
-var PanelMultiView = class extends this.AssociatedToNode {
+var PanelMultiView = class extends AssociatedToNode {
   /**
    * Tries to open the specified <panel> and displays the main view specified
    * with the "mainViewId" attribute on the <panelmultiview> node it contains.
    *
    * If the panel does not contain a <panelmultiview>, it is opened directly.
    * This allows consumers like page actions to accept different panel types.
    *
    * @see The non-static openPopup method for details.
@@ -1176,17 +1176,17 @@ var PanelMultiView = class extends this.
       }
     }
   }
 };
 
 /**
  * This is associated to <panelview> elements.
  */
-var PanelView = class extends this.AssociatedToNode {
+var PanelView = class extends AssociatedToNode {
   constructor(node) {
     super(node);
 
     /**
      * Indicates whether the view is active. When this is false, consumers can
      * wait for the ViewShown event to know when the view becomes active.
      */
     this.active = false;
--- a/browser/components/downloads/DownloadsCommon.jsm
+++ b/browser/components/downloads/DownloadsCommon.jsm
@@ -67,18 +67,16 @@ const kDownloadsStringsRequiringFormatti
   statusSeparatorBeforeNumber: true,
   fileExecutableSecurityWarning: true
 };
 
 const kDownloadsStringsRequiringPluralForm = {
   otherDownloads3: true
 };
 
-const kPartialDownloadSuffix = ".part";
-
 const kMaxHistoryResultsForLimitedView = 42;
 
 const kPrefBranch = Services.prefs.getBranch("browser.download.");
 
 var PrefObserver = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference]),
   getPref(name) {
--- a/browser/components/downloads/DownloadsSubview.jsm
+++ b/browser/components/downloads/DownloadsSubview.jsm
@@ -17,17 +17,16 @@ ChromeUtils.defineModuleGetter(this, "Do
 ChromeUtils.defineModuleGetter(this, "DownloadsCommon",
                                "resource:///modules/DownloadsCommon.jsm");
 ChromeUtils.defineModuleGetter(this, "DownloadsViewUI",
                                "resource:///modules/DownloadsViewUI.jsm");
 ChromeUtils.defineModuleGetter(this, "FileUtils",
                                "resource://gre/modules/FileUtils.jsm");
 
 let gPanelViewInstances = new WeakMap();
-const kEvents = ["ViewShowing", "ViewHiding", "click", "command"];
 const kRefreshBatchSize = 10;
 const kMaxWaitForIdleMs = 200;
 XPCOMUtils.defineLazyGetter(this, "kButtonLabels", () => {
   return {
     show: DownloadsCommon.strings[AppConstants.platform == "macosx" ? "showMacLabel" : "showLabel"],
     open: DownloadsCommon.strings.openFileLabel,
     retry: DownloadsCommon.strings.retryLabel,
   };
--- a/browser/components/sessionstore/SessionSaver.jsm
+++ b/browser/components/sessionstore/SessionSaver.jsm
@@ -52,17 +52,16 @@ function stopWatch(method) {
   return function(...histograms) {
     for (let hist of histograms) {
       TelemetryStopwatch[method]("FX_SESSION_RESTORE_" + hist);
     }
   };
 }
 
 var stopWatchStart = stopWatch("start");
-var stopWatchCancel = stopWatch("cancel");
 var stopWatchFinish = stopWatch("finish");
 
 /**
  * The external API implemented by the SessionSaver module.
  */
 var SessionSaver = Object.freeze({
   /**
    * Immediately saves the current session to disk.
@@ -385,9 +384,8 @@ XPCOMUtils.defineLazyPreferenceGetter(Se
   }
   if (latest != undefined) {
     idleService.addIdleObserver(SessionSaverInternal, latest);
   }
 });
 
 var idleService = Cc["@mozilla.org/widget/idleservice;1"].getService(Ci.nsIIdleService);
 idleService.addIdleObserver(SessionSaverInternal, SessionSaverInternal._idleDelay);
-
--- a/browser/components/translation/YandexTranslator.jsm
+++ b/browser/components/translation/YandexTranslator.jsm
@@ -23,25 +23,23 @@ const MAX_REQUEST_DATA = 5000; // Docume
 const MAX_REQUEST_CHUNKS = 1000; // Documentation says 2000.
 
 // Self-imposed limit of 15 requests. This means that a page that would need
 // to be broken in more than 15 requests won't be fully translated.
 // The maximum amount of data that we will translate for a single page
 // is MAX_REQUESTS * MAX_REQUEST_DATA.
 const MAX_REQUESTS = 15;
 
-const YANDEX_RETURN_CODE_OK = 200;
-
 const YANDEX_ERR_KEY_INVALID               = 401; // Invalid API key
 const YANDEX_ERR_KEY_BLOCKED               = 402; // This API key has been blocked
 const YANDEX_ERR_DAILY_REQ_LIMIT_EXCEEDED  = 403; // Daily limit for requests reached
 const YANDEX_ERR_DAILY_CHAR_LIMIT_EXCEEDED = 404; // Daily limit of chars reached
-const YANDEX_ERR_TEXT_TOO_LONG             = 413; // The text size exceeds the maximum
-const YANDEX_ERR_UNPROCESSABLE_TEXT        = 422; // The text could not be translated
-const YANDEX_ERR_LANG_NOT_SUPPORTED        = 501; // The specified translation direction is not supported
+// const YANDEX_ERR_TEXT_TOO_LONG             = 413; // The text size exceeds the maximum
+// const YANDEX_ERR_UNPROCESSABLE_TEXT        = 422; // The text could not be translated
+// const YANDEX_ERR_LANG_NOT_SUPPORTED        = 501; // The specified translation direction is not supported
 
 // Errors that should activate the service unavailable handling
 const YANDEX_PERMANENT_ERRORS = [
   YANDEX_ERR_KEY_INVALID,
   YANDEX_ERR_KEY_BLOCKED,
   YANDEX_ERR_DAILY_REQ_LIMIT_EXCEEDED,
   YANDEX_ERR_DAILY_CHAR_LIMIT_EXCEEDED,
 ];
--- a/browser/extensions/pocket/content/pktApi.jsm
+++ b/browser/extensions/pocket/content/pktApi.jsm
@@ -37,17 +37,16 @@
  * Definition of keys stored in preferences to preserve user state:
  *      premium_status:   Current premium status for logged in user if available
  *                        Can be 0 for no premium and 1 for premium
  *      latestSince:      Last timestamp a save happened
  *      tags:             All tags for logged in user
  *      usedTags:         All used tags from within the extension sorted by recency
  */
 
-const Cm = Components.manager;
 var EXPORTED_SYMBOLS = ["pktApi"];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 Cu.importGlobalProperties(["XMLHttpRequest"]);
 
 var pktApi = (function() {