UNPKG

1.76 kBTypeScriptView Raw
1import * as eslint from "eslint";
2import * as estree from "estree";
3
4export const version: string;
5
6export class ScopeManager implements eslint.Scope.ScopeManager {
7 scopes: Scope[];
8 globalScope: Scope;
9 acquire(node: {}, inner?: boolean): Scope | null;
10 getDeclaredVariables(node: {}): Variable[];
11}
12
13export class Scope implements eslint.Scope.Scope {
14 type:
15 | "block"
16 | "catch"
17 | "class"
18 | "for"
19 | "function"
20 | "function-expression-name"
21 | "global"
22 | "module"
23 | "switch"
24 | "with"
25 | "TDZ";
26 isStrict: boolean;
27 upper: Scope | null;
28 childScopes: Scope[];
29 variableScope: Scope;
30 block: estree.Node;
31 variables: Variable[];
32 set: Map<string, Variable>;
33 references: Reference[];
34 through: Reference[];
35 functionExpressionScope: boolean;
36}
37
38export class Variable implements eslint.Scope.Variable {
39 name: string;
40 scope: Scope;
41 identifiers: estree.Identifier[];
42 references: Reference[];
43 defs: eslint.Scope.Definition[];
44}
45
46export class Reference implements eslint.Scope.Reference {
47 identifier: estree.Identifier;
48 from: Scope;
49 resolved: Variable | null;
50 writeExpr: estree.Node | null;
51 init: boolean;
52
53 isWrite(): boolean;
54 isRead(): boolean;
55 isWriteOnly(): boolean;
56 isReadOnly(): boolean;
57 isReadWrite(): boolean;
58}
59
60export interface AnalysisOptions {
61 optimistic?: boolean;
62 directive?: boolean;
63 ignoreEval?: boolean;
64 nodejsScope?: boolean;
65 impliedStrict?: boolean;
66 fallback?: string | ((node: {}) => string[]);
67 sourceType?: "script" | "module";
68 ecmaVersion?: number;
69}
70
71export function analyze(ast: {}, options?: AnalysisOptions): ScopeManager;
72
\No newline at end of file