@eslint-react/var 1.52.10-beta.0 → 1.52.10-next.1

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/dist/index.d.mts CHANGED
@@ -1,6 +1,8 @@
1
- import { unit } from '@eslint-react/eff';
2
- import { Scope, Variable } from '@typescript-eslint/scope-manager';
3
- import { TSESTree } from '@typescript-eslint/types';
1
+ import { unit } from "@eslint-react/eff";
2
+ import { Scope, Variable } from "@typescript-eslint/scope-manager";
3
+ import { TSESTree } from "@typescript-eslint/types";
4
+
5
+ //#region src/var-collect.d.ts
4
6
 
5
7
  /**
6
8
  * Get all variables from the given scope up to the global scope
@@ -9,42 +11,43 @@ import { TSESTree } from '@typescript-eslint/types';
9
11
  */
10
12
  declare function getVariables(initialScope: Scope): Variable[];
11
13
  declare const findVariable: {
12
- (initialScope: Scope): (nameOrNode: string | TSESTree.Identifier | unit) => Variable | unit;
13
- (nameOrNode: string | TSESTree.Identifier | unit, initialScope: Scope): Variable | unit;
14
+ (initialScope: Scope): (nameOrNode: string | TSESTree.Identifier | unit) => Variable | unit;
15
+ (nameOrNode: string | TSESTree.Identifier | unit, initialScope: Scope): Variable | unit;
14
16
  };
15
17
  declare function findPropertyInProperties(name: string, properties: (TSESTree.Property | TSESTree.RestElement | TSESTree.SpreadElement)[], initialScope: Scope, seen?: Set<string>): (typeof properties)[number] | unit;
16
-
18
+ //#endregion
19
+ //#region src/var-construction.d.ts
17
20
  declare const ConstructionDetectionHint: {
18
- None: bigint;
19
- StrictCallExpression: bigint;
21
+ None: bigint;
22
+ StrictCallExpression: bigint;
20
23
  };
21
24
  type Construction = {
22
- kind: "ArrayExpression";
23
- node: TSESTree.ArrayExpression;
25
+ kind: "ArrayExpression";
26
+ node: TSESTree.ArrayExpression;
24
27
  } | {
25
- kind: "CallExpression";
26
- node: TSESTree.CallExpression;
28
+ kind: "CallExpression";
29
+ node: TSESTree.CallExpression;
27
30
  } | {
28
- kind: "ClassExpression";
29
- node: TSESTree.ClassExpression;
31
+ kind: "ClassExpression";
32
+ node: TSESTree.ClassExpression;
30
33
  } | {
31
- kind: "FunctionDeclaration";
32
- node: TSESTree.FunctionDeclaration;
34
+ kind: "FunctionDeclaration";
35
+ node: TSESTree.FunctionDeclaration;
33
36
  } | {
34
- kind: "FunctionExpression";
35
- node: TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression;
37
+ kind: "FunctionExpression";
38
+ node: TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression;
36
39
  } | {
37
- kind: "JSXElement";
38
- node: TSESTree.JSXElement | TSESTree.JSXFragment;
40
+ kind: "JSXElement";
41
+ node: TSESTree.JSXElement | TSESTree.JSXFragment;
39
42
  } | {
40
- kind: "NewExpression";
41
- node: TSESTree.NewExpression;
43
+ kind: "NewExpression";
44
+ node: TSESTree.NewExpression;
42
45
  } | {
43
- kind: "ObjectExpression";
44
- node: TSESTree.ObjectExpression;
46
+ kind: "ObjectExpression";
47
+ node: TSESTree.ObjectExpression;
45
48
  } | {
46
- kind: "RegExpLiteral";
47
- node: TSESTree.RegExpLiteral;
49
+ kind: "RegExpLiteral";
50
+ node: TSESTree.RegExpLiteral;
48
51
  };
49
52
  /**
50
53
  * Detects the construction type of a given node.
@@ -54,39 +57,44 @@ type Construction = {
54
57
  * @returns The construction type of the node, or `_` if not found.
55
58
  */
56
59
  declare function getConstruction(node: TSESTree.Node | unit, initialScope: Scope, hint?: bigint): Construction | unit;
