@eslint-react/core 5.18.3 → 5.18.5
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.js +5 -17
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -1187,20 +1187,11 @@ const DEFAULT_COMPONENT_DETECTION_HINT = 0n | FunctionComponentDetectionHint.DoN
|
|
|
1187
1187
|
*/
|
|
1188
1188
|
function isFunctionComponentDefinition(context, node, hint) {
|
|
1189
1189
|
if (!isFunctionWithLooseComponentName(context, node, true)) return false;
|
|
1190
|
-
const isCreateElementArg = (() => {
|
|
1191
|
-
let p = node.parent;
|
|
1192
|
-
while (Check.isTypeExpression(p)) p = p.parent;
|
|
1193
|
-
if (p.type !== AST_NODE_TYPES.CallExpression || !isCreateElementCall(context, p)) return false;
|
|
1194
|
-
return p.arguments.slice(2).some((arg) => Extract.unwrap(arg) === node);
|
|
1195
|
-
})();
|
|
1196
|
-
switch (true) {
|
|
1197
|
-
case isCreateElementArg: return false;
|
|
1198
|
-
case isRenderMethodCallback(node): return false;
|
|
1199
|
-
}
|
|
1200
1190
|
let parent = node.parent;
|
|
1201
1191
|
while (Check.isTypeExpression(parent)) parent = parent.parent;
|
|
1202
|
-
|
|
1203
|
-
|
|
1192
|
+
if (isRenderMethodCallback(node)) return false;
|
|
1193
|
+
if (parent.type === AST_NODE_TYPES.CallExpression && isCreateElementCall(context, parent) && parent.arguments.slice(2).some((arg) => Extract.unwrap(arg) === node)) return false;
|
|
1194
|
+
const [parentCallee, parentCalleeName] = parent.type === AST_NODE_TYPES.CallExpression ? [Extract.unwrap(parent.callee), Extract.getCalleeName(parent)] : [null, null];
|
|
1204
1195
|
switch (true) {
|
|
1205
1196
|
case Check.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node) && parent.type === AST_NODE_TYPES.Property && parent.parent.type === AST_NODE_TYPES.ObjectExpression:
|
|
1206
1197
|
if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsObjectMethod) return false;
|
|
@@ -1223,9 +1214,7 @@ function isFunctionComponentDefinition(context, node, hint) {
|
|
|
1223
1214
|
case parentCallee != null && parentCallee.type === AST_NODE_TYPES.MemberExpression && parentCalleeName === "flatMap":
|
|
1224
1215
|
if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayFlatMapCallback) return false;
|
|
1225
1216
|
break;
|
|
1226
|
-
case parent.type === AST_NODE_TYPES.CallExpression && getFunctionId(node) == null && !isFunctionComponentWrapperCall(context, parent) && !isCreateElementCall(context, parent):
|
|
1227
|
-
if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArbitraryCallExpressionCallback) return false;
|
|
1228
|
-
break;
|
|
1217
|
+
case parent.type === AST_NODE_TYPES.CallExpression && getFunctionId(node) == null && !isFunctionComponentWrapperCall(context, parent) && !isCreateElementCall(context, parent): if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArbitraryCallExpressionCallback) return false;
|
|
1229
1218
|
}
|
|
1230
1219
|
const significantParent = Traverse.findParent(node, Check.isOneOf([
|
|
1231
1220
|
AST_NODE_TYPES.JSXExpressionContainer,
|
|
@@ -1788,8 +1777,7 @@ function getFullyQualifiedNameEx(checker, symbol) {
|
|
|
1788
1777
|
case ts.isMappedTypeNode(parent):
|
|
1789
1778
|
case ts.isObjectLiteralExpression(parent):
|
|
1790
1779
|
case ts.isIntersectionTypeNode(parent):
|
|
1791
|
-
case ts.isUnionTypeNode(parent):
|
|
1792
|
-
default: break;
|
|
1780
|
+
case ts.isUnionTypeNode(parent):
|
|
1793
1781
|
}
|
|
1794
1782
|
parent = parent.parent;
|
|
1795
1783
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.18.
|
|
3
|
+
"version": "5.18.5",
|
|
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": {
|
|
@@ -29,24 +29,24 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
33
|
-
"@typescript-eslint/types": "^8.
|
|
34
|
-
"@typescript-eslint/utils": "^8.
|
|
32
|
+
"@typescript-eslint/scope-manager": "^8.67.0",
|
|
33
|
+
"@typescript-eslint/types": "^8.67.0",
|
|
34
|
+
"@typescript-eslint/utils": "^8.67.0",
|
|
35
35
|
"ts-pattern": "^5.9.0",
|
|
36
|
-
"@eslint-react/ast": "5.18.
|
|
37
|
-
"@eslint-react/
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/var": "5.18.
|
|
36
|
+
"@eslint-react/ast": "5.18.5",
|
|
37
|
+
"@eslint-react/eslint": "5.18.5",
|
|
38
|
+
"@eslint-react/shared": "5.18.5",
|
|
39
|
+
"@eslint-react/var": "5.18.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
44
|
-
"eslint": "^10.8.
|
|
42
|
+
"@typescript-eslint/parser": "^8.67.0",
|
|
43
|
+
"@typescript-eslint/typescript-estree": "^8.67.0",
|
|
44
|
+
"eslint": "^10.8.1",
|
|
45
45
|
"tsdown": "^0.22.14",
|
|
46
46
|
"typescript": "6.0.3",
|
|
47
47
|
"vitest": "^4.1.10",
|
|
48
|
-
"@local/eff": "0.0.0",
|
|
49
48
|
"@local/configs": "0.0.0",
|
|
49
|
+
"@local/eff": "0.0.0",
|
|
50
50
|
"@local/testkit": "0.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|