@eslint-react/core 2.7.2-next.1 → 2.7.2-next.3
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 +7 -7
- package/dist/index.js +16 -16
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -195,14 +195,14 @@ declare namespace useComponentCollector {
|
|
|
195
195
|
getCurrentEntries: () => FunctionEntry$1[];
|
|
196
196
|
getCurrentEntry: () => FunctionEntry$1 | unit;
|
|
197
197
|
};
|
|
198
|
-
|
|
198
|
+
visitors: ESLintUtils.RuleListener;
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
|
-
* Get a ctx and
|
|
202
|
+
* Get a ctx and visitors for the rule to collect function components
|
|
203
203
|
* @param context The ESLint rule context
|
|
204
204
|
* @param options The options to use
|
|
205
|
-
* @returns The
|
|
205
|
+
* @returns The ctx and visitors of the collector
|
|
206
206
|
*/
|
|
207
207
|
declare function useComponentCollector(context: RuleContext, options?: useComponentCollector.Options): useComponentCollector.ReturnType;
|
|
208
208
|
//#endregion
|
|
@@ -212,13 +212,13 @@ declare namespace useComponentCollectorLegacy {
|
|
|
212
212
|
ctx: {
|
|
213
213
|
getAllComponents: (node: TSESTree$1.Program) => ClassComponent[];
|
|
214
214
|
};
|
|
215
|
-
|
|
215
|
+
visitors: ESLintUtils.RuleListener;
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
|
-
* Get a ctx and
|
|
219
|
+
* Get a ctx and visitors object for the rule to collect class components
|
|
220
220
|
* @param context The ESLint rule context
|
|
221
|
-
* @returns The
|
|
221
|
+
* @returns The ctx and visitors of the collector
|
|
222
222
|
*/
|
|
223
223
|
declare function useComponentCollectorLegacy(context: RuleContext): useComponentCollectorLegacy.ReturnType;
|
|
224
224
|
/**
|
|
@@ -488,7 +488,7 @@ declare namespace useHookCollector {
|
|
|
488
488
|
getCurrentEntries(): FunctionEntry[];
|
|
489
489
|
getCurrentEntry(): FunctionEntry | unit;
|
|
490
490
|
};
|
|
491
|
-
|
|
491
|
+
visitors: ESLintUtils.RuleListener;
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
494
|
declare function useHookCollector(context: RuleContext): useHookCollector.ReturnType;
|
package/dist/index.js
CHANGED
|
@@ -212,10 +212,10 @@ function useHookCollector(context) {
|
|
|
212
212
|
getCurrentEntries: () => functionEntries,
|
|
213
213
|
getCurrentEntry
|
|
214
214
|
},
|
|
215
|
-
|
|
216
|
-
":function
|
|
217
|
-
":function
|
|
218
|
-
|
|
215
|
+
visitors: {
|
|
216
|
+
":function": onFunctionEnter,
|
|
217
|
+
":function:exit": onFunctionExit,
|
|
218
|
+
CallExpression(node) {
|
|
219
219
|
if (!isReactHookCall(node)) return;
|
|
220
220
|
const fEntry = getCurrentEntry();
|
|
221
221
|
if (fEntry?.key == null) return;
|
|
@@ -947,10 +947,10 @@ function hasNoneOrLooseComponentName(context, fn) {
|
|
|
947
947
|
//#region src/component/component-collector.ts
|
|
948
948
|
const idGen$1 = new IdGenerator("function_component_");
|
|
949
949
|
/**
|
|
950
|
-
* Get a ctx and
|
|
950
|
+
* Get a ctx and visitors for the rule to collect function components
|
|
951
951
|
* @param context The ESLint rule context
|
|
952
952
|
* @param options The options to use
|
|
953
|
-
* @returns The
|
|
953
|
+
* @returns The ctx and visitors of the collector
|
|
954
954
|
*/
|
|
955
955
|
function useComponentCollector(context, options = {}) {
|
|
956
956
|
const { collectDisplayName = false, collectHookCalls = false, hint = DEFAULT_COMPONENT_DETECTION_HINT } = options;
|
|
@@ -987,9 +987,9 @@ function useComponentCollector(context, options = {}) {
|
|
|
987
987
|
},
|
|
988
988
|
getCurrentEntry
|
|
989
989
|
},
|
|
990
|
-
|
|
991
|
-
":function
|
|
992
|
-
":function
|
|
990
|
+
visitors: {
|
|
991
|
+
":function": onFunctionEnter,
|
|
992
|
+
":function:exit": onFunctionExit,
|
|
993
993
|
"ArrowFunctionExpression[body.type!='BlockStatement']"() {
|
|
994
994
|
const entry = getCurrentEntry();
|
|
995
995
|
if (entry == null) return;
|
|
@@ -1025,13 +1025,13 @@ function useComponentCollector(context, options = {}) {
|
|
|
1025
1025
|
if (component == null) return;
|
|
1026
1026
|
component.displayName = right;
|
|
1027
1027
|
} } : {},
|
|
1028
|
-
...collectHookCalls ? { "CallExpression
|
|
1028
|
+
...collectHookCalls ? { "CallExpression:exit"(node) {
|
|
1029
1029
|
if (!isReactHookCall(node)) return;
|
|
1030
1030
|
const entry = getCurrentEntry();
|
|
1031
1031
|
if (entry == null) return;
|
|
1032
1032
|
entry.hookCalls.push(node);
|
|
1033
1033
|
} } : {},
|
|
1034
|
-
|
|
1034
|
+
ReturnStatement(node) {
|
|
1035
1035
|
const entry = getCurrentEntry();
|
|
1036
1036
|
if (entry == null) return;
|
|
1037
1037
|
if (!entry.isComponentDefinition) return;
|
|
@@ -1067,9 +1067,9 @@ function useComponentCollector(context, options = {}) {
|
|
|
1067
1067
|
//#region src/component/component-collector-legacy.ts
|
|
1068
1068
|
const idGen = new IdGenerator("class_component_");
|
|
1069
1069
|
/**
|
|
1070
|
-
* Get a ctx and
|
|
1070
|
+
* Get a ctx and visitors object for the rule to collect class components
|
|
1071
1071
|
* @param context The ESLint rule context
|
|
1072
|
-
* @returns The
|
|
1072
|
+
* @returns The ctx and visitors of the collector
|
|
1073
1073
|
*/
|
|
1074
1074
|
function useComponentCollectorLegacy(context) {
|
|
1075
1075
|
const components = /* @__PURE__ */ new Map();
|
|
@@ -1097,9 +1097,9 @@ function useComponentCollectorLegacy(context) {
|
|
|
1097
1097
|
};
|
|
1098
1098
|
return {
|
|
1099
1099
|
ctx,
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1100
|
+
visitors: {
|
|
1101
|
+
ClassDeclaration: collect,
|
|
1102
|
+
ClassExpression: collect
|
|
1103
1103
|
}
|
|
1104
1104
|
};
|
|
1105
1105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.7.2-next.
|
|
3
|
+
"version": "2.7.2-next.3",
|
|
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/
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/
|
|
38
|
+
"@eslint-react/shared": "2.7.2-next.3",
|
|
39
|
+
"@eslint-react/ast": "2.7.2-next.3",
|
|
40
|
+
"@eslint-react/var": "2.7.2-next.3",
|
|
41
|
+
"@eslint-react/eff": "2.7.2-next.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsdown": "^0.20.0-beta.3",
|