11import type { AST } from "svelte-eslint-parser"
2- import type { Scope } from "eslint"
32import type { TSESTree } from "@typescript-eslint/types"
3+ import type { Scope } from "@typescript-eslint/scope-manager"
4+ import type { CALL , CONSTRUCT , ESM , READ } from "eslint-utils/referenceTracker"
45export {
56 ReferenceTracker ,
67 TrackedReferences ,
@@ -32,7 +33,7 @@ export function isNotClosingBraceToken(token: Token): boolean
3233export function isNotCommentToken ( token : Token ) : boolean
3334
3435export function findVariable (
35- initialScope : Scope . Scope ,
36+ initialScope : Scope ,
3637 nameOrNode : TSESTree . Identifier | string ,
3738) : Scope . Variable
3839
@@ -45,5 +46,46 @@ export function getPropertyName(
4546 | TSESTree . MethodDefinition
4647 | TSESTree . Property
4748 | TSESTree . PropertyDefinition ,
48- initialScope ?: Scope . Scope ,
49+ initialScope ?: Scope ,
4950) : string | null
51+
52+ /**
53+ * Get the innermost scope which contains a given location.
54+ */
55+ export function getInnermostScope (
56+ initialScope : Scope ,
57+ node : TSESTree . Node ,
58+ ) : Scope
59+
60+ export class ReferenceTracker {
61+ public static readonly CALL : typeof CALL
62+
63+ public static readonly CONSTRUCT : typeof CONSTRUCT
64+
65+ public static readonly ESM : typeof ESM
66+
67+ public static readonly READ : typeof READ
68+
69+ public constructor ( globalScope : Scope , options ?: ReferenceTrackerOptions )
70+
71+ /**
72+ * Iterate the references of CommonJS modules.
73+ */
74+ public iterateCjsReferences < T = unknown > (
75+ traceMap : TraceMap < T > ,
76+ ) : IterableIterator < TrackedReferences < T > >
77+
78+ /**
79+ * Iterate the references of ES modules.
80+ */
81+ public iterateEsmReferences < T = unknown > (
82+ traceMap : TraceMap < T > ,
83+ ) : IterableIterator < TrackedReferences < T > >
84+
85+ /**
86+ * Iterate the references of global variables.
87+ */
88+ public iterateGlobalReferences < T = unknown > (
89+ traceMap : TraceMap < T > ,
90+ ) : IterableIterator < TrackedReferences < T > >
91+ }
0 commit comments