From 3edea88b13bc83aa8824222166fb6d8a72d4a9f3 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Tue, 11 Dec 2018 06:40:54 -0600 Subject: [PATCH] Fix linting issues --- content/install-hook-userstyles.js | 2 +- edit/linter-meta.js | 2 +- edit/source-editor.js | 5 ++--- js/usercss.js | 2 +- popup/popup.js | 2 +- popup/search-results.js | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/content/install-hook-userstyles.js b/content/install-hook-userstyles.js index 2717abb4..76cf4ade 100644 --- a/content/install-hook-userstyles.js +++ b/content/install-hook-userstyles.js @@ -341,7 +341,7 @@ // run in page context document.documentElement.appendChild(document.createElement('script')).text = '(' + ( - EXTENSION_ORIGIN => { + () => { document.currentScript.remove(); // spoof Stylish extension presence in Chrome diff --git a/edit/linter-meta.js b/edit/linter-meta.js index bd146a52..0307f0e3 100644 --- a/edit/linter-meta.js +++ b/edit/linter-meta.js @@ -12,7 +12,7 @@ function createMetaCompiler(cm) { if (_cm !== cm) { return; } - const match = text.match(/\/\*\!?\s*==userstyle==[\s\S]*?==\/userstyle==\s*\*\//i); + const match = text.match(/\/\*!?\s*==userstyle==[\s\S]*?==\/userstyle==\s*\*\//i); if (!match) { return []; } diff --git a/edit/source-editor.js b/edit/source-editor.js index afa7daf5..7119cfa5 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -245,10 +245,9 @@ function createSourceEditor({style, onTitleChanged}) { .then(saved => saved !== code && messageBox.alert(t('syncStorageErrorSaving')))); return; } + contents[0] += ` (line ${pos.line + 1} col ${pos.ch + 1})`; + contents.push($create('pre', meta)); } - - contents[0] += ` (line ${pos.line + 1} col ${pos.ch + 1})`; - contents.push($create('pre', meta)); messageBox.alert(contents, 'pre'); }); } diff --git a/js/usercss.js b/js/usercss.js index 03e37c18..360743c0 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -10,7 +10,7 @@ const usercss = (() => { // updateURL: 'updateUrl', name: undefined, }; - const RX_META = /\/\*\!?\s*==userstyle==[\s\S]*?==\/userstyle==\s*\*\//i; + const RX_META = /\/\*!?\s*==userstyle==[\s\S]*?==\/userstyle==\s*\*\//i; const ERR_ARGS_IS_LIST = new Set(['missingMandatory', 'missingChar']); return {buildMeta, buildCode, assignVars}; diff --git a/popup/popup.js b/popup/popup.js index c771a557..a409e4c0 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -144,7 +144,7 @@ function initPopup() { info.appendChild(noteNode); } // Inaccessible locally hosted file type, e.g. JSON, PDF, etc. - if (tabURL.length - tabURL.lastIndexOf(".") <= 5) { + if (tabURL.length - tabURL.lastIndexOf('.') <= 5) { info.appendChild($create('p', t('InaccessibleFileHint'))); } document.body.classList.add('unreachable'); diff --git a/popup/search-results.js b/popup/search-results.js index 28da44af..d0a47793 100755 --- a/popup/search-results.js +++ b/popup/search-results.js @@ -1,6 +1,6 @@ /* global tabURL handleEvent $ $$ prefs template FIREFOX chromeLocal debounce $create t API tWordBreak formatDate tryCatch tryJSONparse LZString - ignoreChromeError */ + ignoreChromeError download */ 'use strict'; window.addEventListener('showStyles:done', function _() {