resolve.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import type { Rule } from 'eslint';
  2. import type ModuleCache from './ModuleCache';
  3. import type { ESLintSettings } from './types';
  4. export type ResultNotFound = { found: false, path?: undefined };
  5. export type ResultFound = { found: true, path: string | null };
  6. export type ResolvedResult = ResultNotFound | ResultFound;
  7. export type ResolverResolve = (modulePath: string, sourceFile:string, config: unknown) => ResolvedResult;
  8. export type ResolverResolveImport = (modulePath: string, sourceFile:string, config: unknown) => string | undefined;
  9. export type Resolver = { interfaceVersion?: 1 | 2, resolve: ResolverResolve, resolveImport: ResolverResolveImport };
  10. declare function resolve(
  11. p: string,
  12. context: Rule.RuleContext,
  13. ): ResolvedResult['path'];
  14. export default resolve;
  15. declare function fileExistsWithCaseSync(
  16. filepath: string | null,
  17. cacheSettings: ESLintSettings,
  18. strict: boolean
  19. ): boolean | ReturnType<typeof ModuleCache.prototype.get>;
  20. declare function relative(modulePath: string, sourceFile: string, settings: ESLintSettings): ResolvedResult['path'];
  21. export { fileExistsWithCaseSync, relative };