57
-
60
+ //#endregion
61
+ //#region src/var-declarator-id.d.ts
58
62
  declare function getVariableDeclaratorId(node: TSESTree.Node | unit, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | unit;
59
-
63
+ //#endregion
64
+ //#region src/var-init-node.d.ts
60
65
  declare function getVariableInitNode(variable: Variable | unit, at: number): unit | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
61
-
66
+ //#endregion
67
+ //#region src/var-scope.d.ts
62
68
  declare function getChidScopes(scope: Scope): readonly Scope[];
63
-
69
+ //#endregion
70
+ //#region src/var-value.d.ts
64
71
  type LazyValue = {
65
- kind: "lazy";
66
- node: TSESTree.Node;
67
- initialScope: Scope | unit;
72
+ kind: "lazy";
73
+ node: TSESTree.Node;
74
+ initialScope: Scope | unit;
68
75
  } | {
69
- kind: "none";
70
- node: TSESTree.Node;
71
- initialScope: Scope | unit;
76
+ kind: "none";
77
+ node: TSESTree.Node;
78
+ initialScope: Scope | unit;
72
79
  } | {
73
- kind: "some";
74
- node: TSESTree.Node;
75
- value: unknown;
76
- initialScope: Scope | unit;
80
+ kind: "some";
81
+ node: TSESTree.Node;
82
+ value: unknown;
83
+ initialScope: Scope | unit;
77
84
  };
78
85
  declare function toStaticValue(lazyValue: LazyValue): {
79
- readonly kind: "none";
80
- readonly node: TSESTree.Node;
81
- readonly initialScope: Scope | undefined;
82
- readonly value?: never;
86
+ readonly kind: "none";
87
+ readonly node: TSESTree.Node;
88
+ readonly initialScope: Scope | undefined;
89
+ readonly value?: never;
83
90
  } | {
84
- readonly kind: "some";
85
- readonly node: TSESTree.Node;
86
- readonly initialScope: Scope | undefined;
87
- readonly value: unknown;
91
+ readonly kind: "some";
92
+ readonly node: TSESTree.Node;
93
+ readonly initialScope: Scope | undefined;
94
+ readonly value: unknown;
88
95
  };
89
-
96
+ //#endregion
97
+ //#region src/var-value-equal.d.ts
90
98
  /**
91
99
  * Determines whether node value equals to another node value
92
100
  * @param a node to compare
@@ -94,9 +102,6 @@ declare function toStaticValue(lazyValue: LazyValue): {
94
102
  * @param initialScopes initial scopes of the two nodes
95
103
  * @returns `true` if node value equal
96
104
  */
97
- declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialScopes: [
98
- aScope: Scope,
99
- bScope: Scope
100
- ]): boolean;
101
-
102
- export { type Construction, ConstructionDetectionHint, type LazyValue, findPropertyInProperties, findVariable, getChidScopes, getConstruction, getVariableDeclaratorId, getVariableInitNode, getVariables, isNodeValueEqual, toStaticValue };
105
+ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialScopes: [aScope: Scope, bScope: Scope]): boolean;
106
+ //#endregion
107
+ export { Construction, ConstructionDetectionHint, LazyValue, findPropertyInProperties, findVariable, getChidScopes, getConstruction, getVariableDeclaratorId, getVariableInitNode, getVariables, isNodeValueEqual, toStaticValue };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { unit } from '@eslint-react/eff';
2
- import { Scope, Variable } from '@typescript-eslint/scope-manager';
3
- import { TSESTree } from '@typescript-eslint/types';
1
+ import { unit } from "@eslint-react/eff";
2
+ import { Scope, Variable } from "@typescript-eslint/scope-manager";
3
+ import { TSESTree } from "@typescript-eslint/types";
4
+
5
+ //#region src/var-collect.d.ts
4
6
 
5
7
  /**
6
8
  * Get all variables from the given scope up to the global scope
@@ -9,42 +11,43 @@ import { TSESTree } from '@typescript-eslint/types';
9
11
  */
10
12
  declare function getVariables(initialScope: Scope): Variable[];
11
13
  declare const findVariable: {
12
- (initialScope: Scope): (nameOrNode: string | TSESTree.Identifier | unit) => Variable | unit;
13
- (nameOrNode: string | TSESTree.Identifier | unit, initialScope: Scope): Variable | unit;
14
+ (initialScope: Scope): (nameOrNode: string | TSESTree.Identifier | unit) => Variable | unit;
15
+ (nameOrNode: string | TSESTree.Identifier | unit, initialScope: Scope): Variable | unit;
14
16
  };
15
17
  declare function findPropertyInProperties(name: string, properties: (TSESTree.Property | TSESTree.RestElement | TSESTree.SpreadElement)[], initialScope: Scope, seen?: Set<string>): (typeof properties)[number] | unit;
16
-
18
+ //#endregion
19
+ //#region src/var-construction.d.ts
17
20
  declare const ConstructionDetectionHint: {
18
- None: bigint;
19
- StrictCallExpression: bigint;
21
+ None: bigint;
22
+ StrictCallExpression: bigint;
20
23
  };
