@eslint-react/core 2.7.2-next.0 → 2.7.2-next.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.d.ts CHANGED
@@ -118,9 +118,13 @@ interface FunctionComponent extends SemanticNode {
118
118
  */
119
119
  initPath: unit | AST.FunctionInitPath;
120
120
  /**
121
- * Indicates if the component is exported as default
121
+ * Indicates if the component is inside an export default declaration
122
122
  */
123
123
  isExportDefault: boolean;
124
+ /**
125
+ * Indicates if the component is itself an export default declaration
126
+ */
127
+ isExportDefaultDeclaration: boolean;
124
128
  /**
125
129
  * List of hook calls within the component
126
130
  */
@@ -176,6 +180,7 @@ type FunctionEntry$1 = {
176
180
  isComponent: boolean;
177
181
  isComponentDefinition: boolean;
178
182
  isExportDefault: boolean;
183
+ isExportDefaultDeclaration: boolean;
179
184
  rets: TSESTree.ReturnStatement["argument"][];
180
185
  };
181
186
  declare namespace useComponentCollector {
package/dist/index.js CHANGED
@@ -960,13 +960,17 @@ function useComponentCollector(context, options = {}) {
960
960
  const getCurrentEntry = () => functionEntries.at(-1);
961
961
  const onFunctionEnter = (node) => {
962
962
  const key = idGen$1.next();
963
+ const exp = AST.findParentNode(node, (n) => n.type === AST_NODE_TYPES.ExportDefaultDeclaration);
964
+ const isExportDefault = exp != null;
965
+ const isExportDefaultDeclaration = exp != null && AST.getUnderlyingExpression(exp.declaration) === node;
963
966
  functionEntries.push({
964
967
  key,
965
968
  node,
966
969
  hookCalls: [],
967
970
  isComponent: false,
968
971
  isComponentDefinition: isComponentDefinition(context, node, hint),
969
- isExportDefault: AST.findParentNode(node, (n) => n.type === AST_NODE_TYPES.ExportDefaultDeclaration) != null,
972
+ isExportDefault,
973
+ isExportDefaultDeclaration,
970
974
  rets: []
971
975
  });
972
976
  };
@@ -1009,6 +1013,7 @@ function useComponentCollector(context, options = {}) {
1009
1013
  hookCalls: entry.hookCalls,
1010
1014
  initPath,
1011
1015
  isExportDefault: entry.isExportDefault,
1016
+ isExportDefaultDeclaration: entry.isExportDefaultDeclaration,
1012
1017
  rets: [body]
1013
1018
  });
1014
1019
  },
@@ -1050,6 +1055,7 @@ function useComponentCollector(context, options = {}) {
1050
1055
  hookCalls: entry.hookCalls,
1051
1056
  initPath,
1052
1057
  isExportDefault: entry.isExportDefault,
1058
+ isExportDefaultDeclaration: entry.isExportDefaultDeclaration,
1053
1059
  rets: entry.rets
1054
1060
  });
1055
1061
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "2.7.2-next.0",
3
+ "version": "2.7.2-next.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": {
@@ -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.7.2-next.0",
39
- "@eslint-react/shared": "2.7.2-next.0",
40
- "@eslint-react/var": "2.7.2-next.0",
41
- "@eslint-react/eff": "2.7.2-next.0"
38
+ "@eslint-react/ast": "2.7.2-next.2",
39
+ "@eslint-react/eff": "2.7.2-next.2",
40
+ "@eslint-react/shared": "2.7.2-next.2",
41
+ "@eslint-react/var": "2.7.2-next.2"
42
42
  },
43
43
  "devDependencies": {
44
44
  "tsdown": "^0.20.0-beta.3",