Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #2365 - Manual fixes for remaining ESLint issues when switching t…
Browse files Browse the repository at this point in the history
…o mozilla/recommended.
  • Loading branch information
Standard8 committed Apr 18, 2017
1 parent 03ad681 commit ac25801
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 35 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rules:
react/no-find-dom-node: warn # TODO: change to "error"
react/prop-types: off # TODO: change to "error"

consistent-return: off # TODO: remove, and default to mozilla/recommended of "error"
eqeqeq: off # TODO: change to "error"
no-console: off
no-var: off # TODO: change to "error"
Expand Down
6 changes: 3 additions & 3 deletions addon/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const appStartupPromise = new Promise((resolve, reject) => {
const prefs = Services.prefs;
const prefObserver = {
register() {
prefs.addObserver(PREF_BRANCH, this, false);
prefs.addObserver(PREF_BRANCH, this);
},

unregister() {
Expand All @@ -48,11 +48,11 @@ const prefObserver = {

const appStartupObserver = {
register() {
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
Services.obs.addObserver(this, "sessionstore-windows-restored");
},

unregister() {
Services.obs.removeObserver(this, "sessionstore-windows-restored", false);
Services.obs.removeObserver(this, "sessionstore-windows-restored");
},

observe() {
Expand Down
2 changes: 0 additions & 2 deletions addon/webextension/catcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

"use strict";

var global = this;

this.catcher = (function() {
let exports = {};

Expand Down
22 changes: 10 additions & 12 deletions addon/webextension/onboarding/slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ this.slides = (function() {
let currentSlide = 1;
let numberOfSlides;
let callbacks;
let backend;

exports.display = function(addCallbacks) {
if (iframe) {
Expand Down Expand Up @@ -46,9 +45,8 @@ this.slides = (function() {
doc.adoptNode(parsedDom.documentElement),
doc.documentElement
);
doc.addEventListener("keyup", onKeyUp, false);
callBackground("getBackend").then((backendResult) => {
backend = backendResult;
doc.addEventListener("keyup", onKeyUp);
callBackground("getBackend").then(() => {
localizeText(doc);
activateSlide(doc);
resolve();
Expand All @@ -58,14 +56,14 @@ this.slides = (function() {
});
document.body.appendChild(iframe);
iframe.focus();
window.addEventListener("resize", onResize, false);
window.addEventListener("resize", onResize);
});
};

exports.remove = exports.unload = function() {
window.removeEventListener("resize", onResize, false);
window.removeEventListener("resize", onResize);
if (doc) {
doc.removeEventListener("keyup", onKeyUp, false);
doc.removeEventListener("keyup", onKeyUp);
}
util.removeNode(iframe);
iframe = doc = null;
Expand Down Expand Up @@ -125,27 +123,27 @@ this.slides = (function() {
doc.querySelector("#next").addEventListener("click", watchFunction(assertIsTrusted(() => {
shooter.sendEvent("navigate-slide", "next");
next();
})), false);
})));
doc.querySelector("#prev").addEventListener("click", watchFunction(assertIsTrusted(() => {
shooter.sendEvent("navigate-slide", "prev");
prev();
})), false);
})));
for (let el of doc.querySelectorAll(".goto-slide")) {
el.addEventListener("click", watchFunction(assertIsTrusted((event) => {
shooter.sendEvent("navigate-slide", "goto");
let el = event.target;
let index = parseInt(el.getAttribute("data-number"), 10);
setSlide(index);
})), false);
})));
}
doc.querySelector("#skip").addEventListener("click", watchFunction(assertIsTrusted((event) => {
shooter.sendEvent("cancel-slides", "skip");
callbacks.onEnd();
})), false);
})));
doc.querySelector("#done").addEventListener("click", watchFunction(assertIsTrusted((event) => {
shooter.sendEvent("finish-slides", "done");
callbacks.onEnd();
})), false);
})));
setSlide(1);
}

