UNPKG

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