@eslint-react/core 2.7.3-next.2 → 2.7.3-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 +12 -7
- package/dist/index.js +12 -7
- 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
|
+
visitor: ESLintUtils.RuleListener;
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
|
-
* Get a ctx and
|
|
202
|
+
* Get a ctx and visitor 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 ctx and
|
|
205
|
+
* @returns The ctx and visitor 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
|
+
visitor: ESLintUtils.RuleListener;
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
|
-
* Get a ctx and
|
|
219
|
+
* Get a ctx and visitor object for the rule to collect class components
|
|
220
220
|
* @param context The ESLint rule context
|
|
221
|
-
* @returns The ctx and
|
|
221
|
+
* @returns The ctx and visitor of the collector
|
|
222
222
|
*/
|
|
223
223
|
declare function useComponentCollectorLegacy(context: RuleContext): useComponentCollectorLegacy.ReturnType;
|
|
224
224
|
/**
|
|
@@ -488,9 +488,14 @@ declare namespace useHookCollector {
|
|
|
488
488
|
getCurrentEntries(): FunctionEntry[];
|
|
489
489
|
getCurrentEntry(): FunctionEntry | unit;
|
|
490
490
|
};
|
|
491
|
-
|
|
491
|
+
visitor: ESLintUtils.RuleListener;
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
|
+
/**
|
|
495
|
+
* Get a ctx and visitor for the rule to collect hooks
|
|
496
|
+
* @param context The ESLint rule context
|
|
497
|
+
* @returns The ctx and visitor of the collector
|
|
498
|
+
*/
|
|
494
499
|
declare function useHookCollector(context: RuleContext): useHookCollector.ReturnType;
|
|
495
500
|
//#endregion
|
|
496
501
|
//#region src/hook/hook-id.d.ts
|
package/dist/index.js
CHANGED
|
@@ -169,6 +169,11 @@ function isReactHookId(id) {
|
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/hook/hook-collector.ts
|
|
171
171
|
const idGen$2 = new IdGenerator("hook_");
|
|
172
|
+
/**
|
|
173
|
+
* Get a ctx and visitor for the rule to collect hooks
|
|
174
|
+
* @param context The ESLint rule context
|
|
175
|
+
* @returns The ctx and visitor of the collector
|
|
176
|
+
*/
|
|
172
177
|
function useHookCollector(context) {
|
|
173
178
|
const hooks = /* @__PURE__ */ new Map();
|
|
174
179
|
const functionEntries = [];
|
|
@@ -212,7 +217,7 @@ function useHookCollector(context) {
|
|
|
212
217
|
getCurrentEntries: () => functionEntries,
|
|
213
218
|
getCurrentEntry
|
|
214
219
|
},
|
|
215
|
-
|
|
220
|
+
visitor: {
|
|
216
221
|
":function": onFunctionEnter,
|
|
217
222
|
":function:exit": onFunctionExit,
|
|
218
223
|
CallExpression(node) {
|
|
@@ -947,10 +952,10 @@ function hasNoneOrLooseComponentName(context, fn) {
|
|
|
947
952
|
//#region src/component/component-collector.ts
|
|
948
953
|
const idGen$1 = new IdGenerator("function_component_");
|
|
949
954
|
/**
|
|
950
|
-
* Get a ctx and
|
|
955
|
+
* Get a ctx and visitor for the rule to collect function components
|
|
951
956
|
* @param context The ESLint rule context
|
|
952
957
|
* @param options The options to use
|
|
953
|
-
* @returns The ctx and
|
|
958
|
+
* @returns The ctx and visitor of the collector
|
|
954
959
|
*/
|
|
955
960
|
function useComponentCollector(context, options = {}) {
|
|
956
961
|
const { collectDisplayName = false, collectHookCalls = false, hint = DEFAULT_COMPONENT_DETECTION_HINT } = options;
|
|
@@ -987,7 +992,7 @@ function useComponentCollector(context, options = {}) {
|
|
|
987
992
|
},
|
|
988
993
|
getCurrentEntry
|
|
989
994
|
},
|
|
990
|
-
|
|
995
|
+
visitor: {
|
|
991
996
|
":function": onFunctionEnter,
|
|
992
997
|
":function:exit": onFunctionExit,
|
|
993
998
|
"ArrowFunctionExpression[body.type!='BlockStatement']"() {
|
|
@@ -1067,9 +1072,9 @@ function useComponentCollector(context, options = {}) {
|
|
|
1067
1072
|
//#region src/component/component-collector-legacy.ts
|
|
1068
1073
|
const idGen = new IdGenerator("class_component_");
|
|
1069
1074
|
/**
|
|
1070
|
-
* Get a ctx and
|
|
1075
|
+
* Get a ctx and visitor object for the rule to collect class components
|
|
1071
1076
|
* @param context The ESLint rule context
|
|
1072
|
-
* @returns The ctx and
|
|
1077
|
+
* @returns The ctx and visitor of the collector
|
|
1073
1078
|
*/
|
|
1074
1079
|
function useComponentCollectorLegacy(context) {
|
|
1075
1080
|
const components = /* @__PURE__ */ new Map();
|
|
@@ -1097,7 +1102,7 @@ function useComponentCollectorLegacy(context) {
|
|
|
1097
1102
|
};
|
|
1098
1103
|
return {
|
|
1099
1104
|
ctx,
|
|
1100
|
-
|
|
1105
|
+
visitor: {
|
|
1101
1106
|
ClassDeclaration: collect,
|
|
1102
1107
|
ClassExpression: collect
|
|
1103
1108
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.7.3-next.
|
|
3
|
+
"version": "2.7.3-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/ast": "2.7.3-next.
|
|
39
|
-
"@eslint-react/eff": "2.7.3-next.
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/
|
|
38
|
+
"@eslint-react/ast": "2.7.3-next.3",
|
|
39
|
+
"@eslint-react/eff": "2.7.3-next.3",
|
|
40
|
+
"@eslint-react/shared": "2.7.3-next.3",
|
|
41
|
+
"@eslint-react/var": "2.7.3-next.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsdown": "^0.20.0-beta.3",
|