ModuleCache.d.ts 603 B

12345678910111213141516171819202122
  1. import type { ESLintSettings } from "./types";
  2. export type CacheKey = unknown;
  3. export type CacheObject = {
  4. result: unknown;
  5. lastSeen: ReturnType<typeof process.hrtime>;
  6. };
  7. declare class ModuleCache {
  8. map: Map<CacheKey, CacheObject>;
  9. constructor(map?: Map<CacheKey, CacheObject>);
  10. get<T>(cacheKey: CacheKey, settings: ESLintSettings): T | undefined;
  11. set<T>(cacheKey: CacheKey, result: T): T;
  12. static getSettings(settings: ESLintSettings): { lifetime: number } & Omit<ESLintSettings['import/cache'], 'lifetime'>;
  13. }
  14. export default ModuleCache;
  15. export type { ModuleCache }