@eslint-react/var 5.2.1-beta.1 → 5.2.1-beta.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/dist/index.d.ts +14 -14
- package/dist/index.js +20 -20
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -40,19 +40,6 @@ type ObjectType = {
|
|
|
40
40
|
*/
|
|
41
41
|
declare function computeObjectType(context: RuleContext, node: TSESTree.Node | null): ObjectType | null;
|
|
42
42
|
//#endregion
|
|
43
|
-
//#region src/find-enclosing-assignment-target.d.ts
|
|
44
|
-
/**
|
|
45
|
-
* Finds the enclosing assignment target (variable, property, etc.) for a given node
|
|
46
|
-
*
|
|
47
|
-
* @param node The starting node
|
|
48
|
-
* @returns The enclosing assignment target node, or null if not found
|
|
49
|
-
*/
|
|
50
|
-
declare function findEnclosingAssignmentTarget(node: TSESTree.Node): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSDeclareFunctionNoDeclare | TSESTree.TSDeclareFunctionWithDeclare | TSESTree.TSEnumDeclaration | TSESTree.TSInstantiationExpression | TSESTree.TSInterfaceDeclaration | TSESTree.TSModuleDeclarationGlobal | TSESTree.TSModuleDeclarationModuleWithIdentifierId | TSESTree.TSModuleDeclarationModuleWithStringIdDeclared | TSESTree.TSModuleDeclarationModuleWithStringIdNotDeclared | TSESTree.TSModuleDeclarationNamespace | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAliasDeclaration | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.ConstDeclaration | TSESTree.LetOrVarDeclaredDeclaration | TSESTree.LetOrVarNonDeclaredDeclaration | TSESTree.UsingInForOfDeclaration | TSESTree.UsingInNormalContextDeclaration | TSESTree.YieldExpression | null;
|
|
51
|
-
/**
|
|
52
|
-
* Type representing the possible assignment targets returned by `findEnclosingAssignmentTarget`
|
|
53
|
-
*/
|
|
54
|
-
type AssignmentTarget = ReturnType<typeof findEnclosingAssignmentTarget>;
|
|
55
|
-
//#endregion
|
|
56
43
|
//#region src/get-require-expression-arguments.d.ts
|
|
57
44
|
/**
|
|
58
45
|
* Get the arguments of a require expression
|
|
@@ -120,7 +107,20 @@ declare function resolve(context: RuleContext, node: TSESTree.Identifier, option
|
|
|
120
107
|
localOnly: boolean;
|
|
121
108
|
}>): TSESTree.Node | null;
|
|
122
109
|
//#endregion
|
|
110
|
+
//#region src/resolve-enclosing-assignment-target.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Finds the enclosing assignment target (variable, property, etc.) for a given node
|
|
113
|
+
*
|
|
114
|
+
* @param node The starting node
|
|
115
|
+
* @returns The enclosing assignment target node, or null if not found
|
|
116
|
+
*/
|
|
117
|
+
declare function resolveEnclosingAssignmentTarget(node: TSESTree.Node): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSDeclareFunctionNoDeclare | TSESTree.TSDeclareFunctionWithDeclare | TSESTree.TSEnumDeclaration | TSESTree.TSInstantiationExpression | TSESTree.TSInterfaceDeclaration | TSESTree.TSModuleDeclarationGlobal | TSESTree.TSModuleDeclarationModuleWithIdentifierId | TSESTree.TSModuleDeclarationModuleWithStringIdDeclared | TSESTree.TSModuleDeclarationModuleWithStringIdNotDeclared | TSESTree.TSModuleDeclarationNamespace | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAliasDeclaration | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.ConstDeclaration | TSESTree.LetOrVarDeclaredDeclaration | TSESTree.LetOrVarNonDeclaredDeclaration | TSESTree.UsingInForOfDeclaration | TSESTree.UsingInNormalContextDeclaration | TSESTree.YieldExpression | null;
|
|
118
|
+
/**
|
|
119
|
+
* Type representing the possible assignment targets returned by `resolveEnclosingAssignmentTarget`
|
|
120
|
+
*/
|
|
121
|
+
type AssignmentTarget = ReturnType<typeof resolveEnclosingAssignmentTarget>;
|
|
122
|
+
//#endregion
|
|
123
123
|
//#region src/resolve-import-source.d.ts
|
|
124
124
|
declare function resolveImportSource(name: string, initialScope: Scope, visited?: Set<string>): string | null;
|
|
125
125
|
//#endregion
|
|
126
|
-
export { AssignmentTarget, ObjectType, computeObjectType,
|
|
126
|
+
export { AssignmentTarget, ObjectType, computeObjectType, getRequireExpressionArguments, isAssignmentTargetEqual, isValueEqual, resolve, resolveEnclosingAssignmentTarget, resolveImportSource };
|
package/dist/index.js
CHANGED
|
@@ -173,25 +173,6 @@ function computeObjectType(context, node) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region src/find-enclosing-assignment-target.ts
|
|
178
|
-
/**
|
|
179
|
-
* Finds the enclosing assignment target (variable, property, etc.) for a given node
|
|
180
|
-
*
|
|
181
|
-
* @param node The starting node
|
|
182
|
-
* @returns The enclosing assignment target node, or null if not found
|
|
183
|
-
*/
|
|
184
|
-
function findEnclosingAssignmentTarget(node) {
|
|
185
|
-
switch (true) {
|
|
186
|
-
case node.type === AST_NODE_TYPES.VariableDeclarator: return node.id;
|
|
187
|
-
case node.type === AST_NODE_TYPES.AssignmentExpression: return node.left;
|
|
188
|
-
case node.type === AST_NODE_TYPES.PropertyDefinition: return node.key;
|
|
189
|
-
case node.type === AST_NODE_TYPES.ExportDefaultDeclaration: return node.declaration;
|
|
190
|
-
case node.type === AST_NODE_TYPES.BlockStatement || node.type === AST_NODE_TYPES.Program: return null;
|
|
191
|
-
default: return findEnclosingAssignmentTarget(node.parent);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
176
|
//#endregion
|
|
196
177
|
//#region ../../.pkgs/eff/dist/index.js
|
|
197
178
|
/**
|
|
@@ -424,6 +405,25 @@ function isAssignmentTargetEqual(context, a, b) {
|
|
|
424
405
|
return ast.isNodeEqual(a, b) || isValueEqual(context, a, b);
|
|
425
406
|
}
|
|
426
407
|
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region src/resolve-enclosing-assignment-target.ts
|
|
410
|
+
/**
|
|
411
|
+
* Finds the enclosing assignment target (variable, property, etc.) for a given node
|
|
412
|
+
*
|
|
413
|
+
* @param node The starting node
|
|
414
|
+
* @returns The enclosing assignment target node, or null if not found
|
|
415
|
+
*/
|
|
416
|
+
function resolveEnclosingAssignmentTarget(node) {
|
|
417
|
+
switch (true) {
|
|
418
|
+
case node.type === AST_NODE_TYPES.VariableDeclarator: return node.id;
|
|
419
|
+
case node.type === AST_NODE_TYPES.AssignmentExpression: return node.left;
|
|
420
|
+
case node.type === AST_NODE_TYPES.PropertyDefinition: return node.key;
|
|
421
|
+
case node.type === AST_NODE_TYPES.ExportDefaultDeclaration: return node.declaration;
|
|
422
|
+
case node.type === AST_NODE_TYPES.BlockStatement || node.type === AST_NODE_TYPES.Program: return null;
|
|
423
|
+
default: return resolveEnclosingAssignmentTarget(node.parent);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
427
|
//#endregion
|
|
428
428
|
//#region src/resolve-import-source.ts
|
|
429
429
|
function resolveImportSource(name, initialScope, visited = /* @__PURE__ */ new Set()) {
|
|
@@ -445,4 +445,4 @@ function resolveImportSource(name, initialScope, visited = /* @__PURE__ */ new S
|
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
//#endregion
|
|
448
|
-
export { computeObjectType,
|
|
448
|
+
export { computeObjectType, getRequireExpressionArguments, isAssignmentTargetEqual, isValueEqual, resolve, resolveEnclosingAssignmentTarget, resolveImportSource };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/var",
|
|
3
|
-
"version": "5.2.1-beta.
|
|
3
|
+
"version": "5.2.1-beta.3",
|
|
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": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"@typescript-eslint/types": "^8.58.1",
|
|
35
35
|
"@typescript-eslint/utils": "^8.58.1",
|
|
36
36
|
"ts-pattern": "^5.9.0",
|
|
37
|
-
"@eslint-react/ast": "5.2.1-beta.
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/
|
|
37
|
+
"@eslint-react/ast": "5.2.1-beta.3",
|
|
38
|
+
"@eslint-react/shared": "5.2.1-beta.3",
|
|
39
|
+
"@eslint-react/eslint": "5.2.1-beta.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@typescript-eslint/typescript-estree": "^8.58.1",
|