@eslint-react/core 1.23.3-next.8 → 1.24.0-next.0
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.mts +47 -45
- package/dist/index.d.ts +47 -45
- package/dist/index.js +186 -208
- package/dist/index.mjs +140 -162
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import * as AST from '@eslint-react/ast';
|
|
2
|
-
import
|
|
2
|
+
import * as _eslint_react_eff from '@eslint-react/eff';
|
|
3
|
+
import { _ } from '@eslint-react/eff';
|
|
3
4
|
import { TSESTree } from '@typescript-eslint/types';
|
|
4
5
|
import * as _eslint_react_types from '@eslint-react/types';
|
|
5
6
|
import { RuleContext } from '@eslint-react/types';
|
|
6
7
|
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
8
|
+
import { CustomComponentNormalized } from '@eslint-react/shared';
|
|
7
9
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
8
10
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
9
11
|
import { SyntaxKind } from 'typescript';
|
|
10
12
|
|
|
11
13
|
interface ERSemanticNode {
|
|
12
14
|
_: string;
|
|
13
|
-
id:
|
|
15
|
+
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
|
|
14
16
|
kind: string;
|
|
15
|
-
name:
|
|
17
|
+
name: _ | string;
|
|
16
18
|
node: TSESTree.Node;
|
|
17
19
|
flag: bigint;
|
|
18
20
|
hint: bigint;
|
|
@@ -57,41 +59,41 @@ declare const ERFunctionComponentFlag: {
|
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
interface ERFunctionComponent extends ERSemanticNode {
|
|
60
|
-
id:
|
|
62
|
+
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
|
|
61
63
|
kind: "function";
|
|
62
64
|
node: AST.TSESTreeFunction;
|
|
63
65
|
flag: ERFunctionComponentFlag;
|
|
64
66
|
hint: ERComponentHint;
|
|
65
|
-
initPath:
|
|
67
|
+
initPath: _ | AST.FunctionInitPath;
|
|
66
68
|
hookCalls: TSESTree.CallExpression[];
|
|
67
|
-
displayName:
|
|
69
|
+
displayName: _ | TSESTree.Expression;
|
|
68
70
|
}
|
|
69
71
|
interface ERClassComponent extends ERSemanticNode {
|
|
70
|
-
id:
|
|
72
|
+
id: _ | TSESTree.Identifier;
|
|
71
73
|
kind: "class";
|
|
72
74
|
node: AST.TSESTreeClass;
|
|
73
75
|
flag: ERClassComponentFlag;
|
|
74
76
|
hint: ERComponentHint;
|
|
75
|
-
methods:
|
|
76
|
-
displayName:
|
|
77
|
+
methods: Array<TSESTree.MethodDefinition | TSESTree.PropertyDefinition>;
|
|
78
|
+
displayName: _ | TSESTree.Expression;
|
|
77
79
|
}
|
|
78
80
|
type ERComponent = ERClassComponent | ERFunctionComponent;
|
|
79
81
|
|
|
80
82
|
declare function useComponentCollector(context: RuleContext, hint?: bigint): {
|
|
81
83
|
readonly ctx: {
|
|
82
|
-
readonly getAllComponents: (
|
|
83
|
-
readonly
|
|
84
|
+
readonly getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
|
|
85
|
+
readonly getCurrentEntries: () => {
|
|
84
86
|
key: string;
|
|
85
87
|
node: AST.TSESTreeFunction;
|
|
86
88
|
hookCalls: TSESTree.CallExpression[];
|
|
87
89
|
isComponent: boolean;
|
|
88
|
-
}
|
|
89
|
-
readonly
|
|
90
|
+
}[];
|
|
91
|
+
readonly getCurrentEntry: () => {
|
|
90
92
|
key: string;
|
|
91
93
|
node: AST.TSESTreeFunction;
|
|
92
94
|
hookCalls: TSESTree.CallExpression[];
|
|
93
95
|
isComponent: boolean;
|
|
94
|
-
}
|
|
96
|
+
} | undefined;
|
|
95
97
|
};
|
|
96
98
|
readonly listeners: {
|
|
97
99
|
readonly ":function[type]": (node: AST.TSESTreeFunction) => void;
|
|
@@ -112,7 +114,7 @@ declare function useComponentCollector(context: RuleContext, hint?: bigint): {
|
|
|
112
114
|
|
|
113
115
|
declare function useComponentCollectorLegacy(): {
|
|
114
116
|
readonly ctx: {
|
|
115
|
-
readonly getAllComponents: (
|
|
117
|
+
readonly getAllComponents: (node: TSESTree$1.Program) => Map<string, ERClassComponent>;
|
|
116
118
|
};
|
|
117
119
|
readonly listeners: {
|
|
118
120
|
readonly "ClassDeclaration[type]": (node: AST.TSESTreeClass) => void;
|
|
@@ -120,7 +122,7 @@ declare function useComponentCollectorLegacy(): {
|
|
|
120
122
|
};
|
|
121
123
|
};
|
|
122
124
|
|
|
123
|
-
declare function getFunctionComponentIdentifier(node: AST.TSESTreeFunction, context: RuleContext):
|
|
125
|
+
declare function getFunctionComponentIdentifier(node: AST.TSESTreeFunction, context: RuleContext): TSESTree.Identifier | TSESTree.Identifier[] | _;
|
|
124
126
|
|
|
125
127
|
type ERComponentKind = "classComponent" | "functionComponent";
|
|
126
128
|
|
|
@@ -167,10 +169,10 @@ declare function hasNoneOrValidComponentName(node: AST.TSESTreeFunction, context
|
|
|
167
169
|
|
|
168
170
|
type EREffectKind = "effect" | "insertionEffect" | "layoutEffect";
|
|
169
171
|
|
|
170
|
-
declare function isSetupFunction(node: TSESTree.Node): boolean;
|
|
171
|
-
declare function isCleanupFunction(node: TSESTree.Node): boolean;
|
|
172
|
+
declare function isSetupFunction(node: TSESTree.Node | _): boolean | undefined;
|
|
173
|
+
declare function isCleanupFunction(node: TSESTree.Node): boolean | undefined;
|
|
172
174
|
|
|
173
|
-
declare function
|
|
175
|
+
declare function getElementNameAndRepresentName(node: TSESTree.JSXOpeningElement, context: RuleContext, polymorphicPropName?: string, additionalComponents?: CustomComponentNormalized[]): [string, string];
|
|
174
176
|
|
|
175
177
|
/**
|
|
176
178
|
* Determines whether inside `createElement`'s props.
|
|
@@ -187,18 +189,18 @@ declare function isInsideCreateElementProps(node: TSESTree.Node, context: RuleCo
|
|
|
187
189
|
*/
|
|
188
190
|
declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
|
|
189
191
|
|
|
190
|
-
declare function isInsideReactHook(node: TSESTree.Node): boolean;
|
|
192
|
+
declare function isInsideReactHook(node: TSESTree.Node): boolean | undefined;
|
|
191
193
|
|
|
192
194
|
interface ERHook extends ERSemanticNode {
|
|
193
|
-
id:
|
|
195
|
+
id: TSESTree.Identifier | _;
|
|
194
196
|
node: AST.TSESTreeFunction;
|
|
195
|
-
name:
|
|
197
|
+
name: string;
|
|
196
198
|
hookCalls: TSESTree.CallExpression[];
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
declare function useHookCollector(): {
|
|
200
202
|
readonly ctx: {
|
|
201
|
-
readonly getAllHooks: (
|
|
203
|
+
readonly getAllHooks: (node: TSESTree$1.Program) => Map<string, ERHook>;
|
|
202
204
|
readonly getCurrentHooks: () => Map<string, ERHook>;
|
|
203
205
|
};
|
|
204
206
|
readonly listeners: {
|
|
@@ -213,39 +215,39 @@ type ERHookKind = "custom" | "useActionState" | "useCallback" | "useContext" | "
|
|
|
213
215
|
declare const RE_HOOK_NAME: RegExp;
|
|
214
216
|
declare function isReactHookName(name: string): boolean;
|
|
215
217
|
|
|
216
|
-
declare function isReactHook(node: AST.TSESTreeFunction): boolean;
|
|
218
|
+
declare function isReactHook(node: AST.TSESTreeFunction | _): boolean | undefined;
|
|
217
219
|
/**
|
|
218
220
|
* Check if the given node is a React Hook call by its name.
|
|
219
221
|
* @param node The node to check.
|
|
220
222
|
* @returns `true` if the node is a React Hook call, `false` otherwise.
|
|
221
223
|
*/
|
|
222
|
-
declare function isReactHookCall(node: TSESTree.Node): boolean;
|
|
223
|
-
declare function isReactHookCallWithName(node: TSESTree.CallExpression, context: RuleContext): (name: string) => boolean;
|
|
224
|
-
declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression): (name: string) => boolean;
|
|
224
|
+
declare function isReactHookCall(node: TSESTree.Node | _): boolean;
|
|
225
|
+
declare function isReactHookCallWithName(node: TSESTree.CallExpression | _, context: RuleContext): (name: string) => boolean;
|
|
226
|
+
declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression | _): (name: string) => boolean;
|
|
225
227
|
declare function isReactHookCallWithNameAlias(name: string, context: RuleContext, alias: string[]): (node: TSESTree.CallExpression) => boolean;
|
|
226
|
-
declare function isUseEffectCallLoose(node: TSESTree.Node): boolean;
|
|
227
|
-
declare const isUseCallbackCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
228
|
-
declare const isUseContextCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
229
|
-
declare const isUseDebugValueCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
230
|
-
declare const isUseDeferredValueCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
231
|
-
declare const isUseEffectCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
232
|
-
declare const isUseIdCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
233
|
-
declare const isUseImperativeHandleCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
234
|
-
declare const isUseInsertionEffectCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
235
|
-
declare const isUseLayoutEffectCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
236
|
-
declare const isUseMemoCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
237
|
-
declare const isUseReducerCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
238
|
-
declare const isUseRefCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
239
|
-
declare const isUseStateCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
240
|
-
declare const isUseSyncExternalStoreCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
241
|
-
declare const isUseTransitionCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
228
|
+
declare function isUseEffectCallLoose(node: TSESTree.Node | _): boolean;
|
|
229
|
+
declare const isUseCallbackCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
230
|
+
declare const isUseContextCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
231
|
+
declare const isUseDebugValueCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
232
|
+
declare const isUseDeferredValueCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
233
|
+
declare const isUseEffectCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
234
|
+
declare const isUseIdCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
235
|
+
declare const isUseImperativeHandleCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
236
|
+
declare const isUseInsertionEffectCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
237
|
+
declare const isUseLayoutEffectCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
238
|
+
declare const isUseMemoCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
239
|
+
declare const isUseReducerCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
240
|
+
declare const isUseRefCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
241
|
+
declare const isUseStateCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
242
|
+
declare const isUseSyncExternalStoreCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
243
|
+
declare const isUseTransitionCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
242
244
|
|
|
243
245
|
declare function isComponentDidMount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
|
|
244
246
|
declare function isComponentWillUnmount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
|
|
245
247
|
declare function isComponentDidMountFunction(node: TSESTree.Node): boolean;
|
|
246
248
|
declare function isComponentWillUnmountFunction(node: TSESTree.Node): boolean;
|
|
247
249
|
|
|
248
|
-
declare const ERPhaseRelevance:
|
|
250
|
+
declare const ERPhaseRelevance: _eslint_react_eff.BiRecord<{
|
|
249
251
|
readonly mount: "unmount";
|
|
250
252
|
readonly setup: "cleanup";
|
|
251
253
|
}>;
|
|
@@ -2573,4 +2575,4 @@ declare const isMemoCall: {
|
|
|
2573
2575
|
(node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
|
|
2574
2576
|
};
|
|
2575
2577
|
|
|
2576
|
-
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier,
|
|
2578
|
+
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementNameAndRepresentName, getFunctionComponentIdentifier, getId, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isSetupFunction, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import * as AST from '@eslint-react/ast';
|
|
2
|
-
import
|
|
2
|
+
import * as _eslint_react_eff from '@eslint-react/eff';
|
|
3
|
+
import { _ } from '@eslint-react/eff';
|
|
3
4
|
import { TSESTree } from '@typescript-eslint/types';
|
|
4
5
|
import * as _eslint_react_types from '@eslint-react/types';
|
|
5
6
|
import { RuleContext } from '@eslint-react/types';
|
|
6
7
|
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
8
|
+
import { CustomComponentNormalized } from '@eslint-react/shared';
|
|
7
9
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
8
10
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
9
11
|
import { SyntaxKind } from 'typescript';
|
|
10
12
|
|
|
11
13
|
interface ERSemanticNode {
|
|
12
14
|
_: string;
|
|
13
|
-
id:
|
|
15
|
+
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
|
|
14
16
|
kind: string;
|
|
15
|
-
name:
|
|
17
|
+
name: _ | string;
|
|
16
18
|
node: TSESTree.Node;
|
|
17
19
|
flag: bigint;
|
|
18
20
|
hint: bigint;
|
|
@@ -57,41 +59,41 @@ declare const ERFunctionComponentFlag: {
|
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
interface ERFunctionComponent extends ERSemanticNode {
|
|
60
|
-
id:
|
|
62
|
+
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
|
|
61
63
|
kind: "function";
|
|
62
64
|
node: AST.TSESTreeFunction;
|
|
63
65
|
flag: ERFunctionComponentFlag;
|
|
64
66
|
hint: ERComponentHint;
|
|
65
|
-
initPath:
|
|
67
|
+
initPath: _ | AST.FunctionInitPath;
|
|
66
68
|
hookCalls: TSESTree.CallExpression[];
|
|
67
|
-
displayName:
|
|
69
|
+
displayName: _ | TSESTree.Expression;
|
|
68
70
|
}
|
|
69
71
|
interface ERClassComponent extends ERSemanticNode {
|
|
70
|
-
id:
|
|
72
|
+
id: _ | TSESTree.Identifier;
|
|
71
73
|
kind: "class";
|
|
72
74
|
node: AST.TSESTreeClass;
|
|
73
75
|
flag: ERClassComponentFlag;
|
|
74
76
|
hint: ERComponentHint;
|
|
75
|
-
methods:
|
|
76
|
-
displayName:
|
|
77
|
+
methods: Array<TSESTree.MethodDefinition | TSESTree.PropertyDefinition>;
|
|
78
|
+
displayName: _ | TSESTree.Expression;
|
|
77
79
|
}
|
|
78
80
|
type ERComponent = ERClassComponent | ERFunctionComponent;
|
|
79
81
|
|
|
80
82
|
declare function useComponentCollector(context: RuleContext, hint?: bigint): {
|
|
81
83
|
readonly ctx: {
|
|
82
|
-
readonly getAllComponents: (
|
|
83
|
-
readonly
|
|
84
|
+
readonly getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
|
|
85
|
+
readonly getCurrentEntries: () => {
|
|
84
86
|
key: string;
|
|
85
87
|
node: AST.TSESTreeFunction;
|
|
86
88
|
hookCalls: TSESTree.CallExpression[];
|
|
87
89
|
isComponent: boolean;
|
|
88
|
-
}
|
|
89
|
-
readonly
|
|
90
|
+
}[];
|
|
91
|
+
readonly getCurrentEntry: () => {
|
|
90
92
|
key: string;
|
|
91
93
|
node: AST.TSESTreeFunction;
|
|
92
94
|
hookCalls: TSESTree.CallExpression[];
|
|
93
95
|
isComponent: boolean;
|
|
94
|
-
}
|
|
96
|
+
} | undefined;
|
|
95
97
|
};
|
|
96
98
|
readonly listeners: {
|
|
97
99
|
readonly ":function[type]": (node: AST.TSESTreeFunction) => void;
|
|
@@ -112,7 +114,7 @@ declare function useComponentCollector(context: RuleContext, hint?: bigint): {
|
|
|
112
114
|
|
|
113
115
|
declare function useComponentCollectorLegacy(): {
|
|
114
116
|
readonly ctx: {
|
|
115
|
-
readonly getAllComponents: (
|
|
117
|
+
readonly getAllComponents: (node: TSESTree$1.Program) => Map<string, ERClassComponent>;
|
|
116
118
|
};
|
|
117
119
|
readonly listeners: {
|
|
118
120
|
readonly "ClassDeclaration[type]": (node: AST.TSESTreeClass) => void;
|
|
@@ -120,7 +122,7 @@ declare function useComponentCollectorLegacy(): {
|
|
|
120
122
|
};
|
|
121
123
|
};
|
|
122
124
|
|
|
123
|
-
declare function getFunctionComponentIdentifier(node: AST.TSESTreeFunction, context: RuleContext):
|
|
125
|
+
declare function getFunctionComponentIdentifier(node: AST.TSESTreeFunction, context: RuleContext): TSESTree.Identifier | TSESTree.Identifier[] | _;
|
|
124
126
|
|
|
125
127
|
type ERComponentKind = "classComponent" | "functionComponent";
|
|
126
128
|
|
|
@@ -167,10 +169,10 @@ declare function hasNoneOrValidComponentName(node: AST.TSESTreeFunction, context
|
|
|
167
169
|
|
|
168
170
|
type EREffectKind = "effect" | "insertionEffect" | "layoutEffect";
|
|
169
171
|
|
|
170
|
-
declare function isSetupFunction(node: TSESTree.Node): boolean;
|
|
171
|
-
declare function isCleanupFunction(node: TSESTree.Node): boolean;
|
|
172
|
+
declare function isSetupFunction(node: TSESTree.Node | _): boolean | undefined;
|
|
173
|
+
declare function isCleanupFunction(node: TSESTree.Node): boolean | undefined;
|
|
172
174
|
|
|
173
|
-
declare function
|
|
175
|
+
declare function getElementNameAndRepresentName(node: TSESTree.JSXOpeningElement, context: RuleContext, polymorphicPropName?: string, additionalComponents?: CustomComponentNormalized[]): [string, string];
|
|
174
176
|
|
|
175
177
|
/**
|
|
176
178
|
* Determines whether inside `createElement`'s props.
|
|
@@ -187,18 +189,18 @@ declare function isInsideCreateElementProps(node: TSESTree.Node, context: RuleCo
|
|
|
187
189
|
*/
|
|
188
190
|
declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleContext): boolean;
|
|
189
191
|
|
|
190
|
-
declare function isInsideReactHook(node: TSESTree.Node): boolean;
|
|
192
|
+
declare function isInsideReactHook(node: TSESTree.Node): boolean | undefined;
|
|
191
193
|
|
|
192
194
|
interface ERHook extends ERSemanticNode {
|
|
193
|
-
id:
|
|
195
|
+
id: TSESTree.Identifier | _;
|
|
194
196
|
node: AST.TSESTreeFunction;
|
|
195
|
-
name:
|
|
197
|
+
name: string;
|
|
196
198
|
hookCalls: TSESTree.CallExpression[];
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
declare function useHookCollector(): {
|
|
200
202
|
readonly ctx: {
|
|
201
|
-
readonly getAllHooks: (
|
|
203
|
+
readonly getAllHooks: (node: TSESTree$1.Program) => Map<string, ERHook>;
|
|
202
204
|
readonly getCurrentHooks: () => Map<string, ERHook>;
|
|
203
205
|
};
|
|
204
206
|
readonly listeners: {
|
|
@@ -213,39 +215,39 @@ type ERHookKind = "custom" | "useActionState" | "useCallback" | "useContext" | "
|
|
|
213
215
|
declare const RE_HOOK_NAME: RegExp;
|
|
214
216
|
declare function isReactHookName(name: string): boolean;
|
|
215
217
|
|
|
216
|
-
declare function isReactHook(node: AST.TSESTreeFunction): boolean;
|
|
218
|
+
declare function isReactHook(node: AST.TSESTreeFunction | _): boolean | undefined;
|
|
217
219
|
/**
|
|
218
220
|
* Check if the given node is a React Hook call by its name.
|
|
219
221
|
* @param node The node to check.
|
|
220
222
|
* @returns `true` if the node is a React Hook call, `false` otherwise.
|
|
221
223
|
*/
|
|
222
|
-
declare function isReactHookCall(node: TSESTree.Node): boolean;
|
|
223
|
-
declare function isReactHookCallWithName(node: TSESTree.CallExpression, context: RuleContext): (name: string) => boolean;
|
|
224
|
-
declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression): (name: string) => boolean;
|
|
224
|
+
declare function isReactHookCall(node: TSESTree.Node | _): boolean;
|
|
225
|
+
declare function isReactHookCallWithName(node: TSESTree.CallExpression | _, context: RuleContext): (name: string) => boolean;
|
|
226
|
+
declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression | _): (name: string) => boolean;
|
|
225
227
|
declare function isReactHookCallWithNameAlias(name: string, context: RuleContext, alias: string[]): (node: TSESTree.CallExpression) => boolean;
|
|
226
|
-
declare function isUseEffectCallLoose(node: TSESTree.Node): boolean;
|
|
227
|
-
declare const isUseCallbackCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
228
|
-
declare const isUseContextCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
229
|
-
declare const isUseDebugValueCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
230
|
-
declare const isUseDeferredValueCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
231
|
-
declare const isUseEffectCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
232
|
-
declare const isUseIdCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
233
|
-
declare const isUseImperativeHandleCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
234
|
-
declare const isUseInsertionEffectCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
235
|
-
declare const isUseLayoutEffectCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
236
|
-
declare const isUseMemoCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
237
|
-
declare const isUseReducerCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
238
|
-
declare const isUseRefCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
239
|
-
declare const isUseStateCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
240
|
-
declare const isUseSyncExternalStoreCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
241
|
-
declare const isUseTransitionCall: (node: TSESTree.CallExpression, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
228
|
+
declare function isUseEffectCallLoose(node: TSESTree.Node | _): boolean;
|
|
229
|
+
declare const isUseCallbackCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
230
|
+
declare const isUseContextCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
231
|
+
declare const isUseDebugValueCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
232
|
+
declare const isUseDeferredValueCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
233
|
+
declare const isUseEffectCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
234
|
+
declare const isUseIdCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
235
|
+
declare const isUseImperativeHandleCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
236
|
+
declare const isUseInsertionEffectCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
237
|
+
declare const isUseLayoutEffectCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
238
|
+
declare const isUseMemoCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
239
|
+
declare const isUseReducerCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
240
|
+
declare const isUseRefCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
241
|
+
declare const isUseStateCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
242
|
+
declare const isUseSyncExternalStoreCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
243
|
+
declare const isUseTransitionCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
|
|
242
244
|
|
|
243
245
|
declare function isComponentDidMount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
|
|
244
246
|
declare function isComponentWillUnmount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
|
|
245
247
|
declare function isComponentDidMountFunction(node: TSESTree.Node): boolean;
|
|
246
248
|
declare function isComponentWillUnmountFunction(node: TSESTree.Node): boolean;
|
|
247
249
|
|
|
248
|
-
declare const ERPhaseRelevance:
|
|
250
|
+
declare const ERPhaseRelevance: _eslint_react_eff.BiRecord<{
|
|
249
251
|
readonly mount: "unmount";
|
|
250
252
|
readonly setup: "cleanup";
|
|
251
253
|
}>;
|
|
@@ -2573,4 +2575,4 @@ declare const isMemoCall: {
|
|
|
2573
2575
|
(node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
|
|
2574
2576
|
};
|
|
2575
2577
|
|
|
2576
|
-
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier,
|
|
2578
|
+
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementNameAndRepresentName, getFunctionComponentIdentifier, getId, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isSetupFunction, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
|