silence eslint; switch shirt-circuiting to single-line if/else

This commit is contained in:
tophf 2017-12-18 09:57:00 +03:00
parent 31fd551264
commit 6607455e8f
5 changed files with 10 additions and 9 deletions

View File

@ -1,3 +1,4 @@
/* global cloneInto */
'use strict'; 'use strict';
(() => { (() => {
@ -93,7 +94,7 @@
if (typeof cloneInto !== 'undefined') { if (typeof cloneInto !== 'undefined') {
// Firefox requires explicit cloning, however USO can't process our messages anyway // Firefox requires explicit cloning, however USO can't process our messages anyway
// because USO tries to use a global "event" variable deprecated in Firefox // because USO tries to use a global "event" variable deprecated in Firefox
detail = cloneInto(detail, document); // eslint-disable-line no-undef detail = cloneInto(detail, document);
} }
onDOMready().then(() => { onDOMready().then(() => {
document.dispatchEvent(new CustomEvent(type, detail)); document.dispatchEvent(new CustomEvent(type, detail));

View File

@ -159,7 +159,7 @@ function sendMessage(msg, callback) {
fn(...args, r => { fn(...args, r => {
const err = r && r.__ERROR__; const err = r && r.__ERROR__;
(err ? reject : resolve)(err || r); (err ? reject : resolve)(err || r);
chrome.runtime.lastError; // eslint-disable-line no-unused-expressions ignoreChromeError();
}); });
}); });
} }
@ -268,7 +268,8 @@ function stringAsRegExp(s, flags) {
function ignoreChromeError() { function ignoreChromeError() {
chrome.runtime.lastError; // eslint-disable-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
chrome.runtime.lastError;
} }

View File

@ -51,9 +51,7 @@ var usercss = (() => {
return loadScript('/vendor/stylus-lang/stylus.min.js').then(() => ( return loadScript('/vendor/stylus-lang/stylus.min.js').then(() => (
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
const varDef = Object.keys(vars).map(key => `${key} = ${vars[key].value};\n`).join(''); const varDef = Object.keys(vars).map(key => `${key} = ${vars[key].value};\n`).join('');
window.stylus(varDef + source).render((err, output) => {
// eslint-disable-next-line no-undef
stylus(varDef + source).render((err, output) => {
if (err) { if (err) {
reject(err); reject(err);
} else { } else {

View File

@ -392,7 +392,7 @@ Object.assign(handleEvent, {
}, },
config(event, {styleMeta}) { config(event, {styleMeta}) {
event.preventDefault() event.preventDefault();
configDialog(styleMeta); configDialog(styleMeta);
}, },
}); });

View File

@ -183,7 +183,7 @@
} }
lineCacheAlive = true; lineCacheAlive = true;
!elements && (elements = text.getElementsByClassName(OWN_TOKEN_CLASS)); if (!elements) elements = text.getElementsByClassName(OWN_TOKEN_CLASS);
do { do {
el = elements[elementIndex]; el = elements[elementIndex];
elementIndex += el && el.classList.contains(DISABLED_NEXT_TOKEN_CLASS) ? 2 : 1; elementIndex += el && el.classList.contains(DISABLED_NEXT_TOKEN_CLASS) ? 2 : 1;
@ -202,7 +202,7 @@
bg.title = options.tooltip; bg.title = options.tooltip;
} }
bg.style.setProperty('background-color', data.color, 'important'); bg.style.setProperty('background-color', data.color, 'important');
!bg.parentNode && el.appendChild(bg); if (!bg.parentNode) el.appendChild(bg);
} }
if (lineCacheAlive) { if (lineCacheAlive) {
@ -450,6 +450,7 @@
} }
openPopup(color) { openPopup(color) {
// eslint-disable-next-line prefer-const
let {line, ch} = this.cm.getCursor(); let {line, ch} = this.cm.getCursor();
const lineText = this.cm.getLine(line); const lineText = this.cm.getLine(line);
const lineTextLC = lineText.toLowerCase(); const lineTextLC = lineText.toLowerCase();