[Pkg-mozext-commits] [tabmixplus] 08/44: Enable Eslint no-use-before-define

David Prévot taffit at moszumanska.debian.org
Fri Mar 18 20:57:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit cb7217300762b924519e4ece631ac32e0a7db1b2
Author: onemen <tabmix.onemen at gmail.com>
Date:   Wed Feb 24 14:20:59 2016 +0200

    Enable Eslint no-use-before-define
---
 .eslintrc                                 | 12 +++++-------
 chrome/content/content.js                 |  3 ++-
 chrome/content/minit/tablib.js            |  2 +-
 chrome/content/preferences/preferences.js |  5 +++--
 chrome/content/session/session.js         | 16 ++++++++--------
 chrome/content/tab/tab.js                 | 11 ++++++-----
 modules/AboutNewTab.jsm                   |  3 ++-
 modules/ContentClick.jsm                  |  3 ++-
 modules/Places.jsm                        |  5 +++--
 modules/Services.jsm                      |  3 ++-
 modules/Shortcuts.jsm                     |  3 ++-
 11 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index 01b0900..7651047 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -136,8 +136,7 @@
         "no-unreachable": 2,
         "no-unused-expressions": 2,
         "no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
-        // TODO - change this....
-        "no-use-before-define": [0, "nofunc"],
+        "no-use-before-define": [2, "nofunc"],
         "no-void": 0,
         "no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
         "no-with": 2,
@@ -221,7 +220,7 @@
         "MergeWindows": false,
         "getFormattedKey": false,
         "getKeysForShortcut": false,
-        "gTMPprefObserver": false,
+        "gTMPprefObserver": true,
         "gAppearancePane": false,
         "gPrefWindow": false,
         "PromptSvc": false,
@@ -239,14 +238,13 @@
         "Tabmix": true,
         "TabmixAboutNewTab": false,
         "TabmixAllTabs": false,
-        "TabmixClickEventHandler": true,
         "TabmixContext": false,
         "TabmixContentClick": false,
         "TabmixConvertSession": false,
-        "TabmixProgressListener": false,
+        "TabmixProgressListener": true,
         "TabmixPlacesUtils": false,
-        "TabmixSessionData": false,
-        "TabmixSessionManager": false,
+        "TabmixSessionData": true,
+        "TabmixSessionManager": true,
         "TabmixSvc": false,
         "TabmixTabbar": false,
         "TabmixTabClickOptions": false,
diff --git a/chrome/content/content.js b/chrome/content/content.js
index ea193d9..e6cfe8f 100644
--- a/chrome/content/content.js
+++ b/chrome/content/content.js
@@ -32,6 +32,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "TabmixAboutNewTab",
 var PROCESS_TYPE_CONTENT = TabmixSvc.version(380) &&
     Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
 
