@eslint-react/core 1.52.1-beta.0 → 1.52.1-beta.2

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 CHANGED
@@ -802,6 +802,16 @@ 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 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
+ }
814
+ }
805
815
  return functionEntries.pop();
806
816
  };
807
817
  const ctx = {
package/dist/index.mjs CHANGED
@@ -776,6 +776,16 @@ 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 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
+ }
788
+ }
779
789
  return functionEntries.pop();
780
790
  };
781
791
  const ctx = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "1.52.1-beta.0",
3
+ "version": "1.52.1-beta.2",
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.1-beta.0",
45
- "@eslint-react/kit": "1.52.1-beta.0",
46
- "@eslint-react/eff": "1.52.1-beta.0",
47
- "@eslint-react/var": "1.52.1-beta.0",
48
- "@eslint-react/shared": "1.52.1-beta.0"
44
+ "@eslint-react/ast": "1.52.1-beta.2",
45
+ "@eslint-react/eff": "1.52.1-beta.2",
46
+ "@eslint-react/kit": "1.52.1-beta.2",
47
+ "@eslint-react/shared": "1.52.1-beta.2",
48
+ "@eslint-react/var": "1.52.1-beta.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsup": "^8.5.0",