Skip to content

Commit

Permalink
refactor: fix newly generated eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ACTCD committed Apr 13, 2024
1 parent 1d3da71 commit bc7bc31
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/ext/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ async function addContextMenuItem(userscript) {
patterns[index] = `${url.protocol}//${url.hostname}${pathname}`;
} catch (error) {
// prevent breaking when non-url pattern present
console.error(error);
}
});

Expand Down Expand Up @@ -345,7 +346,7 @@ async function handleMessage(request, sender, sendResponse) {
// if tabData is null, can still parse it and return that
tab = JSON.parse(tabData);
} catch (error) {
console.error("failed to parse tab data for getTab");
console.error("failed to parse tab data for getTab", error);
}
} else {
console.error("unable to deliver tab due to empty tab id");
Expand Down
4 changes: 2 additions & 2 deletions src/ext/content-scripts/entry-userscripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ function injectJS(userscript) {
(document.body ?? document.head ?? document.documentElement).append(div);
} else {
try {
// eslint-disable-next-line no-new-func
return Function(
Function(
`{${Object.keys(userscript.apis).join(",")}}`,
code,
)(userscript.apis);
} catch (error) {
console.error(`"${filename}" error:`, error);
}
return;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/ext/extension-page/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
$: $log.some((item) => {
if (!logger.includes(item)) {
// eslint-disable-next-line no-console -- not arbitrary console command
console[item.type](item.message);
logger.push(item);
}
Expand Down
1 change: 0 additions & 1 deletion src/ext/extension-page/Appios.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
$: $log.some((item) => {
if (!logger.includes(item)) {
// eslint-disable-next-line no-console -- not arbitrary console command
console[item.type](item.message);
logger.push(item);
}
Expand Down
1 change: 0 additions & 1 deletion src/ext/shared/dev/DEMO.Alert-URL.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// @run-at document-start
// ==/UserScript==

/* eslint-disable */
(function () {
"use strict";
alert("DEBUG.Alert-URL:\n\n" + location);
Expand Down
2 changes: 0 additions & 2 deletions src/ext/shared/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ export async function get(keys = undefined, options = {}) {
settingsDictionary[key].default;
// check if value type conforms to settings-dictionary
const type = settingsDictionary[key].type;
// eslint-disable-next-line valid-typeof -- type known to be valid string literal
if (typeof val != type) {
console.warn(
`Unexpected ${key} value type '${typeof val}' should '${type}', fix to default`,
Expand Down Expand Up @@ -459,7 +458,6 @@ export async function set(keys, options = {}) {
}
// check if value type conforms to settings-dictionary
const type = settingsDictionary[key].type;
// eslint-disable-next-line valid-typeof -- type known to be valid string literal
if (typeof keys[k] != type) {
if (type === "number" && !Number.isNaN(Number(keys[k]))) {
// compatible with string numbers
Expand Down

0 comments on commit bc7bc31

Please sign in to comment.