1 import { TSESTree } from '../../ts-estree';
2 import * as TSESLint from '../../ts-eslint';
3 declare const ReferenceTrackerREAD: unique symbol;
4 declare const ReferenceTrackerCALL: unique symbol;
5 declare const ReferenceTrackerCONSTRUCT: unique symbol;
6 interface ReferenceTracker {
8 * Iterate the references that the given `traceMap` determined.
9 * This method starts to search from global variables.
11 * @see {@link https://eslint-utils.mysticatea.dev/api/scope-utils.html#tracker-iterateglobalreferences}
13 iterateGlobalReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
15 * Iterate the references that the given `traceMap` determined.
16 * This method starts to search from `require()` expression.
18 * @see {@link https://eslint-utils.mysticatea.dev/api/scope-utils.html#tracker-iteratecjsreferences}
20 iterateCjsReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
22 * Iterate the references that the given `traceMap` determined.
23 * This method starts to search from `import`/`export` declarations.
25 * @see {@link https://eslint-utils.mysticatea.dev/api/scope-utils.html#tracker-iterateesmreferences}
27 iterateEsmReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
29 interface ReferenceTrackerStatic {
30 new (globalScope: TSESLint.Scope.Scope, options?: {
32 * The mode which determines how the `tracker.iterateEsmReferences()` method scans CommonJS modules.
33 * If this is `"strict"`, the method binds CommonJS modules to the default export. Otherwise, the method binds
34 * CommonJS modules to both the default export and named exports. Optional. Default is `"strict"`.
36 mode: 'strict' | 'legacy';
38 * The name list of Global Object. Optional. Default is `["global", "globalThis", "self", "window"]`.
40 globalObjectNames: readonly string[];
42 readonly READ: typeof ReferenceTrackerREAD;
43 readonly CALL: typeof ReferenceTrackerCALL;
44 readonly CONSTRUCT: typeof ReferenceTrackerCONSTRUCT;
46 declare namespace ReferenceTracker {
47 type READ = ReferenceTrackerStatic['READ'];
48 type CALL = ReferenceTrackerStatic['CALL'];
49 type CONSTRUCT = ReferenceTrackerStatic['CONSTRUCT'];
50 type ReferenceType = READ | CALL | CONSTRUCT;
51 type TraceMap<T = any> = Record<string, TraceMapElement<T>>;
52 interface TraceMapElement<T> {
53 [ReferenceTrackerREAD]?: T;
54 [ReferenceTrackerCALL]?: T;
55 [ReferenceTrackerCONSTRUCT]?: T;
56 [key: string]: TraceMapElement<T>;
58 interface FoundReference<T = any> {
60 path: readonly string[];
66 * The tracker for references. This provides reference tracking for global variables, CommonJS modules, and ES modules.
68 * @see {@link https://eslint-utils.mysticatea.dev/api/scope-utils.html#referencetracker-class}
70 declare const ReferenceTracker: ReferenceTrackerStatic;
71 export { ReferenceTracker };
72 //# sourceMappingURL=ReferenceTracker.d.ts.map