1
1
import type { AST } from "svelte-eslint-parser"
2
- import type { Scope } from "eslint"
3
2
import 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"
4
5
export {
5
6
ReferenceTracker ,
6
7
TrackedReferences ,
@@ -32,7 +33,7 @@ export function isNotClosingBraceToken(token: Token): boolean
32
33
export function isNotCommentToken ( token : Token ) : boolean
33
34
34
35
export function findVariable (
35
- initialScope : Scope . Scope ,
36
+ initialScope : Scope ,
36
37
nameOrNode : TSESTree . Identifier | string ,
37
38
) : Scope . Variable
38
39
@@ -45,5 +46,46 @@ export function getPropertyName(
45
46
| TSESTree . MethodDefinition
46
47
| TSESTree . Property
47
48
| TSESTree . PropertyDefinition ,
48
- initialScope ?: Scope . Scope ,
49
+ initialScope ?: Scope ,
49
50
) : 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