@eslint-react/var 1.28.1-next.5 → 1.28.1-next.7
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 +1 -8
- package/dist/index.d.ts +1 -8
- package/dist/index.js +0 -19
- package/dist/index.mjs +1 -18
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -13,8 +13,6 @@ declare function getChidScopes(scope: Scope): readonly Scope[];
|
|
|
13
13
|
|
|
14
14
|
declare function getVariableDeclaratorId(node: TSESTree.Node | _, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | _;
|
|
15
15
|
|
|
16
|
-
declare function getVariableId(node: TSESTree.Node, prev?: TSESTree.Node): TSESTree.Identifier | TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.BinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpression | TSESTree.UpdateExpression | TSESTree.YieldExpression | TSESTree.PrivateIdentifier | undefined;
|
|
17
|
-
|
|
18
16
|
declare function getVariableNode(variable: Variable | _, at: number): _ | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
|
|
19
17
|
|
|
20
18
|
/**
|
|
@@ -36,11 +34,6 @@ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialSco
|
|
|
36
34
|
bScope: Scope
|
|
37
35
|
]): boolean;
|
|
38
36
|
|
|
39
|
-
declare function isVariableIdEqual(a: TSESTree.Node, b: TSESTree.Node, initialScopes: [
|
|
40
|
-
aScope: Scope,
|
|
41
|
-
bScope: Scope
|
|
42
|
-
]): boolean;
|
|
43
|
-
|
|
44
37
|
type LazyValue = {
|
|
45
38
|
kind: "lazy";
|
|
46
39
|
node: TSESTree.Node;
|
|
@@ -108,4 +101,4 @@ declare const ValueConstructionHint: {
|
|
|
108
101
|
*/
|
|
109
102
|
declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
|
|
110
103
|
|
|
111
|
-
export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId,
|
|
104
|
+
export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isNodeValueEqual, toStaticValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ declare function getChidScopes(scope: Scope): readonly Scope[];
|
|
|
13
13
|
|
|
14
14
|
declare function getVariableDeclaratorId(node: TSESTree.Node | _, prev?: TSESTree.Node): TSESTree.BindingName | TSESTree.Expression | _;
|
|
15
15
|
|
|
16
|
-
declare function getVariableId(node: TSESTree.Node, prev?: TSESTree.Node): TSESTree.Identifier | TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.BinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpression | TSESTree.UpdateExpression | TSESTree.YieldExpression | TSESTree.PrivateIdentifier | undefined;
|
|
17
|
-
|
|
18
16
|
declare function getVariableNode(variable: Variable | _, at: number): _ | TSESTree.ClassDeclaration | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.Expression | TSESTree.FunctionDeclaration | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
|
|
19
17
|
|
|
20
18
|
/**
|
|
@@ -36,11 +34,6 @@ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialSco
|
|
|
36
34
|
bScope: Scope
|
|
37
35
|
]): boolean;
|
|
38
36
|
|
|
39
|
-
declare function isVariableIdEqual(a: TSESTree.Node, b: TSESTree.Node, initialScopes: [
|
|
40
|
-
aScope: Scope,
|
|
41
|
-
bScope: Scope
|
|
42
|
-
]): boolean;
|
|
43
|
-
|
|
44
37
|
type LazyValue = {
|
|
45
38
|
kind: "lazy";
|
|
46
39
|
node: TSESTree.Node;
|
|
@@ -108,4 +101,4 @@ declare const ValueConstructionHint: {
|
|
|
108
101
|
*/
|
|
109
102
|
declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
|
|
110
103
|
|
|
111
|
-
export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId,
|
|
104
|
+
export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isNodeValueEqual, toStaticValue };
|
package/dist/index.js
CHANGED
|
@@ -110,20 +110,6 @@ function getVariableDeclaratorId(node, prev) {
|
|
|
110
110
|
return getVariableDeclaratorId(node.parent, node);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
function getVariableId(node, prev) {
|
|
114
|
-
switch (true) {
|
|
115
|
-
case (node.type === types.AST_NODE_TYPES.VariableDeclarator && node.init === prev):
|
|
116
|
-
return node.id;
|
|
117
|
-
case (node.type === types.AST_NODE_TYPES.AssignmentExpression && node.right === prev):
|
|
118
|
-
return node.left;
|
|
119
|
-
case (node.type === types.AST_NODE_TYPES.PropertyDefinition && node.value === prev):
|
|
120
|
-
return node.key;
|
|
121
|
-
case (node.type === types.AST_NODE_TYPES.BlockStatement || node.type === types.AST_NODE_TYPES.Program || node.parent === node):
|
|
122
|
-
return eff._;
|
|
123
|
-
default:
|
|
124
|
-
return getVariableId(node.parent, node);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
113
|
function getVariables(initialScope) {
|
|
128
114
|
let scope = initialScope;
|
|
129
115
|
const variables = [...scope.variables];
|
|
@@ -216,9 +202,6 @@ function isNodeValueEqual(a, b, initialScopes) {
|
|
|
216
202
|
}
|
|
217
203
|
}
|
|
218
204
|
}
|
|
219
|
-
function isVariableIdEqual(a, b, initialScopes) {
|
|
220
|
-
return AST2__namespace.isNodeEqual(a, b) || isNodeValueEqual(a, b, initialScopes);
|
|
221
|
-
}
|
|
222
205
|
var ValueConstructionHint = {
|
|
223
206
|
None: 0n,
|
|
224
207
|
StrictCallExpression: 1n << 0n
|
|
@@ -300,9 +283,7 @@ exports.findVariable = findVariable2;
|
|
|
300
283
|
exports.getChidScopes = getChidScopes;
|
|
301
284
|
exports.getValueConstruction = getValueConstruction;
|
|
302
285
|
exports.getVariableDeclaratorId = getVariableDeclaratorId;
|
|
303
|
-
exports.getVariableId = getVariableId;
|
|
304
286
|
exports.getVariableNode = getVariableNode;
|
|
305
287
|
exports.getVariables = getVariables;
|
|
306
288
|
exports.isNodeValueEqual = isNodeValueEqual;
|
|
307
|
-
exports.isVariableIdEqual = isVariableIdEqual;
|
|
308
289
|
exports.toStaticValue = toStaticValue;
|
package/dist/index.mjs
CHANGED
|
@@ -88,20 +88,6 @@ function getVariableDeclaratorId(node, prev) {
|
|
|
88
88
|
return getVariableDeclaratorId(node.parent, node);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function getVariableId(node, prev) {
|
|
92
|
-
switch (true) {
|
|
93
|
-
case (node.type === AST_NODE_TYPES.VariableDeclarator && node.init === prev):
|
|
94
|
-
return node.id;
|
|
95
|
-
case (node.type === AST_NODE_TYPES.AssignmentExpression && node.right === prev):
|
|
96
|
-
return node.left;
|
|
97
|
-
case (node.type === AST_NODE_TYPES.PropertyDefinition && node.value === prev):
|
|
98
|
-
return node.key;
|
|
99
|
-
case (node.type === AST_NODE_TYPES.BlockStatement || node.type === AST_NODE_TYPES.Program || node.parent === node):
|
|
100
|
-
return _;
|
|
101
|
-
default:
|
|
102
|
-
return getVariableId(node.parent, node);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
91
|
function getVariables(initialScope) {
|
|
106
92
|
let scope = initialScope;
|
|
107
93
|
const variables = [...scope.variables];
|
|
@@ -194,9 +180,6 @@ function isNodeValueEqual(a, b, initialScopes) {
|
|
|
194
180
|
}
|
|
195
181
|
}
|
|
196
182
|
}
|
|
197
|
-
function isVariableIdEqual(a, b, initialScopes) {
|
|
198
|
-
return AST2.isNodeEqual(a, b) || isNodeValueEqual(a, b, initialScopes);
|
|
199
|
-
}
|
|
200
183
|
var ValueConstructionHint = {
|
|
201
184
|
None: 0n,
|
|
202
185
|
StrictCallExpression: 1n << 0n
|
|
@@ -272,4 +255,4 @@ function getValueConstruction(node, initialScope, hint = ValueConstructionHint.N
|
|
|
272
255
|
}
|
|
273
256
|
}
|
|
274
257
|
|
|
275
|
-
export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId,
|
|
258
|
+
export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isNodeValueEqual, toStaticValue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/var",
|
|
3
|
-
"version": "1.28.1-next.
|
|
3
|
+
"version": "1.28.1-next.7",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module for static analysis of variables.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@typescript-eslint/utils": "^8.25.0",
|
|
41
41
|
"string-ts": "^2.2.1",
|
|
42
42
|
"ts-pattern": "^5.6.2",
|
|
43
|
-
"@eslint-react/ast": "1.28.1-next.
|
|
44
|
-
"@eslint-react/eff": "1.28.1-next.
|
|
43
|
+
"@eslint-react/ast": "1.28.1-next.7",
|
|
44
|
+
"@eslint-react/eff": "1.28.1-next.7"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.4.0",
|