+var TabmixClickEventHandler;
 var TabmixContentHandler = {
   MESSAGES: [
     "Tabmix:restorePermissions",
@@ -179,7 +180,7 @@ var TabmixContentHandler = {
   }
 };
 
-var TabmixClickEventHandler = {
+TabmixClickEventHandler = {
   init: function init(global) {
     if (PROCESS_TYPE_CONTENT) {
       global.addEventListener("click", this, true);
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 566ff8f..dc0a570 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -1,6 +1,6 @@
 "use strict";
 
-if (!window.tablib || tablib.version != "tabmixplus")
+if (!window.tablib || window.tablib.version != "tabmixplus")
 var tablib = { // eslint-disable-line
   version: "tabmixplus",
   _inited: false,
diff --git a/chrome/content/preferences/preferences.js b/chrome/content/preferences/preferences.js
index 34d9253..fa4fbe1 100644
--- a/chrome/content/preferences/preferences.js
+++ b/chrome/content/preferences/preferences.js
@@ -5,6 +5,7 @@
 "use strict";
 
 /***** Preference Dialog Functions *****/
+var gIncompatiblePane;
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components; // jshint ignore:line
 var PrefFn = {0: "", 32: "CharPref", 64: "IntPref", 128: "BoolPref"};
 
@@ -16,12 +17,12 @@ var gPrefWindow = { // jshint ignore:line
   init: function() {
     this._initialized = true;
 
+    var prefWindow = $("TabMIxPreferences");
     /* Chromifox theme force button height to 25px */
     var skin = Services.prefs.getCharPref("general.skins.selectedSkin");
     if (skin == "cfxec")
       prefWindow.setAttribute("chromifox", true);
 
-    var prefWindow = $("TabMIxPreferences");
     if (TabmixSvc.isMac)
       prefWindow.setAttribute("mac", true);
     else if (TabmixSvc.isLinux) {
@@ -556,7 +557,7 @@ function openHelp(helpTopic) {
   recentWindow.openUILinkIn(helpPage + helpTopic, where);
 }
 
-var gIncompatiblePane = {
+gIncompatiblePane = {
   lastSelected: "paneLinks",
 
   init: function(docElt) {
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 3b15ddf..7401d26 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -1,5 +1,3 @@
-/**/
-/* exported TabmixConvertSession */
 "use strict";
 
 Tabmix.BUTTON_OK = 0;
@@ -19,6 +17,8 @@ Tabmix.DLG_SAVE = 0;
 Tabmix.DLG_RENAME = 1;
 Tabmix.NO_NEED_TO_REPLACE = -1;
 
+var TabmixSessionManager, TabmixSessionData;
+
 /**
  *  sanitize privte data by delete the files session.rdf session.old
  */
@@ -116,7 +116,7 @@ Tabmix.Sanitizer = {
 
 };
 
-var TabmixSessionData = { // jshint ignore:line
+TabmixSessionData = {
   docShellItems: ["Images", "Subframes", "MetaRedirects", "Plugins", "Javascript"],
   tabAttribute: ["protected", "locked"],
 
@@ -218,7 +218,7 @@ var TabmixSessionData = { // jshint ignore:line
   setTabProperties: function() { }
 };
 
-var TabmixSessionManager = { // jshint ignore:line
+TabmixSessionManager = {
   _rdfRoot: "rdf://tabmix",
   HSitems: 3,
   NC_TM: {},
@@ -1368,8 +1368,8 @@ var TabmixSessionManager = { // jshint ignore:line
       }
       pathToReplace = session.path;
     }
-    container = this.initContainer(path);
-    var container, extID = "";
+    let container = this.initContainer(path);
+    let extID = "";
     var node = aTriggerNode.parentNode.parentNode;
     if (node.id.startsWith("tm-sm-closedwindows") || node.id == "btn_closedwindows")
       extID = "/" + id;
@@ -3162,6 +3162,8 @@ var TabmixSessionManager = { // jshint ignore:line
         (caller == "firstwindowopen" && gBrowser.tabs.length > 1);
     var rdfNodeWindow = this.RDFService.GetResource(path);
     var rdfNodeTabs = this.getResource(rdfNodeWindow, "tabs");
+    var tabContainer = this.initContainer(rdfNodeTabs);
+    var newtabsCount = tabContainer.GetCount();
     if (!(rdfNodeTabs instanceof Ci.nsIRDFResource) || this.containerEmpty(rdfNodeTabs)) {
       let msg = TabmixSvc.getSMString("sm.restoreError.msg0") + "\n" +
           TabmixSvc.getSMString("sm.restoreError.msg1");
@@ -3193,8 +3195,6 @@ var TabmixSessionManager = { // jshint ignore:line
     var smoothScroll = tabstrip.smoothScroll;
     tabstrip.smoothScroll = false;
 
-    var tabContainer = this.initContainer(rdfNodeTabs);
-    var newtabsCount = tabContainer.GetCount();
     var newIndex, aTab, loadOnStartup = [];
     if (newtabsCount > 0 && overwrite) {
       // unpinned tabs reorder tabs, so we loob backward
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index af2076f..f21f7fc 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1,5 +1,7 @@
 "use strict";
 
+var gTMPprefObserver, TabmixProgressListener;
+
 // code based on Tab X 0.5 enhanced version by Morac, modified by Hemiola SUN, later CPU & onemen
 var TabmixTabbar = {
   visibleRows: 1,
@@ -397,7 +399,7 @@ var TabmixTabbar = {
         return tab._tPos == numPinnedTabs ? "after" : false;
       };
       let getAttVal = function(val, hoverAttr) {
-        if (!specialTab || hoverAttr && visible && /selected/.test(attrib))
+        if (!isSpecialTab() || hoverAttr && visible && /selected/.test(attrib))
           return val;
         return val ? "special" : val;
       };
@@ -409,9 +411,8 @@ var TabmixTabbar = {
         oldTab.removeAttribute(removed);
       }
       Tabmix.tabsUtils._tabmixPositionalTabs[type] = tab;
-      let specialTab = isSpecialTab();
       if (tab && (TabmixSvc.australis && attrib == "beforeselected" ||
-          multibar || tab.hasAttribute(removed) || specialTab)) {
+                  multibar || tab.hasAttribute(removed) || isSpecialTab())) {
         let sameRow = multibar ? tabRow == Tabmix.tabsUtils.getTabRowNumber(tab, topY) || null : true;
         Tabmix.setItem(tab, removed, !sameRow || null);
         Tabmix.setItem(tab, attrib, getAttVal(sameRow, true));
@@ -1193,7 +1194,7 @@ Tabmix.visibleTabs = {
 
 // Function to catch changes to Tab Mix preferences and update existing windows and tabs
 //
-var gTMPprefObserver = {
+gTMPprefObserver = {
   preventUpdate: false,
   init: function() {
     Tabmix.prefs.clearUserPref("setDefault");
@@ -2652,7 +2653,7 @@ var gTMPprefObserver = {
 
 };
 
-var TabmixProgressListener = {
+TabmixProgressListener = {
   startup: function TMP_PL_startup(tabBrowser) {
     // check the current window.  if we're in a popup, don't init this progressListener
     if (window.document.documentElement.getAttribute("chromehidden"))
diff --git a/modules/AboutNewTab.jsm b/modules/AboutNewTab.jsm
index 9522e1b..b82edfe 100644
--- a/modules/AboutNewTab.jsm
+++ b/modules/AboutNewTab.jsm
@@ -21,6 +21,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc",
 XPCOMUtils.defineLazyModuleGetter(this, "TabmixPlacesUtils",
   "resource://tabmixplus/Places.jsm");
 
+var AboutNewTabInternal;
 this.TabmixAboutNewTab = Object.freeze({
   updateAllBrowsers: function(window) {
     AboutNewTabInternal.updateAllBrowsers(window);
@@ -35,7 +36,7 @@ this.TabmixAboutNewTab = Object.freeze({
   },
 });
 
-var AboutNewTabInternal = {
+AboutNewTabInternal = {
   // update all opened about:newtab browsers in a window including preloaded
   // browser if exist
   updateAllBrowsers: function(window) {
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index dcc4997..d7073e4 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -21,6 +21,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "LinkNodeUtils",
 XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc",
   "resource://tabmixplus/Services.jsm");
 
+var ContentClickInternal;
 this.TabmixContentClick = {
   init: function() {
     ContentClickInternal.init();
@@ -56,7 +57,7 @@ this.TabmixContentClick = {
 };
 Object.freeze(TabmixContentClick);
 
-var ContentClickInternal = {
+ContentClickInternal = {
   _timer: null,
   _initialized: false,
 
diff --git a/modules/Places.jsm b/modules/Places.jsm
index 17baaa1..e6f1c0c 100644
--- a/modules/Places.jsm
+++ b/modules/Places.jsm
@@ -26,6 +26,7 @@ XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
 XPCOMUtils.defineLazyModuleGetter(this,
   "TabmixSvc", "resource://tabmixplus/Services.jsm");
 
+var PlacesUtilsInternal;
 this.TabmixPlacesUtils = Object.freeze({
   init: function(aWindow) {
     PlacesUtilsInternal.init(aWindow);
@@ -46,7 +47,7 @@ this.TabmixPlacesUtils = Object.freeze({
 
 var Tabmix = {};
 
-var PlacesUtilsInternal = {
+PlacesUtilsInternal = {
   _timer: null,
   _initialized: false,
 
@@ -197,6 +198,7 @@ var PlacesUtilsInternal = {
 
   // Lazy getter for titlefrombookmark preference
   get titlefrombookmark() {
+    const PREF = "extensions.tabmix.titlefrombookmark";
     let updateValue = () => {
       let value = Services.prefs.getBoolPref(PREF);
       let definition = {value: value, configurable: true};
@@ -204,7 +206,6 @@ var PlacesUtilsInternal = {
       return value;
     };
 
-    const PREF = "extensions.tabmix.titlefrombookmark";
     Services.prefs.addObserver(PREF, updateValue, false);
     return updateValue();
   },
diff --git a/modules/Services.jsm b/modules/Services.jsm
index 1858384..0ec9348 100644
--- a/modules/Services.jsm
+++ b/modules/Services.jsm
@@ -7,6 +7,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
+var tabStateCache;
 var _versions = {};
 function isVersion(aVersionNo) {
   if (TabmixSvc.isPaleMoonID) {
@@ -325,7 +326,7 @@ XPCOMUtils.defineLazyGetter(TabmixSvc, "SessionStore", function() {
   return this.SessionStoreGlobal.SessionStoreInternal;
 });
 
-var tabStateCache = {
+tabStateCache = {
   get _update() {
     delete this._update;
     return (this._update = isVersion(260) ? "updateField" : "update");
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index f12f909..a4fc5d4 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -8,6 +8,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://tabmixplus/Services.jsm");
 
+var KeyConfig;
 this.Shortcuts = {
   keys: {
     newTab: {id: "key_newNavigatorTab", default: "T accel"},
@@ -439,7 +440,7 @@ this.Shortcuts = {
 
 };
 
-var KeyConfig = {
+KeyConfig = {
   prefsChangedByTabmix: false,
   // when keyConfig extension installed sync the preference
   // user may change shortcuts in both extensions

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list