diff options
Diffstat (limited to 'source/libs')
-rw-r--r-- | source/libs/features.tsx | 4 | ||||
-rw-r--r-- | source/libs/get-default-branch.ts | 6 | ||||
-rw-r--r-- | source/libs/get-text-nodes.ts | 2 | ||||
-rw-r--r-- | source/libs/on-new-comments.ts | 1 | ||||
-rw-r--r-- | source/libs/post-form.ts | 2 |
5 files changed, 7 insertions, 8 deletions
diff --git a/source/libs/features.tsx b/source/libs/features.tsx index b3205bd4..a84c5b17 100644 --- a/source/libs/features.tsx +++ b/source/libs/features.tsx @@ -170,12 +170,12 @@ const add = async (definition: FeatureDetails): Promise<void> => { return result; }; - onAjaxedPages(async () => run(details)); + onAjaxedPages(() => run(details)); } else if (load instanceof Promise) { await load; run(details); } else { - load(async () => run(details)); + load(() => run(details)); } }; diff --git a/source/libs/get-default-branch.ts b/source/libs/get-default-branch.ts index c55eb66e..bae7c86c 100644 --- a/source/libs/get-default-branch.ts +++ b/source/libs/get-default-branch.ts @@ -26,11 +26,9 @@ function parseBranchFromDom(): string | undefined { return matches ? matches[1] : undefined; } -async function fetchFromApi(): Promise<any> { +async function fetchFromApi(): Promise<string> { const response = await api.v3(`repos/${getRepoURL()}`); - if (response.default_branch) { - return response.default_branch; - } + return response.default_branch as string; } export default async function (): Promise<string> { diff --git a/source/libs/get-text-nodes.ts b/source/libs/get-text-nodes.ts index 30bf9722..e8cee915 100644 --- a/source/libs/get-text-nodes.ts +++ b/source/libs/get-text-nodes.ts @@ -1,4 +1,4 @@ -export default (el: Node) => { +export default (el: Node): Text[] => { const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT); const nodes: Text[] = []; let node: Text; diff --git a/source/libs/on-new-comments.ts b/source/libs/on-new-comments.ts index 43fd224a..2ddc5aae 100644 --- a/source/libs/on-new-comments.ts +++ b/source/libs/on-new-comments.ts @@ -7,6 +7,7 @@ const observed = new WeakSet(); const run = debounce(() => { // Safely run all callbacks + // eslint-disable-next-line @typescript-eslint/require-await handlers.forEach(async cb => cb()); }, {wait: 200}); diff --git a/source/libs/post-form.ts b/source/libs/post-form.ts index ad8f5851..ccee33f4 100644 --- a/source/libs/post-form.ts +++ b/source/libs/post-form.ts @@ -6,7 +6,7 @@ export default async function postForm(form: HTMLFormElement): Promise<Response> const contentFetch = typeof window.content === 'object' ? window.content.fetch : window.fetch; const response = await contentFetch(form.action, { - // `as` required until https://github.com/microsoft/TSJS-lib-generator/issues/741 + // TODO: drop `as` after https://github.com/microsoft/TSJS-lib-generator/issues/741 body: new URLSearchParams(new FormData(form) as URLSearchParams), method: 'POST', headers: { |