|
1 | 1 | declare module "eslint-plugin-es-x" {
|
2 |
| - export const rules: NonNullable<import('eslint').ESLint.Plugin["rules"]>; |
| 2 | + export const rules: NonNullable<import("eslint").ESLint.Plugin["rules"]> |
3 | 3 | }
|
4 | 4 |
|
5 | 5 | declare module "@eslint-community/eslint-utils" {
|
6 |
| - import * as estree from 'estree'; |
7 |
| - import * as eslint from 'eslint'; |
| 6 | + import * as estree from "estree" |
| 7 | + import * as eslint from "eslint" |
8 | 8 |
|
9 |
| - type Node = estree.Node | estree.Expression; |
| 9 | + type Node = estree.Node | estree.Expression |
10 | 10 |
|
11 |
| - export const READ: unique symbol; |
12 |
| - export const CALL: unique symbol; |
13 |
| - export const CONSTRUCT: unique symbol; |
14 |
| - export const ESM: unique symbol; |
| 11 | + export const READ: unique symbol |
| 12 | + export const CALL: unique symbol |
| 13 | + export const CONSTRUCT: unique symbol |
| 14 | + export const ESM: unique symbol |
15 | 15 | export class ReferenceTracker {
|
16 |
| - constructor(globalScope: eslint.Scope.Scope, { mode, globalObjectNames, }?: { |
17 |
| - mode?: "legacy" | "strict" | undefined; |
18 |
| - globalObjectNames?: string[] | undefined; |
19 |
| - } | undefined); |
20 |
| - variableStack: eslint.Scope.Variable[]; |
21 |
| - globalScope: eslint.Scope.Scope; |
22 |
| - mode: "legacy" | "strict"; |
23 |
| - globalObjectNames: string[]; |
24 |
| - iterateGlobalReferences<Info extends unknown>(traceMap: TraceMap<Info>): IterableIterator<Reference<Info>>; |
25 |
| - iterateCjsReferences<Info extends unknown>(traceMap: TraceMap<Info>): IterableIterator<Reference<Info>>; |
26 |
| - iterateEsmReferences<Info extends unknown>(traceMap: TraceMap<Info>): IterableIterator<Reference<Info>>; |
| 16 | + constructor( |
| 17 | + globalScope: eslint.Scope.Scope, |
| 18 | + { |
| 19 | + mode, |
| 20 | + globalObjectNames, |
| 21 | + }?: |
| 22 | + | { |
| 23 | + mode?: "legacy" | "strict" | undefined |
| 24 | + globalObjectNames?: string[] | undefined |
| 25 | + } |
| 26 | + | undefined |
| 27 | + ) |
| 28 | + variableStack: eslint.Scope.Variable[] |
| 29 | + globalScope: eslint.Scope.Scope |
| 30 | + mode: "legacy" | "strict" |
| 31 | + globalObjectNames: string[] |
| 32 | + iterateGlobalReferences<Info extends unknown>( |
| 33 | + traceMap: TraceMap<Info> |
| 34 | + ): IterableIterator<Reference<Info>> |
| 35 | + iterateCjsReferences<Info extends unknown>( |
| 36 | + traceMap: TraceMap<Info> |
| 37 | + ): IterableIterator<Reference<Info>> |
| 38 | + iterateEsmReferences<Info extends unknown>( |
| 39 | + traceMap: TraceMap<Info> |
| 40 | + ): IterableIterator<Reference<Info>> |
27 | 41 | }
|
28 | 42 | export namespace ReferenceTracker {
|
29 |
| - export { READ }; |
30 |
| - export { CALL }; |
31 |
| - export { CONSTRUCT }; |
32 |
| - export { ESM }; |
| 43 | + export { READ } |
| 44 | + export { CALL } |
| 45 | + export { CONSTRUCT } |
| 46 | + export { ESM } |
33 | 47 | }
|
34 |
| - type ReferenceType = typeof READ | typeof CALL | typeof CONSTRUCT; |
| 48 | + type ReferenceType = typeof READ | typeof CALL | typeof CONSTRUCT |
35 | 49 | type TraceMap<Info extends unknown> = {
|
36 |
| - [READ]?: Info; |
37 |
| - [CALL]?: Info; |
38 |
| - [CONSTRUCT]?: Info; |
39 |
| - [key: string]: TraceMap<Info> | undefined; |
| 50 | + [READ]?: Info |
| 51 | + [CALL]?: Info |
| 52 | + [CONSTRUCT]?: Info |
| 53 | + [key: string]: TraceMap<Info> | undefined |
40 | 54 | }
|
41 |
| - type RichNode = eslint.Rule.Node | Node; |
| 55 | + type RichNode = eslint.Rule.Node | Node |
42 | 56 | type Reference<Info extends unknown> = {
|
43 |
| - node: RichNode; |
44 |
| - path: string[]; |
45 |
| - type: ReferenceType; |
46 |
| - info: Info; |
47 |
| - }; |
| 57 | + node: RichNode |
| 58 | + path: string[] |
| 59 | + type: ReferenceType |
| 60 | + info: Info |
| 61 | + } |
48 | 62 |
|
49 |
| - export function findVariable(initialScope: eslint.Scope.Scope, nameOrNode: string | Node): eslint.Scope.Variable | null; |
| 63 | + export function findVariable( |
| 64 | + initialScope: eslint.Scope.Scope, |
| 65 | + nameOrNode: string | Node |
| 66 | + ): eslint.Scope.Variable | null |
50 | 67 |
|
51 |
| - export function getFunctionHeadLocation(node: Extract<eslint.Rule.Node, { |
52 |
| - type: 'FunctionDeclaration' | 'FunctionExpression' | 'ArrowFunctionExpression'; |
53 |
| - }>, sourceCode: eslint.SourceCode): eslint.AST.SourceLocation | null; |
| 68 | + export function getFunctionHeadLocation( |
| 69 | + node: Extract< |
| 70 | + eslint.Rule.Node, |
| 71 | + { |
| 72 | + type: |
| 73 | + | "FunctionDeclaration" |
| 74 | + | "FunctionExpression" |
| 75 | + | "ArrowFunctionExpression" |
| 76 | + } |
| 77 | + >, |
| 78 | + sourceCode: eslint.SourceCode |
| 79 | + ): eslint.AST.SourceLocation | null |
54 | 80 |
|
55 |
| - export function getFunctionNameWithKind(node: Extract<eslint.Rule.Node, { |
56 |
| - type: 'FunctionDeclaration' | 'FunctionExpression' | 'ArrowFunctionExpression'; |
57 |
| - }>, sourceCode?: eslint.SourceCode | undefined): string; |
| 81 | + export function getFunctionNameWithKind( |
| 82 | + node: Extract< |
| 83 | + eslint.Rule.Node, |
| 84 | + { |
| 85 | + type: |
| 86 | + | "FunctionDeclaration" |
| 87 | + | "FunctionExpression" |
| 88 | + | "ArrowFunctionExpression" |
| 89 | + } |
| 90 | + >, |
| 91 | + sourceCode?: eslint.SourceCode | undefined |
| 92 | + ): string |
58 | 93 |
|
59 |
| - export function getInnermostScope(initialScope: eslint.Scope.Scope, node: Node): eslint.Scope.Scope; |
| 94 | + export function getInnermostScope( |
| 95 | + initialScope: eslint.Scope.Scope, |
| 96 | + node: Node |
| 97 | + ): eslint.Scope.Scope |
60 | 98 |
|
61 |
| - export function getPropertyName(node: Extract<Node, { |
62 |
| - type: 'MemberExpression' | 'Property' | 'MethodDefinition' | 'PropertyDefinition'; |
63 |
| - }>, initialScope?: eslint.Scope.Scope | undefined): string | null; |
| 99 | + export function getPropertyName( |
| 100 | + node: Extract< |
| 101 | + Node, |
| 102 | + { |
| 103 | + type: |
| 104 | + | "MemberExpression" |
| 105 | + | "Property" |
| 106 | + | "MethodDefinition" |
| 107 | + | "PropertyDefinition" |
| 108 | + } |
| 109 | + >, |
| 110 | + initialScope?: eslint.Scope.Scope | undefined |
| 111 | + ): string | null |
64 | 112 |
|
65 |
| - export function getStaticValue(node: Node, initialScope?: eslint.Scope.Scope | null | undefined): { |
66 |
| - value: unknown; |
67 |
| - optional?: never; |
68 |
| - } | { |
69 |
| - value: undefined; |
70 |
| - optional?: true; |
71 |
| - } | null; |
| 113 | + export function getStaticValue( |
| 114 | + node: Node, |
| 115 | + initialScope?: eslint.Scope.Scope | null | undefined |
| 116 | + ): |
| 117 | + | { |
| 118 | + value: unknown |
| 119 | + optional?: never |
| 120 | + } |
| 121 | + | { |
| 122 | + value: undefined |
| 123 | + optional?: true |
| 124 | + } |
| 125 | + | null |
72 | 126 |
|
73 |
| - export function getStringIfConstant(node: Node, initialScope?: eslint.Scope.Scope | null | undefined): string | null; |
| 127 | + export function getStringIfConstant( |
| 128 | + node: Node, |
| 129 | + initialScope?: eslint.Scope.Scope | null | undefined |
| 130 | + ): string | null |
74 | 131 |
|
75 |
| - export function hasSideEffect(node: eslint.Rule.Node, sourceCode: eslint.SourceCode, { considerGetters, considerImplicitTypeConversion }?: VisitOptions | undefined): boolean; |
| 132 | + export function hasSideEffect( |
| 133 | + node: eslint.Rule.Node, |
| 134 | + sourceCode: eslint.SourceCode, |
| 135 | + { |
| 136 | + considerGetters, |
| 137 | + considerImplicitTypeConversion, |
| 138 | + }?: VisitOptions | undefined |
| 139 | + ): boolean |
76 | 140 | type VisitOptions = {
|
77 |
| - considerGetters?: boolean | undefined; |
78 |
| - considerImplicitTypeConversion?: boolean | undefined; |
79 |
| - }; |
| 141 | + considerGetters?: boolean | undefined |
| 142 | + considerImplicitTypeConversion?: boolean | undefined |
| 143 | + } |
80 | 144 | }
|
0 commit comments