From 9c535d27e6397a1f0a5c457f3a7768bf18edb718 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Fri, 2 Dec 2022 18:57:04 -0800 Subject: [PATCH] manually fix remaining lint errors --- .eslintrc.js | 4 ++++ extension/background.js | 2 ++ extension/popup.js | 8 +++----- extension/script.js | 10 ++++++---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1c044e1..72398fc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,6 +7,10 @@ module.exports = { env: { browser: true, }, + globals: { + browser: 'readonly', + chrome: 'readonly', + }, rules: { strict: ['error', 'global'], 'no-unused-vars': ['error', { vars: 'local' }], diff --git a/extension/background.js b/extension/background.js index 7aede90..745d6ef 100644 --- a/extension/background.js +++ b/extension/background.js @@ -2,6 +2,8 @@ extension background script listening for events */ +'use strict'; + console.log('running background.js'); let browserType = getBrowser(); diff --git a/extension/popup.js b/extension/popup.js index 1e59401..9e591d5 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -2,6 +2,8 @@ Loaded into popup index.html */ +'use strict'; + let browserType = getBrowser(); // boilerplate to dedect browser type api @@ -124,7 +126,7 @@ function setCookieState() { // change status icon based on connection status function setStatusIcon(connected) { let statusIcon = document.getElementById('status-icon'); - if (connected == true) { + if (connected) { statusIcon.innerHTML = '☑'; statusIcon.style.color = 'green'; } else { @@ -161,10 +163,6 @@ document.addEventListener('DOMContentLoaded', async () => { setCookieState(); } - function onError(error) { - console.log(`Error: ${error}`); - } - browserType.storage.local.get('access', function (result) { onGot(result); }); diff --git a/extension/script.js b/extension/script.js index 756429c..9f58ce7 100644 --- a/extension/script.js +++ b/extension/script.js @@ -2,6 +2,8 @@ content script running on youtube.com */ +'use strict'; + let browserType = getBrowser(); // boilerplate to dedect browser type api @@ -129,7 +131,7 @@ function buildSubLink(channelContainer) { }); subLink.addEventListener('mouseover', e => { let subText; - if (window.location.pathname == '/watch') { + if (window.location.pathname === '/watch') { let currentLocation = window.location.href; subText = currentLocation; } else { @@ -165,7 +167,7 @@ function buildDlLink(channelContainer) { }); dlLink.addEventListener('mouseover', e => { let subText; - if (window.location.pathname == '/watch') { + if (window.location.pathname === '/watch') { let currentLocation = window.location.href; subText = currentLocation; } else { @@ -231,7 +233,7 @@ function buildVideoButton(thumbContainer) { let videoTitle = thumbContainer.href; e.target.title = 'TA download: ' + videoTitle; }); - dlButton.addEventListener('mouseout', e => { + dlButton.addEventListener('mouseout', () => { Object.assign(dlButton.style, { opacity: 0, }); @@ -321,7 +323,7 @@ function buttonError(button) { buttonSpan.style.color = 'red'; button.style.opacity = 1; - button.addEventListener('mouseout', e => { + button.addEventListener('mouseout', () => { Object.assign(button.style, { opacity: 1, });