diff --git a/src/index.ts b/src/index.ts index 6bdd0f1f..99e4d917 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -// @ts-ignore +// @ts-expect-error import BottleneckLight from "bottleneck/light"; import { Octokit } from "@octokit/core"; import { OctokitOptions } from "@octokit/core/dist-types/types.d"; @@ -21,7 +21,7 @@ const triggersNotification = regex.test.bind(regex); const groups: Groups = {}; -// @ts-ignore +// @ts-expect-error const createGroups = function (Bottleneck, common) { groups.global = new Bottleneck.Group({ id: "octokit-global", @@ -109,7 +109,7 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) { const events = {}; const emitter = new Bottleneck.Events(events); - // @ts-ignore + // @ts-expect-error events.on( "secondary-limit", isUsingDeprecatedOnAbuseLimitHandler @@ -121,14 +121,14 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) { } : state.onSecondaryRateLimit ); - // @ts-ignore + // @ts-expect-error events.on("rate-limit", state.onRateLimit); - // @ts-ignore + // @ts-expect-error events.on("error", (e) => octokit.log.warn("Error in throttling-plugin limit handler", e) ); - // @ts-ignore + // @ts-expect-error state.retryLimiter.on("failed", async function (error, info) { const options = info.args[info.args.length - 1]; const { pathname } = new URL(options.url, "http://github.test"); @@ -189,7 +189,7 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) { if (wantRetry) { options.request.retryCount++; - // @ts-ignore + // @ts-expect-error return retryAfter * state.retryAfterBaseValue; } }); diff --git a/src/route-matcher.ts b/src/route-matcher.ts index 78dc3873..b44c79ae 100644 --- a/src/route-matcher.ts +++ b/src/route-matcher.ts @@ -1,4 +1,4 @@ -// @ts-ignore +// @ts-expect-error export function routeMatcher(paths) { // EXAMPLE. For the following paths: /* [ @@ -6,11 +6,11 @@ export function routeMatcher(paths) { "/repos/{owner}/{repo}/collaborators/{username}" ] */ - // @ts-ignore + // @ts-expect-error const regexes = paths.map((path) => path .split("/") - // @ts-ignore + // @ts-expect-error .map((c) => (c.startsWith("{") ? "(?:.+?)" : c)) .join("/") ); @@ -20,7 +20,7 @@ export function routeMatcher(paths) { '/repos/(?:.+?)/(?:.+?)/collaborators/(?:.+?)' ] */ - // @ts-ignore + // @ts-expect-error const regex = `^(?:${regexes.map((r) => `(?:${r})`).join("|")})[^/]*$`; // 'regex' would contain: /* diff --git a/src/wrap-request.ts b/src/wrap-request.ts index 0421bb84..5de3d2f2 100644 --- a/src/wrap-request.ts +++ b/src/wrap-request.ts @@ -1,11 +1,11 @@ const noop = () => Promise.resolve(); -// @ts-ignore +// @ts-expect-error export function wrapRequest(state, request, options) { return state.retryLimiter.schedule(doRequest, state, request, options); } -// @ts-ignore +// @ts-expect-error async function doRequest(state, request, options) { const isWrite = options.method !== "GET" && options.method !== "HEAD"; const { pathname } = new URL(options.url, "http://github.test"); @@ -17,7 +17,7 @@ async function doRequest(state, request, options) { if (state.clustering) { // Remove a job from Redis if it has not completed or failed within 60s // Examples: Node process terminated, client disconnected, etc. - // @ts-ignore + // @ts-expect-error jobOptions.expiration = 1000 * 60; } @@ -43,7 +43,7 @@ async function doRequest(state, request, options) { if ( res.data.errors != null && - // @ts-ignore + // @ts-expect-error res.data.errors.some((error) => error.type === "RATE_LIMITED") ) { const error = Object.assign(new Error("GraphQL Rate Limit Exceeded"), {