[Pkg-mozext-commits] [tabmixplus] 23/73: Enable Eslint 'no-else-return'
David Prévot
taffit at moszumanska.debian.org
Mon May 9 02:30:51 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 6226e2e5d6d1120d7708c999aefce9f3f77dc274
Author: onemen <tabmix.onemen at gmail.com>
Date: Sun Apr 3 15:22:44 2016 +0300
Enable Eslint 'no-else-return'
---
.eslintrc.js | 2 +-
chrome/content/extensions/sage.js | 4 +-
chrome/content/preferences/preferences.js | 4 +-
chrome/content/tab/tab.js | 107 +++++++++++++++---------------
modules/ContentClick.jsm | 10 +--
modules/ContextMenu.jsm | 3 +-
modules/Decode.jsm | 3 +-
7 files changed, 64 insertions(+), 69 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 45e8670..992a2f3 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -66,7 +66,7 @@ module.exports = {
"no-dupe-keys": 2,
"no-dupe-args": 2,
"no-duplicate-case": 2,
- "no-else-return": 0,
+ "no-else-return": 2,
"no-eq-null": 2,
"no-eval": 0,
// this show error on catch empty block unless there is a comment
diff --git a/chrome/content/extensions/sage.js b/chrome/content/extensions/sage.js
index 8469ed5..9059fa9 100644
--- a/chrome/content/extensions/sage.js
+++ b/chrome/content/extensions/sage.js
@@ -56,8 +56,8 @@ var TMP_Sage = {
get openTabPref() {
if (Services.prefs.prefHasUserValue(this.OPEN_TAB_FOR_SAGE))
return this.OPEN_TAB_FOR_SAGE;
- else
- return TMP_Places.prefBookmark;
+
+ return TMP_Places.prefBookmark;
}
};
diff --git a/chrome/content/preferences/preferences.js b/chrome/content/preferences/preferences.js
index 013d72c..a5193e7 100644
--- a/chrome/content/preferences/preferences.js
+++ b/chrome/content/preferences/preferences.js
@@ -264,8 +264,8 @@ function getPrefByType(prefName) {
var fn = PrefFn[Services.prefs.getPrefType(prefName)];
if (fn == "CharPref")
return Services.prefs.getComplexValue(prefName, Ci.nsISupportsString).data;
- else
- return Services.prefs["get" + fn](prefName);
+
+ return Services.prefs["get" + fn](prefName);
} catch (ex) {
Tabmix.log("can't read preference " + prefName + "\n" + ex, true);
}
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 271b5f8..b5362e7 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -179,11 +179,10 @@ var TabmixTabbar = {
if (delay) {
if (this.updateScrollStatus.timeout) {
return;
- } else {
- this.updateScrollStatus.timeout = setTimeout(() => {
- this.updateScrollStatus.timeout = null;
- }, 250);
}
+ this.updateScrollStatus.timeout = setTimeout(() => {
+ this.updateScrollStatus.timeout = null;
+ }, 250);
}
var tabBar = gBrowser.tabContainer;
if (this.isMultiRow) {
@@ -482,8 +481,8 @@ var TabmixTabbar = {
if (lastTabRow == 1) { // one row
if (firstTab.getAttribute("selected") == "true")
return lastTab.boxObject.height;
- else
- return firstTab.boxObject.height;
+
+ return firstTab.boxObject.height;
} else if (lastTabRow == 2) { // multi-row
let newRowHeight;
if (lastTab.getAttribute("selected") == "true") {
@@ -492,16 +491,16 @@ var TabmixTabbar = {
var prev = Tabmix.visibleTabs.previous(lastTab);
if (prev && Tabmix.tabsUtils.getTabRowNumber(prev, topY) == 1)
return lastTab.boxObject.height;
- else
- newRowHeight = prev.baseY - firstTab.baseY;
+
+ newRowHeight = prev.baseY - firstTab.baseY;
} else if (firstTab.getAttribute("selected") == "true") {
// check if 2nd visible tab is in the 2nd row
// (not likely that user set tab width to more then half screen width)
var next = Tabmix.visibleTabs.next(firstTab);
if (next && Tabmix.tabsUtils.getTabRowNumber(next, topY) == 2)
return lastTab.boxObject.height;
- else
- newRowHeight = lastTab.baseY - next.baseY;
+
+ newRowHeight = lastTab.baseY - next.baseY;
} else {
newRowHeight = lastTab.baseY - firstTab.baseY;
}
@@ -518,11 +517,12 @@ var TabmixTabbar = {
while (this.inSameRow(tabs.item(i), tabs.item(j)))
i++;
- if (!tabs[i]) // only one row
+ if (!tabs[i]) {// only one row
if (tabs[j])
return tabs[j].boxObject.height;
- else
- return tabs[0].boxObject.height;
+
+ return tabs[0].boxObject.height;
+ }
if (tabs[i].getAttribute("selected") == "true")
i++;
@@ -893,51 +893,48 @@ Tabmix.tabsUtils = {
this.disAllowNewtabbutton = true;
}
return;
- } else {
- // button is NOT visible
- // A: 2 last tabs are in the same row:
- // check if we have room for the button in this row
- // B: 2 last tabs are NOT in the same row:
- // check if we have room for the last tab + button after
- // previous to last tab.
- // ignor the case that this tab width is larger then the tabbar
- let previousTab = Tabmix.visibleTabs.previous(lastTab);
- if (!previousTab) {
- this.disAllowNewtabbutton = false;
- return;
- }
+ }
+ // button is NOT visible
+ // A: 2 last tabs are in the same row:
+ // check if we have room for the button in this row
+ // B: 2 last tabs are NOT in the same row:
+ // check if we have room for the last tab + button after
+ // previous to last tab.
+ // ignor the case that this tab width is larger then the tabbar
+ let previousTab = Tabmix.visibleTabs.previous(lastTab);
+ if (!previousTab) {
+ this.disAllowNewtabbutton = false;
+ return;
+ }
- // buttons that are not on TabsToolbar or not visible are null
- let newTabButtonWidth = function(aOnSide) {
- let width = 0, privatTabButton = TabmixTabbar.newPrivateTabButton();
- if (privatTabButton) {
- width += aOnSide ? privatTabButton.boxObject.width :
- Tabmix.afterTabsButtonsWidth[1];
- }
- if (Tabmix.sideNewTabButton) {
- width += aOnSide ? Tabmix.sideNewTabButton.boxObject.width :
- Tabmix.afterTabsButtonsWidth[0];
- }
- return width;
- };
- let tsbo = this.tabBar.mTabstrip.scrollBoxObject;
- let tsboEnd = tsbo.screenX + tsbo.width + newTabButtonWidth(true);
- if (TabmixTabbar.inSameRow(lastTab, previousTab)) {
- let buttonEnd = lastTab.boxObject.screenX + lastTab.boxObject.width +
- newTabButtonWidth();
- this.disAllowNewtabbutton = buttonEnd > tsboEnd;
- return;
- } else {
- let lastTabEnd = previousTab.boxObject.screenX +
- previousTab.boxObject.width + lastTab.boxObject.width;
- // both last tab and new tab button are in the next row
- if (lastTabEnd > tsboEnd)
- this.disAllowNewtabbutton = false;
- else
- this.disAllowNewtabbutton = lastTabEnd + newTabButtonWidth() > tsboEnd;
- return;
+ // buttons that are not on TabsToolbar or not visible are null
+ let newTabButtonWidth = function(aOnSide) {
+ let width = 0, privatTabButton = TabmixTabbar.newPrivateTabButton();
+ if (privatTabButton) {
+ width += aOnSide ? privatTabButton.boxObject.width :
+ Tabmix.afterTabsButtonsWidth[1];
+ }
+ if (Tabmix.sideNewTabButton) {
+ width += aOnSide ? Tabmix.sideNewTabButton.boxObject.width :
+ Tabmix.afterTabsButtonsWidth[0];
}
+ return width;
+ };
+ let tsbo = this.tabBar.mTabstrip.scrollBoxObject;
+ let tsboEnd = tsbo.screenX + tsbo.width + newTabButtonWidth(true);
+ if (TabmixTabbar.inSameRow(lastTab, previousTab)) {
+ let buttonEnd = lastTab.boxObject.screenX + lastTab.boxObject.width +
+ newTabButtonWidth();
+ this.disAllowNewtabbutton = buttonEnd > tsboEnd;
+ return;
}
+ let lastTabEnd = previousTab.boxObject.screenX +
+ previousTab.boxObject.width + lastTab.boxObject.width;
+ // both last tab and new tab button are in the next row
+ if (lastTabEnd > tsboEnd)
+ this.disAllowNewtabbutton = false;
+ else
+ this.disAllowNewtabbutton = lastTabEnd + newTabButtonWidth() > tsboEnd;
},
get disAllowNewtabbutton() {
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index 68ee9e4..c0113b1 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -903,8 +903,8 @@ ContentClickInternal = {
hrefFromOnClick = hrefFromOnClick.toLowerCase();
if (isYoutube(hrefFromOnClick))
return !isSamePath(hrefFromOnClick, '&t=');
- else
- return !isSame(hrefFromOnClick, '#');
+
+ return !isSame(hrefFromOnClick, '#');
}
if (href)
@@ -917,9 +917,9 @@ ContentClickInternal = {
return null;
else if (isYoutube(href))
return !isSamePath(href, '&t=');
- else
- // when the links target is in the same page don't open new tab
- return !isSame(href, '#');
+
+ // when the links target is in the same page don't open new tab
+ return !isSame(href, '#');
},
/**
diff --git a/modules/ContextMenu.jsm b/modules/ContextMenu.jsm
index d4a675f..c074c1e 100644
--- a/modules/ContextMenu.jsm
+++ b/modules/ContextMenu.jsm
@@ -21,9 +21,8 @@ this.ContextMenu = {
acceptNode: function(n) {
if (n.nodeName == 'A' || n.nodeName == 'li') {
return Ci.nsIDOMNodeFilter.FILTER_ACCEPT;
- } else {
- return Ci.nsIDOMNodeFilter.FILTER_SKIP;
}
+ return Ci.nsIDOMNodeFilter.FILTER_SKIP;
}
};
diff --git a/modules/Decode.jsm b/modules/Decode.jsm
index 4bb0436..e2fe184 100644
--- a/modules/Decode.jsm
+++ b/modules/Decode.jsm
@@ -57,7 +57,6 @@ function fixedFromCharCode(codePt) {
if (codePt > 0xFFFF) {
codePt -= 0x10000;
return String.fromCharCode(0xD800 + (codePt >> 10), 0xDC00 + (codePt & 0x3FF));
- } else {
- return String.fromCharCode(codePt);
}
+ return String.fromCharCode(codePt);
}
--
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