diff --git a/bin/dev.ts b/bin/dev.ts index 47ce89b7..a54dd55d 100644 --- a/bin/dev.ts +++ b/bin/dev.ts @@ -8,7 +8,7 @@ import chalk from "chalk"; import { copyToClipboardPlugin } from "../copyToClipboardRollupPlugin.js"; import { userscriptMetaPlugin } from "../src/userscripts/meta/rollupPlugin.js"; -(async () => { +(() => { const watchedFiles: Set = new Set([]); const chokidarWatcher = chokidar @@ -47,7 +47,7 @@ import { userscriptMetaPlugin } from "../src/userscripts/meta/rollupPlugin.js"; console.error(event.error); } - if (event && "result" in event && event.result) { + if ("result" in event && event.result) { event.result.close(); } }); diff --git a/bin/docgen.ts b/bin/docgen.ts index 6f717f30..8e073f0f 100644 --- a/bin/docgen.ts +++ b/bin/docgen.ts @@ -18,10 +18,10 @@ type FileProperties = { type FileKind = "script" | "style"; -const getFiles = async (): Promise<{ +const getFiles = (): { scripts: string[]; styles: string[]; -}> => { +} => { try { return { scripts: pipe( @@ -111,7 +111,7 @@ const getFilesProperties = async ({ return pipe( await Promise.all( files.map(async (file) => { - return await parseFileComment({ filepath: file, kind }); + return parseFileComment({ filepath: file, kind }); }), ), A.compact, @@ -152,7 +152,7 @@ const updateReadme = async (scriptsMarkdown: string): Promise => { // (async () => { - const { scripts, styles } = await getFiles(); + const { scripts, styles } = getFiles(); const scriptFileProperties = await getFilesProperties({ files: scripts, diff --git a/eslint.config.js b/eslint.config.js index a78aeace..b2f2783c 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -49,6 +49,7 @@ const config = [ "@typescript-eslint/naming-convention": "off", "consistent-return": "off", "id-length": "off", + "import/extensions": "off", "no-alert": "off", "no-console": "off", "no-nested-ternary": "off", diff --git a/src/userscripts/copy-lyrics.user.ts b/src/userscripts/copy-lyrics.user.ts index 29ca8701..274236dd 100644 --- a/src/userscripts/copy-lyrics.user.ts +++ b/src/userscripts/copy-lyrics.user.ts @@ -56,9 +56,10 @@ const lineMusic = () => { }; // -(async () => { +(() => { const url = window.location.href; + // eslint-disable-next-line @typescript-eslint/no-misused-promises document.addEventListener("keydown", async (e) => { if (e.ctrlKey && e.key === "Enter") { if (url.startsWith("https://www.google.com/search")) { diff --git a/src/userscripts/slack-no-autofocus.user.ts b/src/userscripts/slack-no-autofocus.user.ts index 16d1836b..93039adf 100644 --- a/src/userscripts/slack-no-autofocus.user.ts +++ b/src/userscripts/slack-no-autofocus.user.ts @@ -1,4 +1,4 @@ -void (async () => { +void (() => { let curTitle = ""; new MutationObserver(() => { diff --git a/src/userscripts/tweetdeck-shortcuts.user.ts b/src/userscripts/tweetdeck-shortcuts.user.ts index e70a5eb8..e42de87e 100644 --- a/src/userscripts/tweetdeck-shortcuts.user.ts +++ b/src/userscripts/tweetdeck-shortcuts.user.ts @@ -14,9 +14,12 @@ const config = {}; } if ( - e.key === "l" || // default Like - e.key === "u" || // default Mute - e.key === "x" // default Block + // default Like + e.key === "l" || + // default Mute + e.key === "u" || + // default Block + e.key === "x" ) { e.stopImmediatePropagation(); } @@ -42,7 +45,8 @@ const config = {}; if (e.key === "f") { document.dispatchEvent( new KeyboardEvent("keypress", { - keyCode: 76, // `l` + // `l` + keyCode: 76, }), ); } diff --git a/src/userscripts/twitter-shortcuts.user.ts b/src/userscripts/twitter-shortcuts.user.ts index 2dd0d772..ecb8947d 100644 --- a/src/userscripts/twitter-shortcuts.user.ts +++ b/src/userscripts/twitter-shortcuts.user.ts @@ -30,8 +30,10 @@ const findTweetInCenter = () => { if (isTyping()) return; if ( - e.key === "u" || // default Mute - e.key === "x" // default Block + // default Mute + e.key === "u" || + // default Block + e.key === "x" ) { e.stopImmediatePropagation(); } diff --git a/src/userscripts/utils/enableSelection.ts b/src/userscripts/utils/enableSelection.ts index b304d9b6..88227066 100644 --- a/src/userscripts/utils/enableSelection.ts +++ b/src/userscripts/utils/enableSelection.ts @@ -2,6 +2,7 @@ export const enableSelection = () => { const a = document.body; const b = a.parentNode; if (b) { - b.removeChild(a), b.appendChild(a.cloneNode(!0)); + b.removeChild(a); + b.appendChild(a.cloneNode(!0)); } }; diff --git a/tsconfig.json b/tsconfig.json index 7095b4b6..560f74f0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,9 +5,10 @@ "module": "es2020", "moduleResolution": "node", "noEmit": true, + "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "strict": true, + "noUncheckedIndexedAccess": true, "skipLibCheck": true, "types": ["vitest/globals"] }