UNPKG

2.49 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/eslint-scope`
3
4# Summary
5This package contains type definitions for eslint-scope (https://github.com/eslint/eslint-scope).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint-scope.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint-scope/index.d.ts)
10````ts
11import * as eslint from "eslint";
12import * as estree from "estree";
13
14export const version: string;
15
16export class ScopeManager implements eslint.Scope.ScopeManager {
17 scopes: Scope[];
18 globalScope: Scope;
19 acquire(node: {}, inner?: boolean): Scope | null;
20 getDeclaredVariables(node: {}): Variable[];
21}
22
23export class Scope implements eslint.Scope.Scope {
24 type:
25 | "block"
26 | "catch"
27 | "class"
28 | "for"
29 | "function"
30 | "function-expression-name"
31 | "global"
32 | "module"
33 | "switch"
34 | "with"
35 | "TDZ";
36 isStrict: boolean;
37 upper: Scope | null;
38 childScopes: Scope[];
39 variableScope: Scope;
40 block: estree.Node;
41 variables: Variable[];
42 set: Map<string, Variable>;
43 references: Reference[];
44 through: Reference[];
45 functionExpressionScope: boolean;
46}
47
48export class Variable implements eslint.Scope.Variable {
49 name: string;
50 scope: Scope;
51 identifiers: estree.Identifier[];
52 references: Reference[];
53 defs: eslint.Scope.Definition[];
54}
55
56export class Reference implements eslint.Scope.Reference {
57 identifier: estree.Identifier;
58 from: Scope;
59 resolved: Variable | null;
60 writeExpr: estree.Node | null;
61 init: boolean;
62
63 isWrite(): boolean;
64 isRead(): boolean;
65 isWriteOnly(): boolean;
66 isReadOnly(): boolean;
67 isReadWrite(): boolean;
68}
69
70export interface AnalysisOptions {
71 optimistic?: boolean;
72 directive?: boolean;
73 ignoreEval?: boolean;
74 nodejsScope?: boolean;
75 impliedStrict?: boolean;
76 fallback?: string | ((node: {}) => string[]);
77 sourceType?: "script" | "module";
78 ecmaVersion?: number;
79}
80
81export function analyze(ast: {}, options?: AnalysisOptions): ScopeManager;
82
83````
84
85### Additional Details
86 * Last updated: Mon, 06 Nov 2023 22:41:05 GMT
87 * Dependencies: [@types/eslint](https://npmjs.com/package/@types/eslint), [@types/estree](https://npmjs.com/package/@types/estree)
88
89# Credits
90These definitions were written by [Toru Nagashima](https://github.com/mysticatea).
91
\No newline at end of file