Fix ESLint errors

This commit is contained in:
Peter deHaan 2017-01-16 11:33:45 -08:00
parent 3d5b58078d
commit 15ac350589
2 changed files with 29 additions and 25 deletions

View file

@ -1,15 +1,21 @@
module.exports = { module.exports = {
"env": { "env": {
"browser": true, "browser": true,
"es6": true, "es6": true,
"node": true "node": true,
}, "webextensions": true
"extends": "eslint:recommended", },
"rules": { "extends": [
"eqeqeq": "error", "eslint:recommended"
"indent": ["error", 2], ],
"linebreak-style": ["error", "unix"], "root": true,
"quotes": ["error", "double"], "rules": {
"semi": ["error", "always"] "eqeqeq": "error",
} "indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"no-throw-literal": "error",
"quotes": ["error", "double"],
"radix": "error",
"semi": ["error", "always"]
}
}; };

View file

@ -2,12 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global browser, window, document, localStorage */
const CONTAINER_HIDE_SRC = "/img/container-hide.svg"; const CONTAINER_HIDE_SRC = "/img/container-hide.svg";
const CONTAINER_UNHIDE_SRC = "/img/container-unhide.svg"; const CONTAINER_UNHIDE_SRC = "/img/container-unhide.svg";
// Let's set it to false before releasing!!! // TODO: Let's set it to false before releasing!!!
const DEBUG = true; const DEBUG = true;
// List of panels // List of panels
@ -21,7 +19,7 @@ const P_CONTAINER_DELETE = "containerDelete";
function log(...args) { function log(...args) {
if (DEBUG) { if (DEBUG) {
console.log.call(console, ...args); console.log.call(console, ...args); // eslint-disable-line no-console
} }
} }
@ -103,13 +101,13 @@ let Logic = {
}, },
generateIdentityName() { generateIdentityName() {
const defaultName = 'Container'; const defaultName = "Container";
let ids = []; let ids = [];
// This loop populates the 'ids' array with all the already-used ids. // This loop populates the 'ids' array with all the already-used ids.
this._identities.forEach(identity => { this._identities.forEach(identity => {
if (identity.name.startsWith(defaultName)) { if (identity.name.startsWith(defaultName)) {
let id = parseInt(identity.name.substr(defaultName.length)) let id = parseInt(identity.name.substr(defaultName.length), 10);
if (id) { if (id) {
ids.push(id); ids.push(id);
} }
@ -118,8 +116,8 @@ let Logic = {
// Here we find the first valid id. // Here we find the first valid id.
for (let id = 1;; ++id) { for (let id = 1;; ++id) {
if (ids.indexOf(id) == -1) { if (ids.indexOf(id) === -1) {
return defaultName + (id < 10 ? '0' : '') + id; return defaultName + (id < 10 ? "0" : "") + id;
} }
} }
}, },
@ -197,7 +195,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
let fragment = document.createDocumentFragment(); let fragment = document.createDocumentFragment();
Logic.identities().forEach(identity => { Logic.identities().forEach(identity => {
log('identities.forEach'); log("identities.forEach");
let tr = document.createElement("tr"); let tr = document.createElement("tr");
fragment.appendChild(tr); fragment.appendChild(tr);
tr.classList.add("container-panel-row", "clickable"); tr.classList.add("container-panel-row", "clickable");
@ -251,7 +249,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
Logic.showPreviousPanel(); Logic.showPreviousPanel();
}); });
document.querySelector("#container-info-hideorshow").addEventListener("click", e => { document.querySelector("#container-info-hideorshow").addEventListener("click", () => {
let identity = Logic.currentIdentity(); let identity = Logic.currentIdentity();
browser.runtime.sendMessage({ browser.runtime.sendMessage({
method: identity.hasHiddenTabs ? "showTabs" : "hideTabs", method: identity.hasHiddenTabs ? "showTabs" : "hideTabs",
@ -261,7 +259,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
}); });
}); });
document.querySelector("#container-info-movetabs").addEventListener("click", e => { document.querySelector("#container-info-movetabs").addEventListener("click", () => {
return browser.runtime.sendMessage({ return browser.runtime.sendMessage({
method: "moveTabsToWindow", method: "moveTabsToWindow",
userContextId: Logic.currentIdentity().userContextId, userContextId: Logic.currentIdentity().userContextId,
@ -303,7 +301,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
method: "getTabs", method: "getTabs",
userContextId: identity.userContextId, userContextId: identity.userContextId,
}).then(tabs => { }).then(tabs => {
log('browser.runtime.sendMessage getTabs, tabs: ', tabs); log("browser.runtime.sendMessage getTabs, tabs: ", tabs);
// For each one, let's create a new line. // For each one, let's create a new line.
let fragment = document.createDocumentFragment(); let fragment = document.createDocumentFragment();
for (let tab of tabs) { for (let tab of tabs) {