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