xo 0.52.2 → 0.52.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/options-manager.js +4 -3
- package/node_modules/@typescript-eslint/eslint-plugin/README.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js +5 -5
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js +68 -164
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-union-intersection-members.js +9 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-union-intersection-members.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-before-blocks.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-before-blocks.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-before-function-paren.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-before-function-paren.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/type-annotation-spacing.js +3 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/type-annotation-spacing.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unbound-method.js +2 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unbound-method.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js +3 -3
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +1 -11
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +5 -5
- package/node_modules/@typescript-eslint/parser/README.md +1 -1
- package/node_modules/@typescript-eslint/parser/_ts3.4/dist/index.d.ts +4 -0
- package/node_modules/@typescript-eslint/parser/_ts3.4/dist/parser.d.ts +20 -0
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/README.md +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.iterable.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.iterable.js +0 -3
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.iterable.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.js +8 -23
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2020.intl.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2020.intl.js +2 -3
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2020.intl.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.intl.d.ts +3 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.intl.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.intl.js +12 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.intl.js.map +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.js +3 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.sharedmemory.d.ts +3 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.sharedmemory.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.sharedmemory.js +12 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2022.sharedmemory.js.map +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.d.ts +2 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.js +4 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.js +7 -6
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/containsAllTypesByName.d.ts +8 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getConstrainedTypeAtLocation.d.ts +6 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getContextualType.d.ts +8 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getDeclaration.d.ts +6 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getSourceFileOfNode.d.ts +6 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getTokenAtPosition.d.ts +3 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getTypeArguments.d.ts +3 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getTypeName.d.ts +8 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/index.d.ts +16 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/isTypeReadonly.d.ts +20 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/isUnsafeAssignment.d.ts +17 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/predicates.d.ts +52 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/propertyTypes.d.ts +4 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/requiresQuoting.d.ts +4 -0
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/typeFlagUtils.d.ts +11 -0
- package/node_modules/@typescript-eslint/type-utils/dist/index.d.ts +1 -0
- package/node_modules/@typescript-eslint/type-utils/dist/index.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/type-utils/dist/index.js +5 -0
- package/node_modules/@typescript-eslint/type-utils/dist/index.js.map +1 -1
- package/node_modules/@typescript-eslint/type-utils/package.json +5 -4
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +1732 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/index.d.ts +5 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/lib.d.ts +3 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/parser-options.d.ts +36 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/ts-estree.d.ts +9 -0
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +2 -2
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/lib.d.ts +1 -1
- package/node_modules/@typescript-eslint/types/dist/lib.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/README.md +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +9 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert-comments.d.ts +11 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert.d.ts +159 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/WatchCompilerHostOfConfigFile.d.ts +13 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +12 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +9 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +11 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +5 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +19 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/getScriptKind.d.ts +5 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +22 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +13 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/getModifiers.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/index.d.ts +12 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/jsx/xhtml-entities.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/node-utils.d.ts +230 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +188 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser.d.ts +25 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/semantic-or-syntactic-errors.d.ts +13 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/simple-traverse.d.ts +9 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +175 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/index.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +18 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/version-check.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts +3 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +67 -28
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/getModifiers.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/getModifiers.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/getModifiers.js +68 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/getModifiers.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.js +4 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js +11 -9
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/version-check.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/version-check.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/version-check.js +8 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/version-check.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +48 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +76 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/astUtilities.d.ts +76 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/index.d.ts +6 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/predicates.d.ts +32 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +18 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/helpers.d.ts +1153 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/index.d.ts +5 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/misc.d.ts +8 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/predicates.d.ts +58 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/InferTypesFromRule.d.ts +11 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/RuleCreator.d.ts +35 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/RuleTester.d.ts +18 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/applyDefault.d.ts +10 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/batchedSingleLineTests.d.ts +24 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/deepMerge.d.ts +17 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/getParserServices.d.ts +8 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/index.d.ts +9 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/nullThrows.d.ts +14 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/index.d.ts +8 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/json-schema.d.ts +2 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/AST.d.ts +9 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/CLIEngine.d.ts +137 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/ESLint.d.ts +376 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/Linter.d.ts +326 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/ParserOptions.d.ts +2 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/Rule.d.ts +393 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/RuleTester.d.ts +154 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/Scope.d.ts +44 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/SourceCode.d.ts +342 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/index.d.ts +10 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Definition.d.ts +19 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Options.d.ts +15 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/PatternVisitor.d.ts +25 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Reference.d.ts +28 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Referencer.d.ts +55 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Scope.d.ts +103 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/ScopeManager.d.ts +50 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Variable.d.ts +17 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/analyze.d.ts +16 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/index.d.ts +11 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-estree.d.ts +3 -0
- package/node_modules/@typescript-eslint/utils/dist/ast-utils/helpers.d.ts +1131 -25
- package/node_modules/@typescript-eslint/utils/dist/ast-utils/helpers.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ast-utils/helpers.js.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ast-utils/predicates.d.ts +15 -137
- package/node_modules/@typescript-eslint/utils/dist/ast-utils/predicates.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/CLIEngine.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/CLIEngine.js +1 -0
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/CLIEngine.js.map +1 -1
- package/node_modules/@typescript-eslint/utils/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/get-keys.d.ts +4 -0
- package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/index.d.ts +3 -0
- package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/visitor-keys.d.ts +6 -0
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { ParserServices, TSESTree } from '../ts-estree';
|
|
2
|
+
import { Scope } from './Scope';
|
|
3
|
+
declare class TokenStore {
|
|
4
|
+
/**
|
|
5
|
+
* Checks whether any comments exist or not between the given 2 nodes.
|
|
6
|
+
* @param left The node to check.
|
|
7
|
+
* @param right The node to check.
|
|
8
|
+
* @returns `true` if one or more comments exist.
|
|
9
|
+
*/
|
|
10
|
+
commentsExistBetween(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Gets all comment tokens directly after the given node or token.
|
|
13
|
+
* @param nodeOrToken The AST node or token to check for adjacent comment tokens.
|
|
14
|
+
* @returns An array of comments in occurrence order.
|
|
15
|
+
*/
|
|
16
|
+
getCommentsAfter(nodeOrToken: TSESTree.Node | TSESTree.Token): TSESTree.Comment[];
|
|
17
|
+
/**
|
|
18
|
+
* Gets all comment tokens directly before the given node or token.
|
|
19
|
+
* @param nodeOrToken The AST node or token to check for adjacent comment tokens.
|
|
20
|
+
* @returns An array of comments in occurrence order.
|
|
21
|
+
*/
|
|
22
|
+
getCommentsBefore(nodeOrToken: TSESTree.Node | TSESTree.Token): TSESTree.Comment[];
|
|
23
|
+
/**
|
|
24
|
+
* Gets all comment tokens inside the given node.
|
|
25
|
+
* @param node The AST node to get the comments for.
|
|
26
|
+
* @returns An array of comments in occurrence order.
|
|
27
|
+
*/
|
|
28
|
+
getCommentsInside(node: TSESTree.Node): TSESTree.Comment[];
|
|
29
|
+
/**
|
|
30
|
+
* Gets the first token of the given node.
|
|
31
|
+
* @param node The AST node.
|
|
32
|
+
* @param option The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
|
|
33
|
+
* @returns An object representing the token.
|
|
34
|
+
*/
|
|
35
|
+
getFirstToken<T extends SourceCode.CursorWithSkipOptions>(node: TSESTree.Node, options?: T): SourceCode.ReturnTypeFromOptions<T> | null;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the first token between two non-overlapping nodes.
|
|
38
|
+
* @param left Node before the desired token range.
|
|
39
|
+
* @param right Node after the desired token range.
|
|
40
|
+
* @param option The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
|
|
41
|
+
* @returns An object representing the token.
|
|
42
|
+
*/
|
|
43
|
+
getFirstTokenBetween<T extends SourceCode.CursorWithSkipOptions>(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T> | null;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the first `count` tokens of the given node.
|
|
46
|
+
* @param node The AST node.
|
|
47
|
+
* @param options The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
|
|
48
|
+
* @returns Tokens.
|
|
49
|
+
*/
|
|
50
|
+
getFirstTokens<T extends SourceCode.CursorWithCountOptions>(node: TSESTree.Node, options?: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
51
|
+
/**
|
|
52
|
+
* Gets the first `count` tokens between two non-overlapping nodes.
|
|
53
|
+
* @param left Node before the desired token range.
|
|
54
|
+
* @param right Node after the desired token range.
|
|
55
|
+
* @param options The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
|
|
56
|
+
* @returns Tokens between left and right.
|
|
57
|
+
*/
|
|
58
|
+
getFirstTokensBetween<T extends SourceCode.CursorWithCountOptions>(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
59
|
+
/**
|
|
60
|
+
* Gets the last token of the given node.
|
|
61
|
+
* @param node The AST node.
|
|
62
|
+
* @param option The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
|
|
63
|
+
* @returns An object representing the token.
|
|
64
|
+
*/
|
|
65
|
+
getLastToken<T extends SourceCode.CursorWithSkipOptions>(node: TSESTree.Node, options?: T): SourceCode.ReturnTypeFromOptions<T> | null;
|
|
66
|
+
/**
|
|
67
|
+
* Gets the last token between two non-overlapping nodes.
|
|
68
|
+
* @param left Node before the desired token range.
|
|
69
|
+
* @param right Node after the desired token range.
|
|
70
|
+
* @param option The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
|
|
71
|
+
* @returns An object representing the token.
|
|
72
|
+
*/
|
|
73
|
+
getLastTokenBetween<T extends SourceCode.CursorWithSkipOptions>(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T> | null;
|
|
74
|
+
/**
|
|
75
|
+
* Gets the last `count` tokens of the given node.
|
|
76
|
+
* @param node The AST node.
|
|
77
|
+
* @param options The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
|
|
78
|
+
* @returns Tokens.
|
|
79
|
+
*/
|
|
80
|
+
getLastTokens<T extends SourceCode.CursorWithCountOptions>(node: TSESTree.Node, options?: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
81
|
+
/**
|
|
82
|
+
* Gets the last `count` tokens between two non-overlapping nodes.
|
|
83
|
+
* @param left Node before the desired token range.
|
|
84
|
+
* @param right Node after the desired token range.
|
|
85
|
+
* @param options The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
|
|
86
|
+
* @returns Tokens between left and right.
|
|
87
|
+
*/
|
|
88
|
+
getLastTokensBetween<T extends SourceCode.CursorWithCountOptions>(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
89
|
+
/**
|
|
90
|
+
* Gets the token that follows a given node or token.
|
|
91
|
+
* @param node The AST node or token.
|
|
92
|
+
* @param option The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
|
|
93
|
+
* @returns An object representing the token.
|
|
94
|
+
*/
|
|
95
|
+
getTokenAfter<T extends SourceCode.CursorWithSkipOptions>(node: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T> | null;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the token that precedes a given node or token.
|
|
98
|
+
* @param node The AST node or token.
|
|
99
|
+
* @param options The option object
|
|
100
|
+
* @returns An object representing the token.
|
|
101
|
+
*/
|
|
102
|
+
getTokenBefore<T extends SourceCode.CursorWithSkipOptions>(node: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T> | null;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the token starting at the specified index.
|
|
105
|
+
* @param offset Index of the start of the token's range.
|
|
106
|
+
* @param option The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
|
|
107
|
+
* @returns The token starting at index, or null if no such token.
|
|
108
|
+
*/
|
|
109
|
+
getTokenByRangeStart<T extends {
|
|
110
|
+
includeComments?: boolean;
|
|
111
|
+
}>(offset: number, options?: T): SourceCode.ReturnTypeFromOptions<T> | null;
|
|
112
|
+
/**
|
|
113
|
+
* Gets all tokens that are related to the given node.
|
|
114
|
+
* @param node The AST node.
|
|
115
|
+
* @param beforeCount The number of tokens before the node to retrieve.
|
|
116
|
+
* @param afterCount The number of tokens after the node to retrieve.
|
|
117
|
+
* @returns Array of objects representing tokens.
|
|
118
|
+
*/
|
|
119
|
+
getTokens(node: TSESTree.Node, beforeCount?: number, afterCount?: number): TSESTree.Token[];
|
|
120
|
+
/**
|
|
121
|
+
* Gets all tokens that are related to the given node.
|
|
122
|
+
* @param node The AST node.
|
|
123
|
+
* @param options The option object. If this is a function then it's `options.filter`.
|
|
124
|
+
* @returns Array of objects representing tokens.
|
|
125
|
+
*/
|
|
126
|
+
getTokens<T extends SourceCode.CursorWithCountOptions>(node: TSESTree.Node, options: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
127
|
+
/**
|
|
128
|
+
* Gets the `count` tokens that follows a given node or token.
|
|
129
|
+
* @param node The AST node.
|
|
130
|
+
* @param options The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
|
|
131
|
+
* @returns Tokens.
|
|
132
|
+
*/
|
|
133
|
+
getTokensAfter<T extends SourceCode.CursorWithCountOptions>(node: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
134
|
+
/**
|
|
135
|
+
* Gets the `count` tokens that precedes a given node or token.
|
|
136
|
+
* @param node The AST node.
|
|
137
|
+
* @param options The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
|
|
138
|
+
* @returns Tokens.
|
|
139
|
+
*/
|
|
140
|
+
getTokensBefore<T extends SourceCode.CursorWithCountOptions>(node: TSESTree.Node | TSESTree.Token, options?: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
141
|
+
/**
|
|
142
|
+
* Gets all of the tokens between two non-overlapping nodes.
|
|
143
|
+
* @param left Node before the desired token range.
|
|
144
|
+
* @param right Node after the desired token range.
|
|
145
|
+
* @param options The option object. If this is a function then it's `options.filter`.
|
|
146
|
+
* @returns Tokens between left and right.
|
|
147
|
+
*/
|
|
148
|
+
getTokensBetween<T extends SourceCode.CursorWithCountOptions>(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token, padding?: T): SourceCode.ReturnTypeFromOptions<T>[];
|
|
149
|
+
/**
|
|
150
|
+
* Gets all of the tokens between two non-overlapping nodes.
|
|
151
|
+
* @param left Node before the desired token range.
|
|
152
|
+
* @param right Node after the desired token range.
|
|
153
|
+
* @param padding Number of extra tokens on either side of center.
|
|
154
|
+
* @returns Tokens between left and right.
|
|
155
|
+
*/
|
|
156
|
+
getTokensBetween<T extends SourceCode.CursorWithCountOptions>(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token, padding?: number): SourceCode.ReturnTypeFromOptions<T>[];
|
|
157
|
+
}
|
|
158
|
+
declare class SourceCodeBase extends TokenStore {
|
|
159
|
+
/**
|
|
160
|
+
* Represents parsed source code.
|
|
161
|
+
* @param text The source code text.
|
|
162
|
+
* @param ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
|
|
163
|
+
*/
|
|
164
|
+
constructor(text: string, ast: SourceCode.Program);
|
|
165
|
+
/**
|
|
166
|
+
* Represents parsed source code.
|
|
167
|
+
* @param config The config object.
|
|
168
|
+
*/
|
|
169
|
+
constructor(config: SourceCode.SourceCodeConfig);
|
|
170
|
+
/**
|
|
171
|
+
* The parsed AST for the source code.
|
|
172
|
+
*/
|
|
173
|
+
ast: SourceCode.Program;
|
|
174
|
+
/**
|
|
175
|
+
* Retrieves an array containing all comments in the source code.
|
|
176
|
+
* @returns An array of comment nodes.
|
|
177
|
+
*/
|
|
178
|
+
getAllComments(): TSESTree.Comment[];
|
|
179
|
+
/**
|
|
180
|
+
* Converts a (line, column) pair into a range index.
|
|
181
|
+
* @param loc A line/column location
|
|
182
|
+
* @returns The range index of the location in the file.
|
|
183
|
+
*/
|
|
184
|
+
getIndexFromLoc(location: TSESTree.Position): number;
|
|
185
|
+
/**
|
|
186
|
+
* Gets the entire source text split into an array of lines.
|
|
187
|
+
* @returns The source text as an array of lines.
|
|
188
|
+
*/
|
|
189
|
+
getLines(): string[];
|
|
190
|
+
/**
|
|
191
|
+
* Converts a source text index into a (line, column) pair.
|
|
192
|
+
* @param index The index of a character in a file
|
|
193
|
+
* @returns A {line, column} location object with a 0-indexed column
|
|
194
|
+
*/
|
|
195
|
+
getLocFromIndex(index: number): TSESTree.Position;
|
|
196
|
+
/**
|
|
197
|
+
* Gets the deepest node containing a range index.
|
|
198
|
+
* @param index Range index of the desired node.
|
|
199
|
+
* @returns The node if found or `null` if not found.
|
|
200
|
+
*/
|
|
201
|
+
getNodeByRangeIndex(index: number): TSESTree.Node | null;
|
|
202
|
+
/**
|
|
203
|
+
* Gets the source code for the given node.
|
|
204
|
+
* @param node The AST node to get the text for.
|
|
205
|
+
* @param beforeCount The number of characters before the node to retrieve.
|
|
206
|
+
* @param afterCount The number of characters after the node to retrieve.
|
|
207
|
+
* @returns The text representing the AST node.
|
|
208
|
+
*/
|
|
209
|
+
getText(node?: TSESTree.Node | TSESTree.Token, beforeCount?: number, afterCount?: number): string;
|
|
210
|
+
/**
|
|
211
|
+
* The flag to indicate that the source code has Unicode BOM.
|
|
212
|
+
*/
|
|
213
|
+
hasBOM: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Determines if two nodes or tokens have at least one whitespace character
|
|
216
|
+
* between them. Order does not matter. Returns false if the given nodes or
|
|
217
|
+
* tokens overlap.
|
|
218
|
+
* @since 6.7.0
|
|
219
|
+
* @param first The first node or token to check between.
|
|
220
|
+
* @param second The second node or token to check between.
|
|
221
|
+
* @returns True if there is a whitespace character between any of the tokens found between the two given nodes or tokens.
|
|
222
|
+
*/
|
|
223
|
+
isSpaceBetween?(first: TSESTree.Token | TSESTree.Node, second: TSESTree.Token | TSESTree.Node): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Determines if two nodes or tokens have at least one whitespace character
|
|
226
|
+
* between them. Order does not matter. Returns false if the given nodes or
|
|
227
|
+
* tokens overlap.
|
|
228
|
+
* For backward compatibility, this method returns true if there are
|
|
229
|
+
* `JSXText` tokens that contain whitespace between the two.
|
|
230
|
+
* @param first The first node or token to check between.
|
|
231
|
+
* @param second The second node or token to check between.
|
|
232
|
+
* @returns {boolean} True if there is a whitespace character between
|
|
233
|
+
* any of the tokens found between the two given nodes or tokens.
|
|
234
|
+
* @deprecated in favor of isSpaceBetween
|
|
235
|
+
*/
|
|
236
|
+
isSpaceBetweenTokens(first: TSESTree.Token, second: TSESTree.Token): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* The source code split into lines according to ECMA-262 specification.
|
|
239
|
+
* This is done to avoid each rule needing to do so separately.
|
|
240
|
+
*/
|
|
241
|
+
lines: string[];
|
|
242
|
+
/**
|
|
243
|
+
* The indexes in `text` that each line starts
|
|
244
|
+
*/
|
|
245
|
+
lineStartIndices: number[];
|
|
246
|
+
/**
|
|
247
|
+
* The parser services of this source code.
|
|
248
|
+
*/
|
|
249
|
+
parserServices: ParserServices;
|
|
250
|
+
/**
|
|
251
|
+
* The scope of this source code.
|
|
252
|
+
*/
|
|
253
|
+
scopeManager: Scope.ScopeManager | null;
|
|
254
|
+
/**
|
|
255
|
+
* The original text source code. BOM was stripped from this text.
|
|
256
|
+
*/
|
|
257
|
+
text: string;
|
|
258
|
+
/**
|
|
259
|
+
* All of the tokens and comments in the AST.
|
|
260
|
+
*
|
|
261
|
+
* TODO: rename to 'tokens'
|
|
262
|
+
*/
|
|
263
|
+
tokensAndComments: TSESTree.Token[];
|
|
264
|
+
/**
|
|
265
|
+
* The visitor keys to traverse AST.
|
|
266
|
+
*/
|
|
267
|
+
visitorKeys: SourceCode.VisitorKeys;
|
|
268
|
+
/**
|
|
269
|
+
* Split the source code into multiple lines based on the line delimiters.
|
|
270
|
+
* @param text Source code as a string.
|
|
271
|
+
* @returns Array of source code lines.
|
|
272
|
+
*/
|
|
273
|
+
static splitLines(text: string): string[];
|
|
274
|
+
}
|
|
275
|
+
declare namespace SourceCode {
|
|
276
|
+
interface Program extends TSESTree.Program {
|
|
277
|
+
comments: TSESTree.Comment[];
|
|
278
|
+
tokens: TSESTree.Token[];
|
|
279
|
+
}
|
|
280
|
+
interface SourceCodeConfig {
|
|
281
|
+
/**
|
|
282
|
+
* The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
|
|
283
|
+
*/
|
|
284
|
+
ast: Program;
|
|
285
|
+
/**
|
|
286
|
+
* The parser services.
|
|
287
|
+
*/
|
|
288
|
+
parserServices: ParserServices | null;
|
|
289
|
+
/**
|
|
290
|
+
* The scope of this source code.
|
|
291
|
+
*/
|
|
292
|
+
scopeManager: Scope.ScopeManager | null;
|
|
293
|
+
/**
|
|
294
|
+
* The source code text.
|
|
295
|
+
*/
|
|
296
|
+
text: string;
|
|
297
|
+
/**
|
|
298
|
+
* The visitor keys to traverse AST.
|
|
299
|
+
*/
|
|
300
|
+
visitorKeys: VisitorKeys | null;
|
|
301
|
+
}
|
|
302
|
+
interface VisitorKeys {
|
|
303
|
+
[nodeType: string]: string[];
|
|
304
|
+
}
|
|
305
|
+
type FilterPredicate = (token: TSESTree.Token) => boolean;
|
|
306
|
+
type ReturnTypeFromOptions<T> = T extends {
|
|
307
|
+
includeComments: true;
|
|
308
|
+
} ? TSESTree.Token : Exclude<TSESTree.Token, TSESTree.Comment>;
|
|
309
|
+
type CursorWithSkipOptions = number | FilterPredicate | {
|
|
310
|
+
/**
|
|
311
|
+
* The predicate function to choose tokens.
|
|
312
|
+
*/
|
|
313
|
+
filter?: FilterPredicate;
|
|
314
|
+
/**
|
|
315
|
+
* The flag to iterate comments as well.
|
|
316
|
+
*/
|
|
317
|
+
includeComments?: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* The count of tokens the cursor skips.
|
|
320
|
+
*/
|
|
321
|
+
skip?: number;
|
|
322
|
+
};
|
|
323
|
+
type CursorWithCountOptions = number | FilterPredicate | {
|
|
324
|
+
/**
|
|
325
|
+
* The predicate function to choose tokens.
|
|
326
|
+
*/
|
|
327
|
+
filter?: FilterPredicate;
|
|
328
|
+
/**
|
|
329
|
+
* The flag to iterate comments as well.
|
|
330
|
+
*/
|
|
331
|
+
includeComments?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* The maximum count of tokens the cursor iterates.
|
|
334
|
+
*/
|
|
335
|
+
count?: number;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
declare const SourceCode_base: typeof SourceCodeBase;
|
|
339
|
+
declare class SourceCode extends SourceCode_base {
|
|
340
|
+
}
|
|
341
|
+
export { SourceCode };
|
|
342
|
+
//# sourceMappingURL=SourceCode.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './AST';
|
|
2
|
+
export * from './CLIEngine';
|
|
3
|
+
export * from './ESLint';
|
|
4
|
+
export * from './Linter';
|
|
5
|
+
export * from './ParserOptions';
|
|
6
|
+
export * from './Rule';
|
|
7
|
+
export * from './RuleTester';
|
|
8
|
+
export * from './Scope';
|
|
9
|
+
export * from './SourceCode';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
interface Definition {
|
|
3
|
+
type: string;
|
|
4
|
+
name: TSESTree.BindingName;
|
|
5
|
+
node: TSESTree.Node;
|
|
6
|
+
parent?: TSESTree.Node | null;
|
|
7
|
+
index?: number | null;
|
|
8
|
+
kind?: string | null;
|
|
9
|
+
rest?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface DefinitionConstructor {
|
|
12
|
+
new (type: string, name: TSESTree.BindingName | TSESTree.PropertyName, node: TSESTree.Node, parent?: TSESTree.Node | null, index?: number | null, kind?: string | null): Definition;
|
|
13
|
+
}
|
|
14
|
+
declare const Definition: DefinitionConstructor;
|
|
15
|
+
interface ParameterDefinition extends Definition {
|
|
16
|
+
}
|
|
17
|
+
declare const ParameterDefinition: DefinitionConstructor & (new (name: TSESTree.Node, node: TSESTree.Node, index?: number | null, rest?: boolean) => ParameterDefinition);
|
|
18
|
+
export { Definition, ParameterDefinition };
|
|
19
|
+
//# sourceMappingURL=Definition.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
declare type PatternVisitorCallback = (pattern: TSESTree.Identifier, info: {
|
|
3
|
+
rest: boolean;
|
|
4
|
+
topLevel: boolean;
|
|
5
|
+
assignments: TSESTree.AssignmentPattern[];
|
|
6
|
+
}) => void;
|
|
7
|
+
interface PatternVisitorOptions {
|
|
8
|
+
processRightHandNodes?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface Visitor {
|
|
11
|
+
visitChildren<T extends TSESTree.BaseNode | undefined | null>(node?: T): void;
|
|
12
|
+
visit<T extends TSESTree.BaseNode | undefined | null>(node?: T): void;
|
|
13
|
+
}
|
|
14
|
+
export { PatternVisitorCallback, PatternVisitorOptions, Visitor };
|
|
15
|
+
//# sourceMappingURL=Options.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
import { ScopeManager } from './ScopeManager';
|
|
3
|
+
import { PatternVisitorCallback, PatternVisitorOptions, Visitor } from './Options';
|
|
4
|
+
interface PatternVisitor extends Visitor {
|
|
5
|
+
options: PatternVisitorOptions;
|
|
6
|
+
scopeManager: ScopeManager;
|
|
7
|
+
parent?: TSESTree.Node;
|
|
8
|
+
rightHandNodes: TSESTree.Node[];
|
|
9
|
+
Identifier(pattern: TSESTree.Node): void;
|
|
10
|
+
Property(property: TSESTree.Node): void;
|
|
11
|
+
ArrayPattern(pattern: TSESTree.Node): void;
|
|
12
|
+
AssignmentPattern(pattern: TSESTree.Node): void;
|
|
13
|
+
RestElement(pattern: TSESTree.Node): void;
|
|
14
|
+
MemberExpression(node: TSESTree.Node): void;
|
|
15
|
+
SpreadElement(node: TSESTree.Node): void;
|
|
16
|
+
ArrayExpression(node: TSESTree.Node): void;
|
|
17
|
+
AssignmentExpression(node: TSESTree.Node): void;
|
|
18
|
+
CallExpression(node: TSESTree.Node): void;
|
|
19
|
+
}
|
|
20
|
+
declare const PatternVisitor: {
|
|
21
|
+
new (options: PatternVisitorOptions, rootPattern: TSESTree.BaseNode, callback: PatternVisitorCallback): PatternVisitor;
|
|
22
|
+
isPattern(node: TSESTree.Node): boolean;
|
|
23
|
+
};
|
|
24
|
+
export { PatternVisitor };
|
|
25
|
+
//# sourceMappingURL=PatternVisitor.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
import { Scope } from './Scope';
|
|
3
|
+
import { Variable } from './Variable';
|
|
4
|
+
export declare type ReferenceFlag = 0x1 | 0x2 | 0x3;
|
|
5
|
+
interface Reference {
|
|
6
|
+
identifier: TSESTree.Identifier;
|
|
7
|
+
from: Scope;
|
|
8
|
+
resolved: Variable | null;
|
|
9
|
+
writeExpr: TSESTree.Node | null;
|
|
10
|
+
init: boolean;
|
|
11
|
+
partial: boolean;
|
|
12
|
+
__maybeImplicitGlobal: boolean;
|
|
13
|
+
tainted?: boolean;
|
|
14
|
+
typeMode?: boolean;
|
|
15
|
+
isWrite(): boolean;
|
|
16
|
+
isRead(): boolean;
|
|
17
|
+
isWriteOnly(): boolean;
|
|
18
|
+
isReadOnly(): boolean;
|
|
19
|
+
isReadWrite(): boolean;
|
|
20
|
+
}
|
|
21
|
+
declare const Reference: {
|
|
22
|
+
new (identifier: TSESTree.Identifier, scope: Scope, flag?: ReferenceFlag, writeExpr?: TSESTree.Node | null, maybeImplicitGlobal?: boolean, partial?: boolean, init?: boolean): Reference;
|
|
23
|
+
READ: 0x1;
|
|
24
|
+
WRITE: 0x2;
|
|
25
|
+
RW: 0x3;
|
|
26
|
+
};
|
|
27
|
+
export { Reference };
|
|
28
|
+
//# sourceMappingURL=Reference.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
import { PatternVisitorCallback, PatternVisitorOptions, Visitor } from './Options';
|
|
3
|
+
import { Scope } from './Scope';
|
|
4
|
+
import { ScopeManager } from './ScopeManager';
|
|
5
|
+
interface Referencer<SM extends ScopeManager> extends Visitor {
|
|
6
|
+
isInnerMethodDefinition: boolean;
|
|
7
|
+
options: any;
|
|
8
|
+
scopeManager: SM;
|
|
9
|
+
parent?: TSESTree.Node;
|
|
10
|
+
currentScope(): Scope;
|
|
11
|
+
close(node: TSESTree.Node): void;
|
|
12
|
+
pushInnerMethodDefinition(isInnerMethodDefinition: boolean): boolean;
|
|
13
|
+
popInnerMethodDefinition(isInnerMethodDefinition: boolean): void;
|
|
14
|
+
referencingDefaultValue(pattern: any, assignments: any, maybeImplicitGlobal: any, init: boolean): void;
|
|
15
|
+
visitPattern(node: TSESTree.Node, options: PatternVisitorOptions, callback: PatternVisitorCallback): void;
|
|
16
|
+
visitFunction(node: TSESTree.Node): void;
|
|
17
|
+
visitClass(node: TSESTree.Node): void;
|
|
18
|
+
visitProperty(node: TSESTree.Node): void;
|
|
19
|
+
visitForIn(node: TSESTree.Node): void;
|
|
20
|
+
visitVariableDeclaration(variableTargetScope: any, type: any, node: TSESTree.Node, index: any): void;
|
|
21
|
+
AssignmentExpression(node: TSESTree.Node): void;
|
|
22
|
+
CatchClause(node: TSESTree.Node): void;
|
|
23
|
+
Program(node: TSESTree.Program): void;
|
|
24
|
+
Identifier(node: TSESTree.Identifier): void;
|
|
25
|
+
UpdateExpression(node: TSESTree.Node): void;
|
|
26
|
+
MemberExpression(node: TSESTree.Node): void;
|
|
27
|
+
Property(node: TSESTree.Node): void;
|
|
28
|
+
MethodDefinition(node: TSESTree.Node): void;
|
|
29
|
+
BreakStatement(): void;
|
|
30
|
+
ContinueStatement(): void;
|
|
31
|
+
LabeledStatement(node: TSESTree.Node): void;
|
|
32
|
+
ForStatement(node: TSESTree.Node): void;
|
|
33
|
+
ClassExpression(node: TSESTree.Node): void;
|
|
34
|
+
ClassDeclaration(node: TSESTree.Node): void;
|
|
35
|
+
CallExpression(node: TSESTree.Node): void;
|
|
36
|
+
BlockStatement(node: TSESTree.Node): void;
|
|
37
|
+
ThisExpression(): void;
|
|
38
|
+
WithStatement(node: TSESTree.Node): void;
|
|
39
|
+
VariableDeclaration(node: TSESTree.Node): void;
|
|
40
|
+
SwitchStatement(node: TSESTree.Node): void;
|
|
41
|
+
FunctionDeclaration(node: TSESTree.Node): void;
|
|
42
|
+
FunctionExpression(node: TSESTree.Node): void;
|
|
43
|
+
ForOfStatement(node: TSESTree.Node): void;
|
|
44
|
+
ForInStatement(node: TSESTree.Node): void;
|
|
45
|
+
ArrowFunctionExpression(node: TSESTree.Node): void;
|
|
46
|
+
ImportDeclaration(node: TSESTree.Node): void;
|
|
47
|
+
visitExportDeclaration(node: TSESTree.Node): void;
|
|
48
|
+
ExportDeclaration(node: TSESTree.Node): void;
|
|
49
|
+
ExportNamedDeclaration(node: TSESTree.Node): void;
|
|
50
|
+
ExportSpecifier(node: TSESTree.Node): void;
|
|
51
|
+
MetaProperty(): void;
|
|
52
|
+
}
|
|
53
|
+
declare const Referencer: new <SM extends ScopeManager>(options: any, scopeManager: SM) => Referencer<SM>;
|
|
54
|
+
export { Referencer };
|
|
55
|
+
//# sourceMappingURL=Referencer.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
import { Definition } from './Definition';
|
|
3
|
+
import { Reference, ReferenceFlag } from './Reference';
|
|
4
|
+
import { ScopeManager } from './ScopeManager';
|
|
5
|
+
import { Variable } from './Variable';
|
|
6
|
+
declare type ScopeType = 'block' | 'catch' | 'class' | 'for' | 'function' | 'function-expression-name' | 'global' | 'module' | 'switch' | 'with' | 'TDZ' | 'enum' | 'empty-function';
|
|
7
|
+
interface Scope {
|
|
8
|
+
type: ScopeType;
|
|
9
|
+
isStrict: boolean;
|
|
10
|
+
upper: Scope | null;
|
|
11
|
+
childScopes: Scope[];
|
|
12
|
+
variableScope: Scope;
|
|
13
|
+
block: TSESTree.Node;
|
|
14
|
+
variables: Variable[];
|
|
15
|
+
set: Map<string, Variable>;
|
|
16
|
+
references: Reference[];
|
|
17
|
+
through: Reference[];
|
|
18
|
+
thisFound?: boolean;
|
|
19
|
+
taints: Map<string, boolean>;
|
|
20
|
+
functionExpressionScope: boolean;
|
|
21
|
+
__left: Reference[];
|
|
22
|
+
__shouldStaticallyClose(scopeManager: ScopeManager): boolean;
|
|
23
|
+
__shouldStaticallyCloseForGlobal(ref: any): boolean;
|
|
24
|
+
__staticCloseRef(ref: any): void;
|
|
25
|
+
__dynamicCloseRef(ref: any): void;
|
|
26
|
+
__globalCloseRef(ref: any): void;
|
|
27
|
+
__close(scopeManager: ScopeManager): Scope;
|
|
28
|
+
__isValidResolution(ref: any, variable: any): variable is Variable;
|
|
29
|
+
__resolve(ref: Reference): boolean;
|
|
30
|
+
__delegateToUpperScope(ref: any): void;
|
|
31
|
+
__addDeclaredVariablesOfNode(variable: any, node: TSESTree.Node): void;
|
|
32
|
+
__defineGeneric(name: string, set: Map<string, Variable>, variables: Variable[], node: TSESTree.Identifier, def: Definition): void;
|
|
33
|
+
__define(node: TSESTree.Node, def: Definition): void;
|
|
34
|
+
__referencing(node: TSESTree.Node, assign?: ReferenceFlag, writeExpr?: TSESTree.Node, maybeImplicitGlobal?: any, partial?: any, init?: any): void;
|
|
35
|
+
__detectEval(): void;
|
|
36
|
+
__detectThis(): void;
|
|
37
|
+
__isClosed(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* returns resolved {Reference}
|
|
40
|
+
* @method Scope#resolve
|
|
41
|
+
* @param {Espree.Identifier} ident - identifier to be resolved.
|
|
42
|
+
* @returns {Reference} reference
|
|
43
|
+
*/
|
|
44
|
+
resolve(ident: TSESTree.Node): Reference;
|
|
45
|
+
/**
|
|
46
|
+
* returns this scope is static
|
|
47
|
+
* @method Scope#isStatic
|
|
48
|
+
* @returns {boolean} static
|
|
49
|
+
*/
|
|
50
|
+
isStatic(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* returns this scope has materialized arguments
|
|
53
|
+
* @method Scope#isArgumentsMaterialized
|
|
54
|
+
* @returns {boolean} arguments materialized
|
|
55
|
+
*/
|
|
56
|
+
isArgumentsMaterialized(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* returns this scope has materialized `this` reference
|
|
59
|
+
* @method Scope#isThisMaterialized
|
|
60
|
+
* @returns {boolean} this materialized
|
|
61
|
+
*/
|
|
62
|
+
isThisMaterialized(): boolean;
|
|
63
|
+
isUsedName(name: any): boolean;
|
|
64
|
+
}
|
|
65
|
+
interface ScopeConstructor {
|
|
66
|
+
new (scopeManager: ScopeManager, type: ScopeType, upperScope: Scope | null, block: TSESTree.Node | null, isMethodDefinition: boolean): Scope;
|
|
67
|
+
}
|
|
68
|
+
declare const Scope: ScopeConstructor;
|
|
69
|
+
interface ScopeChildConstructorWithUpperScope<T> {
|
|
70
|
+
new (scopeManager: ScopeManager, upperScope: Scope, block: TSESTree.Node | null): T;
|
|
71
|
+
}
|
|
72
|
+
interface GlobalScope extends Scope {
|
|
73
|
+
}
|
|
74
|
+
declare const GlobalScope: ScopeConstructor & (new (scopeManager: ScopeManager, block: TSESTree.Node | null) => GlobalScope);
|
|
75
|
+
interface ModuleScope extends Scope {
|
|
76
|
+
}
|
|
77
|
+
declare const ModuleScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<ModuleScope>;
|
|
78
|
+
interface FunctionExpressionNameScope extends Scope {
|
|
79
|
+
}
|
|
80
|
+
declare const FunctionExpressionNameScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<FunctionExpressionNameScope>;
|
|
81
|
+
interface CatchScope extends Scope {
|
|
82
|
+
}
|
|
83
|
+
declare const CatchScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<CatchScope>;
|
|
84
|
+
interface WithScope extends Scope {
|
|
85
|
+
}
|
|
86
|
+
declare const WithScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<WithScope>;
|
|
87
|
+
interface BlockScope extends Scope {
|
|
88
|
+
}
|
|
89
|
+
declare const BlockScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<BlockScope>;
|
|
90
|
+
interface SwitchScope extends Scope {
|
|
91
|
+
}
|
|
92
|
+
declare const SwitchScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<SwitchScope>;
|
|
93
|
+
interface FunctionScope extends Scope {
|
|
94
|
+
}
|
|
95
|
+
declare const FunctionScope: ScopeConstructor & (new (scopeManager: ScopeManager, upperScope: Scope, block: TSESTree.Node | null, isMethodDefinition: boolean) => FunctionScope);
|
|
96
|
+
interface ForScope extends Scope {
|
|
97
|
+
}
|
|
98
|
+
declare const ForScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<ForScope>;
|
|
99
|
+
interface ClassScope extends Scope {
|
|
100
|
+
}
|
|
101
|
+
declare const ClassScope: ScopeConstructor & ScopeChildConstructorWithUpperScope<ClassScope>;
|
|
102
|
+
export { ScopeType, Scope, GlobalScope, ModuleScope, FunctionExpressionNameScope, CatchScope, WithScope, BlockScope, SwitchScope, FunctionScope, ForScope, ClassScope, };
|
|
103
|
+
//# sourceMappingURL=Scope.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
import { EcmaVersion } from '../ts-eslint';
|
|
3
|
+
import { Scope } from './Scope';
|
|
4
|
+
import { Variable } from './Variable';
|
|
5
|
+
interface ScopeManagerOptions {
|
|
6
|
+
directive?: boolean;
|
|
7
|
+
optimistic?: boolean;
|
|
8
|
+
ignoreEval?: boolean;
|
|
9
|
+
nodejsScope?: boolean;
|
|
10
|
+
sourceType?: 'module' | 'script';
|
|
11
|
+
impliedStrict?: boolean;
|
|
12
|
+
ecmaVersion?: EcmaVersion;
|
|
13
|
+
}
|
|
14
|
+
interface ScopeManager {
|
|
15
|
+
__options: ScopeManagerOptions;
|
|
16
|
+
__currentScope: Scope;
|
|
17
|
+
__nodeToScope: WeakMap<TSESTree.Node, Scope[]>;
|
|
18
|
+
__declaredVariables: WeakMap<TSESTree.Node, Variable[]>;
|
|
19
|
+
scopes: Scope[];
|
|
20
|
+
globalScope: Scope;
|
|
21
|
+
__useDirective(): boolean;
|
|
22
|
+
__isOptimistic(): boolean;
|
|
23
|
+
__ignoreEval(): boolean;
|
|
24
|
+
__isNodejsScope(): boolean;
|
|
25
|
+
isModule(): boolean;
|
|
26
|
+
isImpliedStrict(): boolean;
|
|
27
|
+
isStrictModeSupported(): boolean;
|
|
28
|
+
__get(node: TSESTree.Node): Scope | undefined;
|
|
29
|
+
getDeclaredVariables(node: TSESTree.Node): Variable[];
|
|
30
|
+
acquire(node: TSESTree.Node, inner?: boolean): Scope | null;
|
|
31
|
+
acquireAll(node: TSESTree.Node): Scope | null;
|
|
32
|
+
release(node: TSESTree.Node, inner?: boolean): Scope | null;
|
|
33
|
+
attach(): void;
|
|
34
|
+
detach(): void;
|
|
35
|
+
__nestScope<T extends Scope>(scope: T): T;
|
|
36
|
+
__nestGlobalScope(node: TSESTree.Node): Scope;
|
|
37
|
+
__nestBlockScope(node: TSESTree.Node): Scope;
|
|
38
|
+
__nestFunctionScope(node: TSESTree.Node, isMethodDefinition: boolean): Scope;
|
|
39
|
+
__nestForScope(node: TSESTree.Node): Scope;
|
|
40
|
+
__nestCatchScope(node: TSESTree.Node): Scope;
|
|
41
|
+
__nestWithScope(node: TSESTree.Node): Scope;
|
|
42
|
+
__nestClassScope(node: TSESTree.Node): Scope;
|
|
43
|
+
__nestSwitchScope(node: TSESTree.Node): Scope;
|
|
44
|
+
__nestModuleScope(node: TSESTree.Node): Scope;
|
|
45
|
+
__nestFunctionExpressionNameScope(node: TSESTree.Node): Scope;
|
|
46
|
+
__isES6(): boolean;
|
|
47
|
+
}
|
|
48
|
+
declare const ScopeManager: new (options: ScopeManagerOptions) => ScopeManager;
|
|
49
|
+
export { ScopeManager, ScopeManagerOptions };
|
|
50
|
+
//# sourceMappingURL=ScopeManager.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TSESTree } from '../ts-estree';
|
|
2
|
+
import { Reference } from './Reference';
|
|
3
|
+
import { Definition } from './Definition';
|
|
4
|
+
import { Scope } from './Scope';
|
|
5
|
+
interface Variable {
|
|
6
|
+
name: string;
|
|
7
|
+
identifiers: TSESTree.Identifier[];
|
|
8
|
+
references: Reference[];
|
|
9
|
+
defs: Definition[];
|
|
10
|
+
eslintUsed?: boolean;
|
|
11
|
+
stack?: unknown;
|
|
12
|
+
tainted?: boolean;
|
|
13
|
+
scope?: Scope;
|
|
14
|
+
}
|
|
15
|
+
declare const Variable: new () => Variable;
|
|
16
|
+
export { Variable };
|
|
17
|
+
//# sourceMappingURL=Variable.d.ts.map
|