code cosmetics: fix some eslint complaints

Until https://github.com/eslint/eslint/issues/8594 is sorted out, we're switching to the old indent behavior (indent-legacy).
This commit is contained in:
tophf 2017-06-30 15:02:09 +03:00
parent 877d8b19e0
commit 5c1555c781
7 changed files with 20 additions and 22 deletions

View File

@ -93,7 +93,7 @@ rules:
id-blacklist: [0]
id-length: [0]
id-match: [0]
indent: [2, 2, {VariableDeclarator: 0, SwitchCase: 1}]
indent-legacy: [2, 2, {VariableDeclarator: 0, SwitchCase: 1}]
jsx-quotes: [0]
key-spacing: [0]
keyword-spacing: [2]

View File

@ -60,7 +60,6 @@ function applyOnMessage(request, sender, sendResponse) {
}
switch (request.method) {
case 'styleDeleted':
removeStyle(request);
break;

View File

@ -292,7 +292,6 @@ function updateIcon(tab, styles) {
function onRuntimeMessage(request, sender, sendResponse) {
switch (request.method) {
case 'getStyles':
getStyles(request).then(sendResponse);
return KEEP_CHANNEL_OPEN;

View File

@ -378,8 +378,7 @@ Object.assign(document.body, {
if (event.target === this) {
this.ondragend();
}
}
catch (e) {
} catch (e) {
this.ondragend();
}
},

4
dom.js
View File

@ -58,7 +58,9 @@ function animateElement(
element.removeEventListener('animationend', _);
element.classList.remove(
className,
...removeExtraClasses // In Firefox, `resolve()` might be called one frame later. This is helpful to clean-up on the same frame
// In Firefox, `resolve()` might be called one frame later.
// This is helpful to clean-up on the same frame
...removeExtraClasses
);
// TODO: investigate why animation restarts if the elements is removed in .then()
if (remove) {

View File

@ -1,4 +1,4 @@
/* eslint no-tabs: 0, no-var: 0, indent: [2, tab, {VariableDeclarator: 0, SwitchCase: 1}], quotes: 0 */
/* eslint no-tabs: 0, no-var: 0, indent-legacy: [2, tab, {VariableDeclarator: 0, SwitchCase: 1}], quotes: 0 */
/* global CodeMirror */
"use strict";

View File

@ -5,13 +5,13 @@ const FIREFOX = /Firefox/.test(navigator.userAgent);
const VIVALDI = /Vivaldi/.test(navigator.userAgent);
const OPERA = /OPR/.test(navigator.userAgent);
document.addEventListener("stylishUpdate", onUpdateClicked);
document.addEventListener("stylishUpdateChrome", onUpdateClicked);
document.addEventListener("stylishUpdateOpera", onUpdateClicked);
document.addEventListener('stylishUpdate', onUpdateClicked);
document.addEventListener('stylishUpdateChrome', onUpdateClicked);
document.addEventListener('stylishUpdateOpera', onUpdateClicked);
document.addEventListener("stylishInstall", onInstallClicked);
document.addEventListener("stylishInstallChrome", onInstallClicked);
document.addEventListener("stylishInstallOpera", onInstallClicked);
document.addEventListener('stylishInstall', onInstallClicked);
document.addEventListener('stylishInstallChrome', onInstallClicked);
document.addEventListener('stylishInstallOpera', onInstallClicked);
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
// orphaned content script check
@ -176,8 +176,7 @@ function checkUpdatability([installedStyle]) {
function sendEvent(type, detail = null) {
if (FIREFOX) {
type = type.replace('Chrome', '');
}
else if (OPERA || VIVALDI) {
} else if (OPERA || VIVALDI) {
type = type.replace('Chrome', 'Opera');
}
detail = {detail};
@ -336,13 +335,13 @@ function orphanCheck() {
}
// we're orphaned due to an extension update
// we can detach event listeners
document.removeEventListener("stylishUpdate", onUpdateClicked);
document.removeEventListener("stylishUpdateChrome", onUpdateClicked);
document.removeEventListener("stylishUpdateOpera", onUpdateClicked);
document.removeEventListener('stylishUpdate', onUpdateClicked);
document.removeEventListener('stylishUpdateChrome', onUpdateClicked);
document.removeEventListener('stylishUpdateOpera', onUpdateClicked);
document.removeEventListener("stylishInstall", onInstallClicked);
document.removeEventListener("stylishInstallChrome", onInstallClicked);
document.removeEventListener("stylishInstallOpera", onInstallClicked);
document.removeEventListener('stylishInstall', onInstallClicked);
document.removeEventListener('stylishInstallChrome', onInstallClicked);
document.removeEventListener('stylishInstallOpera', onInstallClicked);
// we can't detach chrome.runtime.onMessage because it's no longer connected internally
// we can destroy global functions in this context to free up memory