@eslint-react/core 2.3.13-next.2 → 2.3.13-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 +18 -0
- package/dist/index.js +18 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -291,7 +291,17 @@ declare const isGetDerivedStateFromProps: (node: TSESTree.Node) => node is AST.T
|
|
|
291
291
|
declare const isGetDerivedStateFromError: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/component/component-method-parts.d.ts
|
|
294
|
+
/**
|
|
295
|
+
* Checks if the node is a function of `componentDidMount`
|
|
296
|
+
* @param node The AST node to check
|
|
297
|
+
* @returns `true` if the node is a function of `componentDidMount`
|
|
298
|
+
*/
|
|
294
299
|
declare function isFunctionOfComponentDidMount(node: TSESTree.Node): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Checks if the node is a function of `componentWillUnmount`
|
|
302
|
+
* @param node The AST node to check
|
|
303
|
+
* @returns `true` if the node is a function of `componentWillUnmount`
|
|
304
|
+
*/
|
|
295
305
|
declare function isFunctionOfComponentWillUnmount(node: TSESTree.Node): boolean;
|
|
296
306
|
//#endregion
|
|
297
307
|
//#region src/component/component-name.d.ts
|
|
@@ -492,7 +502,15 @@ declare const REACT_BUILTIN_HOOK_NAMES: readonly ["use", "useActionState", "useC
|
|
|
492
502
|
declare function isReactHookName(name: string): boolean;
|
|
493
503
|
//#endregion
|
|
494
504
|
//#region src/hook/hook-parts.d.ts
|
|
505
|
+
/**
|
|
506
|
+
* Determines if a node is the setup function passed to a useEffect-like hook
|
|
507
|
+
* @param node The AST node to check
|
|
508
|
+
*/
|
|
495
509
|
declare function isFunctionOfUseEffectSetup(node: TSESTree.Node | unit): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Determines if a node is the cleanup function returned by a useEffect-like hook's setup function.
|
|
512
|
+
* @param node The AST node to check
|
|
513
|
+
*/
|
|
496
514
|
declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | unit): boolean;
|
|
497
515
|
//#endregion
|
|
498
516
|
//#region src/jsx/jsx-attribute.d.ts
|
package/dist/index.js
CHANGED
|
@@ -197,10 +197,18 @@ function isReactHookId(id) {
|
|
|
197
197
|
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region src/hook/hook-parts.ts
|
|
200
|
+
/**
|
|
201
|
+
* Determines if a node is the setup function passed to a useEffect-like hook
|
|
202
|
+
* @param node The AST node to check
|
|
203
|
+
*/
|
|
200
204
|
function isFunctionOfUseEffectSetup(node) {
|
|
201
205
|
if (node == null) return false;
|
|
202
206
|
return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.arguments.at(0) === node && isUseEffectLikeCall(node.parent);
|
|
203
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Determines if a node is the cleanup function returned by a useEffect-like hook's setup function.
|
|
210
|
+
* @param node The AST node to check
|
|
211
|
+
*/
|
|
204
212
|
function isFunctionOfUseEffectCleanup(node) {
|
|
205
213
|
if (node == null) return false;
|
|
206
214
|
const pReturn = AST.findParentNode(node, AST.is(AST_NODE_TYPES.ReturnStatement));
|
|
@@ -1134,9 +1142,19 @@ const isGetDerivedStateFromError = createLifecycleChecker("getDerivedStateFromEr
|
|
|
1134
1142
|
|
|
1135
1143
|
//#endregion
|
|
1136
1144
|
//#region src/component/component-method-parts.ts
|
|
1145
|
+
/**
|
|
1146
|
+
* Checks if the node is a function of `componentDidMount`
|
|
1147
|
+
* @param node The AST node to check
|
|
1148
|
+
* @returns `true` if the node is a function of `componentDidMount`
|
|
1149
|
+
*/
|
|
1137
1150
|
function isFunctionOfComponentDidMount(node) {
|
|
1138
1151
|
return AST.isFunction(node) && isComponentDidMount(node.parent) && node.parent.value === node;
|
|
1139
1152
|
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Checks if the node is a function of `componentWillUnmount`
|
|
1155
|
+
* @param node The AST node to check
|
|
1156
|
+
* @returns `true` if the node is a function of `componentWillUnmount`
|
|
1157
|
+
*/
|
|
1140
1158
|
function isFunctionOfComponentWillUnmount(node) {
|
|
1141
1159
|
return AST.isFunction(node) && isComponentWillUnmount(node.parent) && node.parent.value === node;
|
|
1142
1160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.3.13-next.
|
|
3
|
+
"version": "2.3.13-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.48.1",
|
|
36
36
|
"birecord": "^0.1.1",
|
|
37
37
|
"ts-pattern": "^5.9.0",
|
|
38
|
-
"@eslint-react/ast": "2.3.13-next.
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/
|
|
38
|
+
"@eslint-react/ast": "2.3.13-next.3",
|
|
39
|
+
"@eslint-react/eff": "2.3.13-next.3",
|
|
40
|
+
"@eslint-react/shared": "2.3.13-next.3",
|
|
41
|
+
"@eslint-react/var": "2.3.13-next.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"eslint": "^8.57.0 || ^9.0.0",
|