21
24
  type Construction = {
22
- kind: "ArrayExpression";
23
- node: TSESTree.ArrayExpression;
25
+ kind: "ArrayExpression";
26
+ node: TSESTree.ArrayExpression;
24
27
  } | {
25
- kind: "CallExpression";
26
- node: TSESTree.CallExpression;
28
+ kind: "CallExpression";
29
+ node: TSESTree.CallExpression;
27
30
  } | {
28
- kind: "ClassExpression";
29
- node: TSESTree.ClassExpression;
31
+ kind: "ClassExpression";
32
+ node: TSESTree.ClassExpression;
30
33
  } | {
31
- kind: "FunctionDeclaration";
32
- node: TSESTree.FunctionDeclaration;
34
+ kind: "FunctionDeclaration";
35
+ node: TSESTree.FunctionDeclaration;
33
36
  } | {
34
- kind: "FunctionExpression";
35
- node: TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression;
37
+ kind: "FunctionExpression";
38
+ node: TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression;
36
39
  } | {
37
- kind: "JSXElement";
38
- node: TSESTree.JSXElement | TSESTree.JSXFragment;
40
+ kind: "JSXElement";
41
+ node: TSESTree.JSXElement | TSESTree.JSXFragment;
39
42
  } | {
40
- kind: "NewExpression";
41
- node: TSESTree.NewExpression;
43
+ kind: "NewExpression";
44
+ node: TSESTree.NewExpression;
42
45
  } | {
43
- kind: "ObjectExpression";
44
- node: TSESTree.ObjectExpression;
46
+ kind: "ObjectExpression";
47
+ node: TSESTree.ObjectExpression;
45
48
  } | {
46
- kind: "RegExpLiteral";
47
- node: TSESTree.RegExpLiteral;
49
+ kind: "RegExpLiteral";
50
+ node: TSESTree.RegExpLiteral;
48
51
  };
49
52
  /**
50
53
  * Detects the construction type of a given node.
@@ -54,39 +57,44 @@ type Construction = {
54
57
  * @returns The construction type of the node, or `_` if not found.
55
58
  */
56
59
  declare function getConstruction(node: TSESTree.Node | unit, initialScope: Scope, hint?: bigint): Construction | unit;
57
-
60
+ //#endregion
61
+ //#region src/var-declarator-id.d.ts
58
62
  declare function getVariableDeclaratorId(node: TSESTree.Node | unit, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | unit;
59
-
63
+ //#endregion
64
+ //#region src/var-init-node.d.ts
60
65
  declare function getVariableInitNode(variable: Variable | unit, at: number): unit | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
61
-
66
+ //#endregion
67
+ //#region src/var-scope.d.ts
62
68
  declare function getChidScopes(scope: Scope): readonly Scope[];
63
-
69
+ //#endregion
70
+ //#region src/var-value.d.ts
64
71
  type LazyValue = {
65
- kind: "lazy";
66
- node: TSESTree.Node;
67
- initialScope: Scope | unit;
72
+ kind: "lazy";
73
+ node: TSESTree.Node;
74
+ initialScope: Scope | unit;
68
75
  } | {
69
- kind: "none";
70
- node: TSESTree.Node;
71
- initialScope: Scope | unit;
76
+ kind: "none";
77
+ node: TSESTree.Node;
78
+ initialScope: Scope | unit;
72
79
  } | {
73
- kind: "some";
74
- node: TSESTree.Node;
75
- value: unknown;
76
- initialScope: Scope | unit;
80
+ kind: "some";
81
+ node: TSESTree.Node;
82
+ value: unknown;
83
+ initialScope: Scope | unit;
77
84
  };
78
85
  declare function toStaticValue(lazyValue: LazyValue): {
79
- readonly kind: "none";
80
- readonly node: TSESTree.Node;
81
- readonly initialScope: Scope | undefined;
82
- readonly value?: never;
86
+ readonly kind: "none";
87
+ readonly node: TSESTree.Node;
88
+ readonly initialScope: Scope | undefined;
89
+ readonly value?: never;
83
90
  } | {
84
- readonly kind: "some";
85
- readonly node: TSESTree.Node;
86
- readonly initialScope: Scope | undefined;
87
- readonly value: unknown;
91
+ readonly kind: "some";
92
+ readonly node: TSESTree.Node;
93
+ readonly initialScope: Scope | undefined;
94
+ readonly value: unknown;
88
95
  };
89
-
96
+ //#endregion
97
+ //#region src/var-value-equal.d.ts
90
98
  /**
91
99
  * Determines whether node value equals to another node value
92
100
  * @param a node to compare
@@ -94,9 +102,6 @@ declare function toStaticValue(lazyValue: LazyValue): {
94
102
  * @param initialScopes initial scopes of the two nodes
95
103
  * @returns `true` if node value equal
96
104
  */
97
- declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialScopes: [
98
- aScope: Scope,
99
- bScope: Scope
100
- ]): boolean;
101
-
102
- export { type Construction, ConstructionDetectionHint, type LazyValue, findPropertyInProperties, findVariable, getChidScopes, getConstruction, getVariableDeclaratorId, getVariableInitNode, getVariables, isNodeValueEqual, toStaticValue };
105
+ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialScopes: [aScope: Scope, bScope: Scope]): boolean;
106
+ //#endregion
107
+ export { Construction, ConstructionDetectionHint, LazyValue, findPropertyInProperties, findVariable, getChidScopes, getConstruction, getVariableDeclaratorId, getVariableInitNode, getVariables, isNodeValueEqual, toStaticValue };