@eslint-react/core 2.6.1 → 2.6.2-next.0
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 +4 -4
- package/dist/index.js +6 -6
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -351,7 +351,7 @@ declare function isRenderMethodLike(node: TSESTree.Node): node is AST.TSESTreeMe
|
|
|
351
351
|
* @param node The AST node to check
|
|
352
352
|
* @returns `true` if node is a render function, `false` if not
|
|
353
353
|
*/
|
|
354
|
-
declare function isRenderFunctionLoose(context: RuleContext, node:
|
|
354
|
+
declare function isRenderFunctionLoose(context: RuleContext, node: TSESTree.Node): node is AST.TSESTreeFunction;
|
|
355
355
|
/**
|
|
356
356
|
* Unsafe check whether given JSXAttribute is a render prop
|
|
357
357
|
* ```tsx
|
|
@@ -573,7 +573,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: AST.T
|
|
|
573
573
|
readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
|
|
574
574
|
} | {
|
|
575
575
|
readonly kind: "expression";
|
|
576
|
-
readonly node: TSESTree.
|
|
576
|
+
readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
|
|
577
577
|
readonly toStatic: () => unknown;
|
|
578
578
|
} | {
|
|
579
579
|
readonly kind: "element";
|
|
@@ -581,7 +581,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: AST.T
|
|
|
581
581
|
readonly toStatic: () => undefined;
|
|
582
582
|
} | {
|
|
583
583
|
readonly kind: "spreadChild";
|
|
584
|
-
readonly node: TSESTree.
|
|
584
|
+
readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
|
|
585
585
|
readonly toStatic: () => undefined;
|
|
586
586
|
} | {
|
|
587
587
|
readonly kind: "spreadProps";
|
|
@@ -728,7 +728,7 @@ declare function stringifyJsx(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXNam
|
|
|
728
728
|
* @param node The starting node
|
|
729
729
|
* @returns The enclosing assignment target node, or undefined if not found
|
|
730
730
|
*/
|
|
731
|
-
declare function findEnclosingAssignmentTarget(node: TSESTree.Node): TSESTree.
|
|
731
|
+
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.ClassExpression | TSESTree.ConditionalExpression | 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.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldExpression | undefined;
|
|
732
732
|
/**
|
|
733
733
|
* Type representing the possible assignment targets returned by `findEnclosingAssignmentTarget`
|
|
734
734
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1081,7 +1081,7 @@ function useComponentCollectorLegacy() {
|
|
|
1081
1081
|
*/
|
|
1082
1082
|
function isThisSetState(node) {
|
|
1083
1083
|
const { callee } = node;
|
|
1084
|
-
return callee.type === AST_NODE_TYPES$1.MemberExpression && AST.
|
|
1084
|
+
return callee.type === AST_NODE_TYPES$1.MemberExpression && AST.isThisExpressionLoose(callee.object) && callee.property.type === AST_NODE_TYPES$1.Identifier && callee.property.name === "setState";
|
|
1085
1085
|
}
|
|
1086
1086
|
/**
|
|
1087
1087
|
* Check whether the given node is an assignment to this.state
|
|
@@ -1090,7 +1090,7 @@ function isThisSetState(node) {
|
|
|
1090
1090
|
*/
|
|
1091
1091
|
function isAssignmentToThisState(node) {
|
|
1092
1092
|
const { left } = node;
|
|
1093
|
-
return left.type === AST_NODE_TYPES$1.MemberExpression && AST.
|
|
1093
|
+
return left.type === AST_NODE_TYPES$1.MemberExpression && AST.isThisExpressionLoose(left.object) && AST.getPropertyName(left.property) === "state";
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
//#endregion
|
|
@@ -1172,9 +1172,9 @@ function getPhaseKindOfFunction(node) {
|
|
|
1172
1172
|
* @returns `true` if node is a render function, `false` if not
|
|
1173
1173
|
*/
|
|
1174
1174
|
function isRenderFunctionLoose(context, node) {
|
|
1175
|
-
|
|
1176
|
-
if (AST.getFunctionId(node)?.name.startsWith("render")) return
|
|
1177
|
-
return
|
|
1175
|
+
if (!AST.isFunction(node)) return false;
|
|
1176
|
+
if (AST.getFunctionId(node)?.name.startsWith("render") ?? false) return true;
|
|
1177
|
+
return node.parent.type === AST_NODE_TYPES.JSXExpressionContainer && node.parent.parent.type === AST_NODE_TYPES.JSXAttribute && node.parent.parent.name.type === AST_NODE_TYPES.JSXIdentifier && node.parent.parent.name.name.startsWith("render");
|
|
1178
1178
|
}
|
|
1179
1179
|
/**
|
|
1180
1180
|
* Unsafe check whether given JSXAttribute is a render prop
|
|
@@ -1188,7 +1188,7 @@ function isRenderFunctionLoose(context, node) {
|
|
|
1188
1188
|
*/
|
|
1189
1189
|
function isRenderPropLoose(context, node) {
|
|
1190
1190
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier) return false;
|
|
1191
|
-
return node.name.name.startsWith("render") && node.value?.type === AST_NODE_TYPES.JSXExpressionContainer &&
|
|
1191
|
+
return node.name.name.startsWith("render") && node.value?.type === AST_NODE_TYPES.JSXExpressionContainer && isRenderFunctionLoose(context, node.value.expression);
|
|
1192
1192
|
}
|
|
1193
1193
|
/**
|
|
1194
1194
|
* Unsafe check whether given node is declared directly inside a render property
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2-next.0",
|
|
4
4
|
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@typescript-eslint/utils": "^8.53.0",
|
|
36
36
|
"birecord": "^0.1.1",
|
|
37
37
|
"ts-pattern": "^5.9.0",
|
|
38
|
-
"@eslint-react/ast": "2.6.
|
|
39
|
-
"@eslint-react/eff": "2.6.
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/
|
|
38
|
+
"@eslint-react/ast": "2.6.2-next.0",
|
|
39
|
+
"@eslint-react/eff": "2.6.2-next.0",
|
|
40
|
+
"@eslint-react/shared": "2.6.2-next.0",
|
|
41
|
+
"@eslint-react/var": "2.6.2-next.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsdown": "^0.20.0-beta.3",
|