diff --git a/cache-item.ts b/cache-item.ts index 2c345cb..55d89c6 100644 --- a/cache-item.ts +++ b/cache-item.ts @@ -22,11 +22,11 @@ export default class CacheItem< Updater extends ((...args: unknown[]) => Promise) = ((...args: unknown[]) => Promise), Arguments extends unknown[] = Parameters, > { + readonly maxAge: TimeDescriptor; + readonly staleWhileRevalidate: TimeDescriptor; #cacheKey: CacheKey; #updater: Updater | undefined; #shouldRevalidate: ((cachedValue: ScopedValue) => boolean) | undefined; - readonly maxAge: TimeDescriptor; - readonly staleWhileRevalidate: TimeDescriptor; constructor( public name: string, diff --git a/index.ts b/index.ts index 2bd2578..771b3cc 100644 --- a/index.ts +++ b/index.ts @@ -80,6 +80,7 @@ async function set( throw new TypeError('Expected a value as the second argument'); } + // eslint-disable-next-line unicorn/no-typeof-undefined -- TODO if (typeof value === 'undefined') { await delete_(key); } else { @@ -106,6 +107,7 @@ async function deleteWithLogic( const wholeCache = (await chromeP.storage.local.get()) as Record; const removableItems: string[] = []; for (const [key, value] of Object.entries(wholeCache)) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument if (key.startsWith('cache:') && (logic?.(value) ?? true)) { removableItems.push(key); } @@ -177,6 +179,7 @@ function function_< return cachedItem.data; }; + // eslint-disable-next-line @typescript-eslint/promise-function-async -- TODO function memoizePending(...args: Arguments) { const userKey = getUserKey(name, cacheKey, args); if (inFlightCache.has(userKey)) { diff --git a/package.json b/package.json index 0d09aef..93628fe 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,6 @@ "sinon-chrome": "^3.0.1", "tsd": "^0.25.0", "typescript": "^4.9.5", - "xo": "^0.53.1" + "xo": "^0.54.2" } }