From 04e61b72088ffc796e6dacf57eb2ce03933df302 Mon Sep 17 00:00:00 2001 From: Harvmaster Date: Mon, 10 Aug 2026 04:02:41 +0000 Subject: [PATCH] formatting --- source/exponential-backoff.ts | 7 ++++--- test/exponential-backoff.test.ts | 10 ++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/exponential-backoff.ts b/source/exponential-backoff.ts index 57a4ee2..0236df9 100644 --- a/source/exponential-backoff.ts +++ b/source/exponential-backoff.ts @@ -267,17 +267,18 @@ export class ExponentialBackoff { // Wait for the delay or the abort signal await new Promise((resolve, reject) => { // Set a timeout to resolve the promise after the delay + // eslint-disable-next-line prefer-const let timeout: ReturnType; // Handle the abort signal - const abortHandler = () => { + const abortHandler = (): void => { clearTimeout(timeout); abortController.signal.removeEventListener('abort', abortHandler); reject(new ExponentialBackoffStoppedRetriesError(abortController.signal.reason)); }; // Handle the timeout - const timeoutHandler = () => { + const timeoutHandler = (): void => { abortController.signal.removeEventListener('abort', abortHandler); resolve(undefined); }; @@ -287,7 +288,7 @@ export class ExponentialBackoff { // Add the abort handler to the abort signal abortController.signal.addEventListener('abort', abortHandler); - }) + }); attempt++; } diff --git a/test/exponential-backoff.test.ts b/test/exponential-backoff.test.ts index aa4494b..11dab60 100644 --- a/test/exponential-backoff.test.ts +++ b/test/exponential-backoff.test.ts @@ -308,7 +308,7 @@ const testExponentialBackoffRunDelayAbortedWhenAbortSignal = async (): Promise void; - const taskFn = vi.fn(async ({ stopRetries }) => { + const taskFn = vi.fn(async ({ stopRetries }) => { abort = stopRetries; throw new Error('error message'); }); @@ -328,8 +328,7 @@ const testExponentialBackoffRunDelayAbortedWhenAbortSignal = async (): Promise { } }; - /** Tests that passing undefined into the constructor does not cause an error during spread */ const testExponentialBackoffConstructorDoesNotCauseErrorDuringSpread = async (): Promise => { const options = {