[Pkg-mozext-commits] [tabmixplus] 36/73: Enable Eslint 'guard-for-in'

David Prévot taffit at moszumanska.debian.org
Mon May 9 02:30:53 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 bad1ca083771fb55a647d949d29dbca8881a5ddc
Author: onemen <tabmix.onemen at gmail.com>
Date:   Mon Apr 4 16:00:34 2016 +0300

    Enable Eslint 'guard-for-in'
---
 .eslintrc.js                                              | 2 +-
 chrome/content/preferences/subdialogs/pref-appearance.xml | 4 ++--
 chrome/content/session/session.js                         | 2 +-
 modules/DynamicRules.jsm                                  | 2 +-
 modules/SingleWindowModeUtils.jsm                         | 3 ++-
 modules/log.jsm                                           | 2 +-
 6 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/.eslintrc.js b/.eslintrc.js
index fa8ad60..d185830 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -171,7 +171,7 @@ module.exports = {
     "func-style": [0, "declaration"],
     "generator-star-spacing": [2, "after"],
     // "global-require": 0, // node
-    "guard-for-in": 0,
+    "guard-for-in": 2,
     // "handle-callback-err": 0, // node
     "id-length": 0,
     "indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": {"var": 2, "let": 2, "const": 3}}],
diff --git a/chrome/content/preferences/subdialogs/pref-appearance.xml b/chrome/content/preferences/subdialogs/pref-appearance.xml
index 2b15f26..c63abc8 100644
--- a/chrome/content/preferences/subdialogs/pref-appearance.xml
+++ b/chrome/content/preferences/subdialogs/pref-appearance.xml
@@ -143,7 +143,7 @@
             return;
           }
 
-          for (var _id in this._prefValues) {
+          for (let _id of Object.keys(this._prefValues)) {
             var item = this._getElementById(_id);
             if (!item)
               continue;
@@ -166,7 +166,7 @@
       <method name="_savePrefs">
         <body><![CDATA[
           var newPrefSValue = {};
-          for (let _id in this._prefValues) {
+          for (let _id of Object.keys(this._prefValues)) {
             var item = this._getElementById(_id);
             switch (item.localName) {
               case "checkbox":
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 67204c3..f3b229d 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -3571,7 +3571,7 @@ TabmixSessionManager = {
     }
     if ("attributes" in tabState && tabState.attributes) {
       delete tabState.attributes._locked;
-      for (var name in tabState.attributes) {
+      for (let name of Object.keys(tabState.attributes)) {
         data.properties += " " + name + "=" + encodeURI(tabState.attributes[name]);
       }
     }
diff --git a/modules/DynamicRules.jsm b/modules/DynamicRules.jsm
index a8880db..ff74a11 100644
--- a/modules/DynamicRules.jsm
+++ b/modules/DynamicRules.jsm
@@ -379,7 +379,7 @@ this.DynamicRules = {
 
     // make sure we have all the item
     // if item is missing set it to default
-    for (let item in defaultPrefValues) {
+    for (let item of Object.keys(defaultPrefValues)) {
       let value = currentPrefValues[item];
       if (value && item.indexOf("Color") > -1) {
         let opacity = item.replace("Color", "Opacity");
diff --git a/modules/SingleWindowModeUtils.jsm b/modules/SingleWindowModeUtils.jsm
index b3943e6..b101969 100644
--- a/modules/SingleWindowModeUtils.jsm
+++ b/modules/SingleWindowModeUtils.jsm
@@ -180,8 +180,9 @@ this.SingleWindowModeUtils = {
         // restore window dimensions, to prevent flickring in the next restart
         var win = newWindow.document.documentElement;
         if (typeof newWindow.__winRect == "object") {
-          for (let attr in newWindow.__winRect)
+          for (let attr of Object.keys(newWindow.__winRect)) {
             win.setAttribute(attr, newWindow.__winRect[attr]);
+          }
         }
         newWindow.close();
         if (firstTabAdded) {
diff --git a/modules/log.jsm b/modules/log.jsm
index e81c565..5a96cb1 100644
--- a/modules/log.jsm
+++ b/modules/log.jsm
@@ -196,7 +196,7 @@ options = {
     var objS = aObj ? offset + aObj.toString() : offset + "aObj is " + typeof (aObj);
     objS += ":\n";
 
-    for (let prop in aObj) {
+    for (let prop of Object.keys(aObj)) {
       try {
         let val = aObj[prop];
         let type = typeof val;

-- 
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