Expand Down
10 changes: 5 additions & 5 deletions addon/webextension/selector/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
overlay.querySelector(".visible").textContent = browser.i18n.getMessage("saveScreenshotVisibleArea");
overlay.querySelector(".full-page").textContent = browser.i18n.getMessage("saveScreenshotFullPage");
overlay.querySelector(".myshots-button").addEventListener(
"click", watchFunction(assertIsTrusted(standardOverlayCallbacks.onOpenMyShots)), false);
"click", watchFunction(assertIsTrusted(standardOverlayCallbacks.onOpenMyShots)));
overlay.querySelector(".visible").addEventListener(
"click", watchFunction(assertIsTrusted(standardOverlayCallbacks.onClickVisible)), false);
"click", watchFunction(assertIsTrusted(standardOverlayCallbacks.onClickVisible)));
overlay.querySelector(".full-page").addEventListener(
"click", watchFunction(assertIsTrusted(standardOverlayCallbacks.onClickFullPage)), false);
"click", watchFunction(assertIsTrusted(standardOverlayCallbacks.onClickFullPage)));
resolve();
});
document.body.appendChild(this.element);
Expand All @@ -274,7 +274,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
},

hide() {
window.removeEventListener("scroll", this.onScroll, false);
window.removeEventListener("scroll", this.onScroll);
window.removeEventListener("resize", this.onResize, true);
if (this.element) {
this.element.style.display = "none";
Expand All @@ -283,7 +283,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars

unhide() {
this.updateElementSize();
window.addEventListener("scroll", this.onScroll, false);
window.addEventListener("scroll", this.onScroll);
window.addEventListener("resize", this.onResize, true);
this.element.style.display = "";
this.element.focus();
Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/selector/uicontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ this.uicontrol = (function() {
ui.iframe.usePreSelection();
ui.Box.remove();
const handler = watchFunction(assertIsTrusted(keyupHandler));
document.addEventListener("keyup", handler, false);
document.addEventListener("keyup", handler);
registeredDocumentHandlers.push({name: "keyup", doc: document, handler});
}));
},
Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/selector/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ this.util = (function() { // eslint-disable-line no-unused-vars
/** Removes a node from its document, if it's a node and the node is attached to a parent */
exports.removeNode = function(el) {
if (el && el.parentNode) {
el.parentNode.removeChild(el);
el.remove();
}
};

Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/sitehelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ this.sitehelper = (function() {
// but probably won't - instead the site will ask for that event after it has loaded
document.addEventListener("request-addon-present", catcher.watchFunction(() => {
sendCustomEvent("addon-present");
}), false);
}));

sendCustomEvent("addon-present");

Expand Down
2 changes: 1 addition & 1 deletion server/src/pages/leave-screenshots/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let helperReadyPromise = new Promise((resolve, reject) => {

document.addEventListener("addon-present", () => {
helperReadyResolve();
}, false);
});

document.dispatchEvent(new CustomEvent("request-addon-present"));

Expand Down
8 changes: 4 additions & 4 deletions server/src/pages/shot/share-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ class ShareButtonPanel extends React.Component {
}

componentDidMount() {
document.addEventListener("click", this.clickMaybeClose, false);
document.addEventListener("keyup", this.keyMaybeClose, false);
document.addEventListener("click", this.clickMaybeClose);
document.addEventListener("keyup", this.keyMaybeClose);
}

componentWillUnmount() {
document.removeEventListener("click", this.clickMaybeClose, false);
document.removeEventListener("keyup", this.keyMaybeClose, false);
document.removeEventListener("click", this.clickMaybeClose);
document.removeEventListener("keyup", this.keyMaybeClose);
}

clickMaybeClose(event) {
Expand Down
4 changes: 2 additions & 2 deletions server/src/pages/shotindex/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ window.addEventListener("popstate", () => {
el.value = model.defaultSearch;
}
refreshModel();
}, false);
});

function refreshModel() {
let req = new XMLHttpRequest();
Expand Down Expand Up @@ -124,6 +124,6 @@ document.addEventListener("contextmenu", (event) => {
node = node.parentNode;
}
sendEvent("contextmenu", place);
}, false);
});

window.controller = exports;
2 changes: 1 addition & 1 deletion static/js/parent-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ window.addEventListener("load", function() {
if (height) {
doResize();
}
}, false);
});
4 changes: 2 additions & 2 deletions static/js/wantsauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ window.wantsauth = (function() {
for (let callback of authDataCallbacks) {
callback(savedAuthData);
}
}, false);
});

document.addEventListener("addon-present", () => {
document.dispatchEvent(new CustomEvent("request-login", {detail: maybeShotId}));
}, false);
});

document.dispatchEvent(new CustomEvent("request-addon-present"));

Expand Down

0 comments on commit ac25801

Please sign in to comment.