@eslint-react/core 1.52.0-next.0 → 1.52.1-beta.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.js +9 -5
- package/dist/index.mjs +9 -5
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -802,11 +802,15 @@ function useComponentCollector(context, options = {}) {
|
|
|
802
802
|
const entry = functionEntries.at(-1);
|
|
803
803
|
if (entry == null) return;
|
|
804
804
|
if (!entry.isComponent) return functionEntries.pop();
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
805
|
+
const rets = AST9__namespace.getNestedReturnStatements(entry.node.body);
|
|
806
|
+
for (let i = rets.length - 1; i >= 0; i--) {
|
|
807
|
+
const ret = rets[i];
|
|
808
|
+
if (ret == null) continue;
|
|
809
|
+
const shouldDrop = context.sourceCode.getScope(ret).block === entry.node && ret.argument != null && !isJsxLike(context.sourceCode, ret.argument, hint);
|
|
810
|
+
if (shouldDrop) {
|
|
811
|
+
components.delete(entry.key);
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
810
814
|
}
|
|
811
815
|
return functionEntries.pop();
|
|
812
816
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -776,11 +776,15 @@ function useComponentCollector(context, options = {}) {
|
|
|
776
776
|
const entry = functionEntries.at(-1);
|
|
777
777
|
if (entry == null) return;
|
|
778
778
|
if (!entry.isComponent) return functionEntries.pop();
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
779
|
+
const rets = AST9.getNestedReturnStatements(entry.node.body);
|
|
780
|
+
for (let i = rets.length - 1; i >= 0; i--) {
|
|
781
|
+
const ret = rets[i];
|
|
782
|
+
if (ret == null) continue;
|
|
783
|
+
const shouldDrop = context.sourceCode.getScope(ret).block === entry.node && ret.argument != null && !isJsxLike(context.sourceCode, ret.argument, hint);
|
|
784
|
+
if (shouldDrop) {
|
|
785
|
+
components.delete(entry.key);
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
784
788
|
}
|
|
785
789
|
return functionEntries.pop();
|
|
786
790
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "1.52.
|
|
3
|
+
"version": "1.52.1-beta.1",
|
|
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": {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@typescript-eslint/utils": "^8.34.0",
|
|
42
42
|
"birecord": "^0.1.1",
|
|
43
43
|
"ts-pattern": "^5.7.1",
|
|
44
|
-
"@eslint-react/ast": "1.52.
|
|
45
|
-
"@eslint-react/eff": "1.52.
|
|
46
|
-
"@eslint-react/shared": "1.52.
|
|
47
|
-
"@eslint-react/kit": "1.52.
|
|
48
|
-
"@eslint-react/var": "1.52.
|
|
44
|
+
"@eslint-react/ast": "1.52.1-beta.1",
|
|
45
|
+
"@eslint-react/eff": "1.52.1-beta.1",
|
|
46
|
+
"@eslint-react/shared": "1.52.1-beta.1",
|
|
47
|
+
"@eslint-react/kit": "1.52.1-beta.1",
|
|
48
|
+
"@eslint-react/var": "1.52.1-beta.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"tsup": "^8.5.0",
|