Skip to content

Commit bc7bc31

Browse files
committed
refactor: fix newly generated eslint errors
1 parent 1d3da71 commit bc7bc31

6 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/ext/background/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ async function addContextMenuItem(userscript) {
244244
patterns[index] = `${url.protocol}//${url.hostname}${pathname}`;
245245
} catch (error) {
246246
// prevent breaking when non-url pattern present
247+
console.error(error);
247248
}
248249
});
249250

@@ -345,7 +346,7 @@ async function handleMessage(request, sender, sendResponse) {
345346
// if tabData is null, can still parse it and return that
346347
tab = JSON.parse(tabData);
347348
} catch (error) {
348-
console.error("failed to parse tab data for getTab");
349+
console.error("failed to parse tab data for getTab", error);
349350
}
350351
} else {
351352
console.error("unable to deliver tab due to empty tab id");

src/ext/content-scripts/entry-userscripts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ function injectJS(userscript) {
7474
(document.body ?? document.head ?? document.documentElement).append(div);
7575
} else {
7676
try {
77-
// eslint-disable-next-line no-new-func
78-
return Function(
77+
Function(
7978
`{${Object.keys(userscript.apis).join(",")}}`,
8079
code,
8180
)(userscript.apis);
8281
} catch (error) {
8382
console.error(`"${filename}" error:`, error);
8483
}
84+
return;
8585
}
8686
}
8787

src/ext/extension-page/App.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
1515
$: $log.some((item) => {
1616
if (!logger.includes(item)) {
17-
// eslint-disable-next-line no-console -- not arbitrary console command
1817
console[item.type](item.message);
1918
logger.push(item);
2019
}

src/ext/extension-page/Appios.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
1515
$: $log.some((item) => {
1616
if (!logger.includes(item)) {
17-
// eslint-disable-next-line no-console -- not arbitrary console command
1817
console[item.type](item.message);
1918
logger.push(item);
2019
}

src/ext/shared/dev/DEMO.Alert-URL.user.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// @run-at document-start
1010
// ==/UserScript==
1111

12-
/* eslint-disable */
1312
(function () {
1413
"use strict";
1514
alert("DEBUG.Alert-URL:\n\n" + location);

src/ext/shared/settings.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ export async function get(keys = undefined, options = {}) {
331331
settingsDictionary[key].default;
332332
// check if value type conforms to settings-dictionary
333333
const type = settingsDictionary[key].type;
334-
// eslint-disable-next-line valid-typeof -- type known to be valid string literal
335334
if (typeof val != type) {
336335
console.warn(
337336
`Unexpected ${key} value type '${typeof val}' should '${type}', fix to default`,
@@ -459,7 +458,6 @@ export async function set(keys, options = {}) {
459458
}
460459
// check if value type conforms to settings-dictionary
461460
const type = settingsDictionary[key].type;
462-
// eslint-disable-next-line valid-typeof -- type known to be valid string literal
463461
if (typeof keys[k] != type) {
464462
if (type === "number" && !Number.isNaN(Number(keys[k]))) {
465463
// compatible with string numbers

0 commit comments

Comments
 (0)