@eslint-react/core 5.18.8 → 5.18.10

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +179 -180
  2. package/package.json +8 -8
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import ts from "typescript";
5
5
  import { RuleContext } from "@eslint-react/eslint";
6
6
  import { ESLintUtils } from "@typescript-eslint/utils";
7
7
  //#region src/api.d.ts
8
- declare namespace isAPI {
8
+ export declare namespace isAPI {
9
9
  /** The dual-signature predicate type returned by {@link isAPI}. */
10
10
  type ReturnType = {
11
11
  (context: RuleContext, node: null | TSESTree.Node): boolean;
@@ -17,8 +17,8 @@ declare namespace isAPI {
17
17
  * @param api The React API name to check against (ex: "useState", "React.memo").
18
18
  * @returns A predicate function to check if a node matches the API.
19
19
  */
20
- declare function isAPI(api: string): isAPI.ReturnType;
21
- declare namespace isAPICall {
20
+ export declare function isAPI(api: string): isAPI.ReturnType;
21
+ export declare namespace isAPICall {
22
22
  /** The dual-signature predicate type returned by {@link isAPICall}. */
23
23
  type ReturnType = {
24
24
  (context: RuleContext, node: null | TSESTree.Node): node is TSESTree.CallExpression;
@@ -30,135 +30,135 @@ declare namespace isAPICall {
30
30
  * @param api The React API name to check against.
31
31
  * @returns A predicate function to check if a node is a call to the API.
32
32
  */
33
- declare function isAPICall(api: string): isAPICall.ReturnType;
33
+ export declare function isAPICall(api: string): isAPICall.ReturnType;
34
34
  /** Check if the node is a React `captureOwnerStack` API identifier or member expression. */
35
- declare const isCaptureOwnerStack: isAPI.ReturnType;
35
+ export declare const isCaptureOwnerStack: isAPI.ReturnType;
36
36
  /** Check if the node is a React `Children.count` API identifier or member expression. */
37
- declare const isChildrenCount: isAPI.ReturnType;
37
+ export declare const isChildrenCount: isAPI.ReturnType;
38
38
  /** Check if the node is a React `Children.forEach` API identifier or member expression. */
39
- declare const isChildrenForEach: isAPI.ReturnType;
39
+ export declare const isChildrenForEach: isAPI.ReturnType;
40
40
  /** Check if the node is a React `Children.map` API identifier or member expression. */
41
- declare const isChildrenMap: isAPI.ReturnType;
41
+ export declare const isChildrenMap: isAPI.ReturnType;
42
42
  /** Check if the node is a React `Children.only` API identifier or member expression. */
43
- declare const isChildrenOnly: isAPI.ReturnType;
43
+ export declare const isChildrenOnly: isAPI.ReturnType;
44
44
  /** Check if the node is a React `Children.toArray` API identifier or member expression. */
45
- declare const isChildrenToArray: isAPI.ReturnType;
45
+ export declare const isChildrenToArray: isAPI.ReturnType;
46
46
  /** Check if the node is a React `cloneElement` API identifier or member expression. */
47
- declare const isCloneElement: isAPI.ReturnType;
47
+ export declare const isCloneElement: isAPI.ReturnType;
48
48
  /** Check if the node is a React `createContext` API identifier or member expression. */
49
- declare const isCreateContext: isAPI.ReturnType;
49
+ export declare const isCreateContext: isAPI.ReturnType;
50
50
  /** Check if the node is a React `createElement` API identifier or member expression. */
51
- declare const isCreateElement: isAPI.ReturnType;
51
+ export declare const isCreateElement: isAPI.ReturnType;
52
52
  /** Check if the node is a React `createRef` API identifier or member expression. */
53
- declare const isCreateRef: isAPI.ReturnType;
53
+ export declare const isCreateRef: isAPI.ReturnType;
54
54
  /** Check if the node is a React `forwardRef` API identifier or member expression. */
55
- declare const isForwardRef: isAPI.ReturnType;
55
+ export declare const isForwardRef: isAPI.ReturnType;
56
56
  /** Check if the node is a React `memo` API identifier or member expression. */
57
- declare const isMemo: isAPI.ReturnType;
57
+ export declare const isMemo: isAPI.ReturnType;
58
58
  /** Check if the node is a React `lazy` API identifier or member expression. */
59
- declare const isLazy: isAPI.ReturnType;
59
+ export declare const isLazy: isAPI.ReturnType;
60
60
  /** Check if the node is a call expression to the React `captureOwnerStack` API. */
61
- declare const isCaptureOwnerStackCall: isAPICall.ReturnType;
61
+ export declare const isCaptureOwnerStackCall: isAPICall.ReturnType;
62
62
  /** Check if the node is a call expression to the React `Children.count` API. */
63
- declare const isChildrenCountCall: isAPICall.ReturnType;
63
+ export declare const isChildrenCountCall: isAPICall.ReturnType;
64
64
  /** Check if the node is a call expression to the React `Children.forEach` API. */
65
- declare const isChildrenForEachCall: isAPICall.ReturnType;
65
+ export declare const isChildrenForEachCall: isAPICall.ReturnType;
66
66
  /** Check if the node is a call expression to the React `Children.map` API. */
67
- declare const isChildrenMapCall: isAPICall.ReturnType;
67
+ export declare const isChildrenMapCall: isAPICall.ReturnType;
68
68
  /** Check if the node is a call expression to the React `Children.only` API. */
69
- declare const isChildrenOnlyCall: isAPICall.ReturnType;
69
+ export declare const isChildrenOnlyCall: isAPICall.ReturnType;
70
70
  /** Check if the node is a call expression to the React `Children.toArray` API. */
71
- declare const isChildrenToArrayCall: isAPICall.ReturnType;
71
+ export declare const isChildrenToArrayCall: isAPICall.ReturnType;
72
72
  /** Check if the node is a call expression to the React `cloneElement` API. */
73
- declare const isCloneElementCall: isAPICall.ReturnType;
73
+ export declare const isCloneElementCall: isAPICall.ReturnType;
74
74
  /** Check if the node is a call expression to the React `createContext` API. */
75
- declare const isCreateContextCall: isAPICall.ReturnType;
75
+ export declare const isCreateContextCall: isAPICall.ReturnType;
76
76
  /** Check if the node is a call expression to the React `createElement` API. */
77
- declare const isCreateElementCall: isAPICall.ReturnType;
77
+ export declare const isCreateElementCall: isAPICall.ReturnType;
78
78
  /** Check if the node is a call expression to the React `createRef` API. */
79
- declare const isCreateRefCall: isAPICall.ReturnType;
79
+ export declare const isCreateRefCall: isAPICall.ReturnType;
80
80
  /** Check if the node is a call expression to the React `forwardRef` API. */
81
- declare const isForwardRefCall: isAPICall.ReturnType;
81
+ export declare const isForwardRefCall: isAPICall.ReturnType;
82
82
  /** Check if the node is a call expression to the React `memo` API. */
83
- declare const isMemoCall: isAPICall.ReturnType;
83
+ export declare const isMemoCall: isAPICall.ReturnType;
84
84
  /** Check if the node is a call expression to the React `lazy` API. */
85
- declare const isLazyCall: isAPICall.ReturnType;
85
+ export declare const isLazyCall: isAPICall.ReturnType;
86
86
  /** Check if the node is a React `use` API identifier or member expression. */
87
- declare const isUse: isAPI.ReturnType;
87
+ export declare const isUse: isAPI.ReturnType;
88
88
  /** Check if the node is a React `useActionState` API identifier or member expression. */
89
- declare const isUseActionState: isAPI.ReturnType;
89
+ export declare const isUseActionState: isAPI.ReturnType;
90
90
  /** Check if the node is a React `useCallback` API identifier or member expression. */
91
- declare const isUseCallback: isAPI.ReturnType;
91
+ export declare const isUseCallback: isAPI.ReturnType;
92
92
  /** Check if the node is a React `useContext` API identifier or member expression. */
93
- declare const isUseContext: isAPI.ReturnType;
93
+ export declare const isUseContext: isAPI.ReturnType;
94
94
  /** Check if the node is a React `useDebugValue` API identifier or member expression. */
95
- declare const isUseDebugValue: isAPI.ReturnType;
95
+ export declare const isUseDebugValue: isAPI.ReturnType;
96
96
  /** Check if the node is a React `useDeferredValue` API identifier or member expression. */
97
- declare const isUseDeferredValue: isAPI.ReturnType;
97
+ export declare const isUseDeferredValue: isAPI.ReturnType;
98
98
  /** Check if the node is a React `useEffect` API identifier or member expression. */
99
- declare const isUseEffect: isAPI.ReturnType;
99
+ export declare const isUseEffect: isAPI.ReturnType;
100
100
  /** Check if the node is a React `useFormStatus` API identifier or member expression. */
101
- declare const isUseFormStatus: isAPI.ReturnType;
101
+ export declare const isUseFormStatus: isAPI.ReturnType;
102
102
  /** Check if the node is a React `useId` API identifier or member expression. */
103
- declare const isUseId: isAPI.ReturnType;
103
+ export declare const isUseId: isAPI.ReturnType;
104
104
  /** Check if the node is a React `useImperativeHandle` API identifier or member expression. */
105
- declare const isUseImperativeHandle: isAPI.ReturnType;
105
+ export declare const isUseImperativeHandle: isAPI.ReturnType;
106
106
  /** Check if the node is a React `useInsertionEffect` API identifier or member expression. */
107
- declare const isUseInsertionEffect: isAPI.ReturnType;
107
+ export declare const isUseInsertionEffect: isAPI.ReturnType;
108
108
  /** Check if the node is a React `useLayoutEffect` API identifier or member expression. */
109
- declare const isUseLayoutEffect: isAPI.ReturnType;
109
+ export declare const isUseLayoutEffect: isAPI.ReturnType;
110
110
  /** Check if the node is a React `useMemo` API identifier or member expression. */
111
- declare const isUseMemo: isAPI.ReturnType;
111
+ export declare const isUseMemo: isAPI.ReturnType;
112
112
  /** Check if the node is a React `useOptimistic` API identifier or member expression. */
113
- declare const isUseOptimistic: isAPI.ReturnType;
113
+ export declare const isUseOptimistic: isAPI.ReturnType;
114
114
  /** Check if the node is a React `useReducer` API identifier or member expression. */
115
- declare const isUseReducer: isAPI.ReturnType;
115
+ export declare const isUseReducer: isAPI.ReturnType;
116
116
  /** Check if the node is a React `useRef` API identifier or member expression. */
117
- declare const isUseRef: isAPI.ReturnType;
117
+ export declare const isUseRef: isAPI.ReturnType;
118
118
  /** Check if the node is a React `useState` API identifier or member expression. */
119
- declare const isUseState: isAPI.ReturnType;
119
+ export declare const isUseState: isAPI.ReturnType;
120
120
  /** Check if the node is a React `useSyncExternalStore` API identifier or member expression. */
121
- declare const isUseSyncExternalStore: isAPI.ReturnType;
121
+ export declare const isUseSyncExternalStore: isAPI.ReturnType;
122
122
  /** Check if the node is a React `useTransition` API identifier or member expression. */
123
- declare const isUseTransition: isAPI.ReturnType;
123
+ export declare const isUseTransition: isAPI.ReturnType;
124
124
  /** Check if the node is a call expression to the React `use` API. */
125
- declare const isUseCall: isAPICall.ReturnType;
125
+ export declare const isUseCall: isAPICall.ReturnType;
126
126
  /** Check if the node is a call expression to the React `useActionState` API. */
127
- declare const isUseActionStateCall: isAPICall.ReturnType;
127
+ export declare const isUseActionStateCall: isAPICall.ReturnType;
128
128
  /** Check if the node is a call expression to the React `useCallback` API. */
129
- declare const isUseCallbackCall: isAPICall.ReturnType;
129
+ export declare const isUseCallbackCall: isAPICall.ReturnType;
130
130
  /** Check if the node is a call expression to the React `useContext` API. */
131
- declare const isUseContextCall: isAPICall.ReturnType;
131
+ export declare const isUseContextCall: isAPICall.ReturnType;
132
132
  /** Check if the node is a call expression to the React `useDebugValue` API. */
133
- declare const isUseDebugValueCall: isAPICall.ReturnType;
133
+ export declare const isUseDebugValueCall: isAPICall.ReturnType;
134
134
  /** Check if the node is a call expression to the React `useDeferredValue` API. */
135
- declare const isUseDeferredValueCall: isAPICall.ReturnType;
135
+ export declare const isUseDeferredValueCall: isAPICall.ReturnType;
136
136
  /** Check if the node is a call expression to the React `useEffect` API. */
137
- declare const isUseEffectCall: isAPICall.ReturnType;
137
+ export declare const isUseEffectCall: isAPICall.ReturnType;
138
138
  /** Check if the node is a call expression to the React `useFormStatus` API. */
139
- declare const isUseFormStatusCall: isAPICall.ReturnType;
139
+ export declare const isUseFormStatusCall: isAPICall.ReturnType;
140
140
  /** Check if the node is a call expression to the React `useId` API. */
141
- declare const isUseIdCall: isAPICall.ReturnType;
141
+ export declare const isUseIdCall: isAPICall.ReturnType;
142
142
  /** Check if the node is a call expression to the React `useImperativeHandle` API. */
143
- declare const isUseImperativeHandleCall: isAPICall.ReturnType;
143
+ export declare const isUseImperativeHandleCall: isAPICall.ReturnType;
144
144
  /** Check if the node is a call expression to the React `useInsertionEffect` API. */
145
- declare const isUseInsertionEffectCall: isAPICall.ReturnType;
145
+ export declare const isUseInsertionEffectCall: isAPICall.ReturnType;
146
146
  /** Check if the node is a call expression to the React `useLayoutEffect` API. */
147
- declare const isUseLayoutEffectCall: isAPICall.ReturnType;
147
+ export declare const isUseLayoutEffectCall: isAPICall.ReturnType;
148
148
  /** Check if the node is a call expression to the React `useMemo` API. */
149
- declare const isUseMemoCall: isAPICall.ReturnType;
149
+ export declare const isUseMemoCall: isAPICall.ReturnType;
150
150
  /** Check if the node is a call expression to the React `useOptimistic` API. */
151
- declare const isUseOptimisticCall: isAPICall.ReturnType;
151
+ export declare const isUseOptimisticCall: isAPICall.ReturnType;
152
152
  /** Check if the node is a call expression to the React `useReducer` API. */
153
- declare const isUseReducerCall: isAPICall.ReturnType;
153
+ export declare const isUseReducerCall: isAPICall.ReturnType;
154
154
  /** Check if the node is a call expression to the React `useRef` API. */
155
- declare const isUseRefCall: isAPICall.ReturnType;
155
+ export declare const isUseRefCall: isAPICall.ReturnType;
156
156
  /** Check if the node is a call expression to the React `useState` API. */
157
- declare const isUseStateCall: isAPICall.ReturnType;
157
+ export declare const isUseStateCall: isAPICall.ReturnType;
158
158
  /** Check if the node is a call expression to the React `useSyncExternalStore` API. */
159
- declare const isUseSyncExternalStoreCall: isAPICall.ReturnType;
159
+ export declare const isUseSyncExternalStoreCall: isAPICall.ReturnType;
160
160
  /** Check if the node is a call expression to the React `useTransition` API. */
161
- declare const isUseTransitionCall: isAPICall.ReturnType;
161
+ export declare const isUseTransitionCall: isAPICall.ReturnType;
162
162
  //#endregion
163
163
  //#region src/class.d.ts
164
164
  /**
@@ -166,14 +166,14 @@ declare const isUseTransitionCall: isAPICall.ReturnType;
166
166
  * @param node The class node to get the identifier from.
167
167
  * @returns The class identifier or `null` if not found.
168
168
  */
169
- declare function getClassId(node: TSESTreeClass): TSESTree.BindingName | null;
169
+ export declare function getClassId(node: TSESTreeClass): TSESTree.BindingName | null;
170
170
  //#endregion
171
171
  //#region src/semantic.d.ts
172
172
  /**
173
173
  * Represents a semantic node in the AST.
174
174
  * This is the base interface for all semantic nodes in the React semantic analysis.
175
175
  */
176
- interface SemanticNode {
176
+ export interface SemanticNode {
177
177
  /** The identifier of the node. */
178
178
  id: null | TSESTree.Node;
179
179
  /** The unique key of the node. */
@@ -193,7 +193,7 @@ interface SemanticNode {
193
193
  * Represents a semantic function node in the AST.
194
194
  * This interface extends SemanticNode and provides additional properties for function analysis.
195
195
  */
196
- interface SemanticFunc extends SemanticNode {
196
+ export interface SemanticFunc extends SemanticNode {
197
197
  /** The identifier of the function. */
198
198
  id: null | TSESTree.Node;
199
199
  /** The AST node of the function. */
@@ -216,7 +216,7 @@ interface SemanticFunc extends SemanticNode {
216
216
  /**
217
217
  * @deprecated Class components are legacy. This type exists only to support legacy rules.
218
218
  */
219
- interface ClassComponentSemanticNode extends SemanticNode {
219
+ export interface ClassComponentSemanticNode extends SemanticNode {
220
220
  /** The identifier of the class component. */
221
221
  id: null | TSESTree.BindingName;
222
222
  /** The kind of component. */
@@ -237,83 +237,83 @@ interface ClassComponentSemanticNode extends SemanticNode {
237
237
  * @param node The node to check.
238
238
  * @returns `true` if the node is a class component.
239
239
  */
240
- declare function isClassComponent(node: TSESTree.Node): node is TSESTreeClass;
240
+ export declare function isClassComponent(node: TSESTree.Node): node is TSESTreeClass;
241
241
  /**
242
242
  * Check if the node is a pure component (extends `PureComponent`).
243
243
  * @param node The AST node to check.
244
244
  * @returns `true` if the node is a pure component.
245
245
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
246
246
  */
247
- declare function isPureComponent(node: TSESTree.Node): boolean;
247
+ export declare function isPureComponent(node: TSESTree.Node): boolean;
248
248
  /** @deprecated Class components are legacy. */
249
- declare const isRender: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
249
+ export declare const isRender: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
250
250
  /** @deprecated Class components are legacy. */
251
- declare const isComponentDidCatch: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
251
+ export declare const isComponentDidCatch: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
252
252
  /** @deprecated Class components are legacy. */
253
- declare const isComponentDidMount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
253
+ export declare const isComponentDidMount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
254
254
  /** @deprecated Class components are legacy. */
255
- declare const isComponentDidUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
255
+ export declare const isComponentDidUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
256
256
  /** @deprecated Class components are legacy. */
257
- declare const isComponentWillMount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
257
+ export declare const isComponentWillMount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
258
258
  /** @deprecated Class components are legacy. */
259
- declare const isComponentWillReceiveProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
259
+ export declare const isComponentWillReceiveProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
260
260
  /** @deprecated Class components are legacy. */
261
- declare const isComponentWillUnmount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
261
+ export declare const isComponentWillUnmount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
262
262
  /** @deprecated Class components are legacy. */
263
- declare const isComponentWillUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
263
+ export declare const isComponentWillUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
264
264
  /** @deprecated Class components are legacy. */
265
- declare const isGetChildContext: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
265
+ export declare const isGetChildContext: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
266
266
  /** @deprecated Class components are legacy. */
267
- declare const isGetInitialState: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
267
+ export declare const isGetInitialState: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
268
268
  /** @deprecated Class components are legacy. */
269
- declare const isGetSnapshotBeforeUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
269
+ export declare const isGetSnapshotBeforeUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
270
270
  /** @deprecated Class components are legacy. */
271
- declare const isShouldComponentUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
271
+ export declare const isShouldComponentUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
272
272
  /** @deprecated Class components are legacy. */
273
- declare const isUnsafeComponentWillMount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
273
+ export declare const isUnsafeComponentWillMount: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
274
274
  /** @deprecated Class components are legacy. */
275
- declare const isUnsafeComponentWillReceiveProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
275
+ export declare const isUnsafeComponentWillReceiveProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
276
276
  /** @deprecated Class components are legacy. */
277
- declare const isUnsafeComponentWillUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
277
+ export declare const isUnsafeComponentWillUpdate: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
278
278
  /** @deprecated Class components are legacy. */
279
- declare const isGetDefaultProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
279
+ export declare const isGetDefaultProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
280
280
  /** @deprecated Class components are legacy. */
281
- declare const isGetDerivedStateFromProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
281
+ export declare const isGetDerivedStateFromProps: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
282
282
  /** @deprecated Class components are legacy. */
283
- declare const isGetDerivedStateFromError: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
283
+ export declare const isGetDerivedStateFromError: (node: TSESTree.Node) => node is TSESTreeMethodOrPropertyDefinition;
284
284
  /**
285
285
  * Check if the node is a render-like method of a class component.
286
286
  * @param node The AST node to check.
287
287
  * @returns `true` if the node is a render-like method.
288
288
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
289
289
  */
290
- declare function isRenderMethodLike(node: TSESTree.Node): node is TSESTreeMethodOrPropertyDefinition;
290
+ export declare function isRenderMethodLike(node: TSESTree.Node): node is TSESTreeMethodOrPropertyDefinition;
291
291
  /**
292
292
  * Check if the function is a callback passed to a class component's render method.
293
293
  * @param node The function node to check.
294
294
  * @returns `true` if the function is a render method callback.
295
295
  */
296
- declare function isRenderMethodCallback(node: TSESTreeFunction): boolean;
296
+ export declare function isRenderMethodCallback(node: TSESTreeFunction): boolean;
297
297
  /**
298
298
  * Check if the call expression is a `this.setState(...)` call.
299
299
  * @param node The call expression node to check.
300
300
  * @returns `true` if the node is a `this.setState(...)` call.
301
301
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
302
302
  */
303
- declare function isThisSetStateCall(node: TSESTree.CallExpression): boolean;
303
+ export declare function isThisSetStateCall(node: TSESTree.CallExpression): boolean;
304
304
  /**
305
305
  * Check if the assignment expression assigns to `this.state`.
306
306
  * @param node The assignment expression node to check.
307
307
  * @returns `true` if the node assigns to `this.state`.
308
308
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
309
309
  */
310
- declare function isAssignmentToThisState(node: TSESTree.AssignmentExpression): boolean;
310
+ export declare function isAssignmentToThisState(node: TSESTree.AssignmentExpression): boolean;
311
311
  //#endregion
312
312
  //#region src/class-component-collector.d.ts
313
313
  /**
314
314
  * @deprecated Class components are legacy. This namespace exists only to support legacy rules.
315
315
  */
316
- declare namespace getClassComponentCollector {
316
+ export declare namespace getClassComponentCollector {
317
317
  /** The api and visitor pair returned by {@link getClassComponentCollector}. */
318
318
  type ReturnType = {
319
319
  api: {
@@ -327,7 +327,7 @@ declare namespace getClassComponentCollector {
327
327
  * @param context The rule context.
328
328
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
329
329
  */
330
- declare function getClassComponentCollector(context: RuleContext): getClassComponentCollector.ReturnType;
330
+ export declare function getClassComponentCollector(context: RuleContext): getClassComponentCollector.ReturnType;
331
331
  //#endregion
332
332
  //#region src/create-element.d.ts
333
333
  /**
@@ -336,7 +336,7 @@ declare function getClassComponentCollector(context: RuleContext): getClassCompo
336
336
  * @param node The node to inspect.
337
337
  * @returns The type argument, or `null` when the node is not a `createElement` call or has no arguments.
338
338
  */
339
- declare function getCreateElementTypeArgument(context: RuleContext, node: null | TSESTree.Node): TSESTree.CallExpressionArgument | null;
339
+ export declare function getCreateElementTypeArgument(context: RuleContext, node: null | TSESTree.Node): TSESTree.CallExpressionArgument | null;
340
340
  /**
341
341
  * Get the props object (the second argument) of a `createElement` call.
342
342
  *
@@ -348,14 +348,14 @@ declare function getCreateElementTypeArgument(context: RuleContext, node: null |
348
348
  * @param node The node to inspect.
349
349
  * @returns The props `ObjectExpression`, or `null` when absent or not statically an object literal.
350
350
  */
351
- declare function getCreateElementPropsObject(context: RuleContext, node: null | TSESTree.Node): TSESTree.ObjectExpression | null;
351
+ export declare function getCreateElementPropsObject(context: RuleContext, node: null | TSESTree.Node): TSESTree.ObjectExpression | null;
352
352
  /**
353
353
  * Get the children arguments (the arguments after the props object) of a `createElement` call.
354
354
  * @param context The ESLint rule context.
355
355
  * @param node The node to inspect.
356
356
  * @returns The children arguments, or an empty array when the node is not a `createElement` call.
357
357
  */
358
- declare function getCreateElementChildrenArguments(context: RuleContext, node: null | TSESTree.Node): TSESTree.CallExpressionArgument[];
358
+ export declare function getCreateElementChildrenArguments(context: RuleContext, node: null | TSESTree.Node): TSESTree.CallExpressionArgument[];
359
359
  /**
360
360
  * Find a statically named property in the props object of a `createElement` call.
361
361
  *
@@ -373,7 +373,7 @@ declare function getCreateElementChildrenArguments(context: RuleContext, node: n
373
373
  * const childrenProp = getCreateElementProp(context, node, "children");
374
374
  * ```
375
375
  */
376
- declare function getCreateElementProp(context: RuleContext, node: null | TSESTree.Node, name: string): TSESTree.Property | null;
376
+ export declare function getCreateElementProp(context: RuleContext, node: null | TSESTree.Node, name: string): TSESTree.Property | null;
377
377
  /**
378
378
  * Check if the node is passed as a children argument (the third argument or
379
379
  * later) of a `createElement` call.
@@ -381,45 +381,45 @@ declare function getCreateElementProp(context: RuleContext, node: null | TSESTre
381
381
  * @param node The node to check.
382
382
  * @returns `true` if the node is a direct children argument of a `createElement` call.
383
383
  */
384
- declare function isCreateElementChildrenArgument(context: RuleContext, node: TSESTree.Node): boolean;
384
+ export declare function isCreateElementChildrenArgument(context: RuleContext, node: TSESTree.Node): boolean;
385
385
  /**
386
386
  * Check if the node is inside the props object (the second argument) of a `createElement` call.
387
387
  * @param context The ESLint rule context.
388
388
  * @param node The node to check.
389
389
  * @returns `true` if the node is inside `createElement`'s props object.
390
390
  */
391
- declare function isInsideCreateElementProps(context: RuleContext, node: TSESTree.Node): boolean;
391
+ export declare function isInsideCreateElementProps(context: RuleContext, node: TSESTree.Node): boolean;
392
392
  //#endregion
393
393
  //#region src/function.d.ts
394
394
  /** The return type of {@link getFunctionId}. */
395
- type FunctionID = ReturnType<typeof getFunctionId>;
395
+ export type FunctionID = ReturnType<typeof getFunctionId>;
396
396
  /**
397
397
  * Represents various AST paths for function declarations.
398
398
  * Each tuple type represents a specific function definition pattern.
399
399
  */
400
- type FunctionInitPath = readonly [TSESTree.FunctionDeclaration] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.CallExpression, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.ObjectExpression, TSESTree.Property, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.ObjectExpression, TSESTree.Property, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.ObjectExpression, TSESTree.Property, TSESTree.CallExpression, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.ClassDeclaration | TSESTree.ClassExpression, TSESTree.ClassBody, TSESTree.MethodDefinition, TSESTreeFunction] | readonly [TSESTree.ClassDeclaration | TSESTree.ClassExpression, TSESTree.ClassBody, TSESTree.PropertyDefinition, TSESTreeFunction];
400
+ export type FunctionInitPath = readonly [TSESTree.FunctionDeclaration] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.CallExpression, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.ObjectExpression, TSESTree.Property, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.ObjectExpression, TSESTree.Property, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.VariableDeclaration, TSESTree.VariableDeclarator, TSESTree.ObjectExpression, TSESTree.Property, TSESTree.CallExpression, TSESTree.CallExpression, TSESTreeFunction] | readonly [TSESTree.ClassDeclaration | TSESTree.ClassExpression, TSESTree.ClassBody, TSESTree.MethodDefinition, TSESTreeFunction] | readonly [TSESTree.ClassDeclaration | TSESTree.ClassExpression, TSESTree.ClassBody, TSESTree.PropertyDefinition, TSESTreeFunction];
401
401
  /**
402
402
  * Represents the kind of a function.
403
403
  */
404
- type FunctionKind = "client-function" | "server-function";
404
+ export type FunctionKind = "client-function" | "server-function";
405
405
  /**
406
406
  * Represents a client function semantic node.
407
407
  */
408
- interface ClientFunctionSemanticNode extends SemanticFunc {
408
+ export interface ClientFunctionSemanticNode extends SemanticFunc {
409
409
  /** The kind of function. */
410
410
  kind: "client-function";
411
411
  }
412
412
  /**
413
413
  * Represents a server function semantic node.
414
414
  */
415
- interface ServerFunctionSemanticNode extends SemanticFunc {
415
+ export interface ServerFunctionSemanticNode extends SemanticFunc {
416
416
  /** The kind of function. */
417
417
  kind: "server-function";
418
418
  }
419
419
  /**
420
420
  * Represents a function semantic node.
421
421
  */
422
- type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSemanticNode;
422
+ export type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSemanticNode;
423
423
  /**
424
424
  * Get the static identifier of a function AST node.
425
425
  *
@@ -434,14 +434,14 @@ type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSemanticN
434
434
  * @param node The function node to analyze.
435
435
  * @returns The identifier node if found, `null` otherwise.
436
436
  */
437
- declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | null;
437
+ export declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | TSESTree.PrivateIdentifier | null;
438
438
  /**
439
439
  * Get the initialization path of a function node in the AST.
440
440
  *
441
441
  * @param node The function node to analyze.
442
442
  * @returns The function initialization path or `null` if not identifiable.
443
443
  */
444
- declare function getFunctionInitPath(node: TSESTreeFunction): null | FunctionInitPath;
444
+ export declare function getFunctionInitPath(node: TSESTreeFunction): null | FunctionInitPath;
445
445
  /**
446
446
  * Check if a specific function call exists in the function initialization path.
447
447
  *
@@ -449,20 +449,20 @@ declare function getFunctionInitPath(node: TSESTreeFunction): null | FunctionIni
449
449
  * @param initPath The function initialization path to search in.
450
450
  * @returns `true` if the call exists in the path, `false` otherwise.
451
451
  */
452
- declare function isFunctionHasCallInInitPath(callName: string, initPath: FunctionInitPath): boolean;
452
+ export declare function isFunctionHasCallInInitPath(callName: string, initPath: FunctionInitPath): boolean;
453
453
  /**
454
454
  * Check if a function is empty.
455
455
  *
456
456
  * @param node The function node to check.
457
457
  * @returns `true` if the function is empty, `false` otherwise.
458
458
  */
459
- declare function isFunctionEmpty(node: TSESTreeFunction): boolean;
459
+ export declare function isFunctionEmpty(node: TSESTreeFunction): boolean;
460
460
  /**
461
461
  * Get the directives of a function (ex: "use strict", "use client", "use server").
462
462
  * @param node The function node to get the directives from.
463
463
  * @returns The directives of the function.
464
464
  */
465
- declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirective[];
465
+ export declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirective[];
466
466
  /**
467
467
  * Check if a directive with the given name exists in the function directives.
468
468
  *
@@ -470,9 +470,9 @@ declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirectiv
470
470
  * @param name The directive name to check (e.g., "use memo", "use no memo").
471
471
  * @returns `true` if the directive exists, `false` otherwise.
472
472
  */
473
- declare function isFunctionHasDirective(node: TSESTreeFunction, name: string): boolean;
473
+ export declare function isFunctionHasDirective(node: TSESTreeFunction, name: string): boolean;
474
474
  /** Represents a `displayName` assignment expression (ex: `Component.displayName = "MyComponent"`). */
475
- type FunctionDisplayNameAssignment = TSESTree.AssignmentExpression & {
475
+ export type FunctionDisplayNameAssignment = TSESTree.AssignmentExpression & {
476
476
  left: TSESTree.MemberExpression & {
477
477
  property: TSESTree.Identifier & {
478
478
  name: "displayName";
@@ -482,13 +482,13 @@ type FunctionDisplayNameAssignment = TSESTree.AssignmentExpression & {
482
482
  right: TSESTree.Literal;
483
483
  };
484
484
  /** The esquery selector matching `displayName` assignment expressions. */
485
- declare const SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT: string;
485
+ export declare const SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT: string;
486
486
  //#endregion
487
487
  //#region src/hook.d.ts
488
488
  /**
489
489
  * Represents a semantic hook node in the AST.
490
490
  */
491
- interface HookSemanticNode extends SemanticNode {
491
+ export interface HookSemanticNode extends SemanticNode {
492
492
  /** The identifier of the hook. */
493
493
  id: FunctionID;
494
494
  /** The AST node of the hook. */
@@ -503,79 +503,79 @@ interface HookSemanticNode extends SemanticNode {
503
503
  directives: TSESTreeDirective[];
504
504
  }
505
505
  /** Represents a hook call, which can be a call expression or a tagged template expression. */
506
- type HookCall = TSESTree.CallExpression | TSESTree.TaggedTemplateExpression;
506
+ export type HookCall = TSESTree.CallExpression | TSESTree.TaggedTemplateExpression;
507
507
  /** The names of React's built-in hooks. */
508
- declare const REACT_BUILTIN_HOOK_NAMES: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
508
+ export declare const REACT_BUILTIN_HOOK_NAMES: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
509
509
  /**
510
510
  * Check if the name is a hook name (starts with `use` followed by an uppercase letter or digit).
511
511
  * @param name The name of the identifier to check.
512
512
  * @returns `true` if the name is a hook name.
513
513
  * @see https://github.com/facebook/react/blob/1d6c8168db1d82713202e842df3167787ffa00ed/packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts#L16
514
514
  */
515
- declare function isHookName(name: string): boolean;
515
+ export declare function isHookName(name: string): boolean;
516
516
  /**
517
517
  * Checks if the given node is a hook identifier.
518
518
  * @param id The AST node to check.
519
519
  * @returns `true` if the node is a hook identifier or member expression with hook name, `false` otherwise.
520
520
  */
521
- declare function isHookId(id: TSESTree.Node): id is TSESTree.Identifier | TSESTree.MemberExpression;
521
+ export declare function isHookId(id: TSESTree.Node): id is TSESTree.Identifier | TSESTree.MemberExpression;
522
522
  /**
523
523
  * Checks if the given expression is a hook tag (callee / tagged template tag).
524
524
  * @param tag The expression node to check.
525
525
  * @returns `true` if the expression is a hook identifier or member expression with hook name, `false` otherwise.
526
526
  */
527
- declare function isHookTag(tag: TSESTree.Node | null): boolean;
527
+ export declare function isHookTag(tag: TSESTree.Node | null): boolean;
528
528
  /**
529
529
  * Check if the function node is a hook definition based on its name.
530
530
  * @param node The function node to check.
531
531
  * @returns `true` if the function is a hook definition.
532
532
  */
533
- declare function isHookDefinition(node: TSESTreeFunction | null): boolean;
533
+ export declare function isHookDefinition(node: TSESTreeFunction | null): boolean;
534
534
  /**
535
535
  * Check if the node is a React Hook call by its name.
536
536
  * @param node The node to check.
537
537
  * @returns `true` if the node is a React Hook call, `false` otherwise.
538
538
  */
539
- declare function isHookCall(node: TSESTree.Node | null): node is TSESTree.CallExpression;
539
+ export declare function isHookCall(node: TSESTree.Node | null): node is TSESTree.CallExpression;
540
540
  /**
541
541
  * Check if the node is a useRef-like call (ex: `useRef` or a custom ref hook).
542
542
  * @param node The AST node to check.
543
543
  * @param additionalRefHooks Regex pattern matching custom hooks that should be treated as ref hooks.
544
544
  * @returns `true` if the node is a useRef-like call.
545
545
  */
546
- declare function isUseRefLikeCall(node: TSESTree.Node | null, additionalRefHooks?: RegExpLike): node is TSESTree.CallExpression;
546
+ export declare function isUseRefLikeCall(node: TSESTree.Node | null, additionalRefHooks?: RegExpLike): node is TSESTree.CallExpression;
547
547
  /**
548
548
  * Check if the node is a useState-like call (ex: `useState` or a custom state hook).
549
549
  * @param node The AST node to check.
550
550
  * @param additionalStateHooks Regex pattern matching custom hooks that should be treated as state hooks.
551
551
  * @returns `true` if the node is a useState-like call.
552
552
  */
553
- declare function isUseStateLikeCall(node: TSESTree.Node | null, additionalStateHooks?: RegExpLike): node is TSESTree.CallExpression;
553
+ export declare function isUseStateLikeCall(node: TSESTree.Node | null, additionalStateHooks?: RegExpLike): node is TSESTree.CallExpression;
554
554
  /**
555
555
  * Check if the node is a useEffect-like call (ex: `useEffect`, `useLayoutEffect`, or a custom effect hook).
556
556
  * @param node The AST node to check.
557
557
  * @param additionalEffectHooks Regex pattern matching custom hooks that should be treated as effect hooks.
558
558
  * @returns `true` if the node is a useEffect-like call.
559
559
  */
560
- declare function isUseEffectLikeCall(node: TSESTree.Node | null, additionalEffectHooks?: RegExpLike): node is TSESTree.CallExpression;
560
+ export declare function isUseEffectLikeCall(node: TSESTree.Node | null, additionalEffectHooks?: RegExpLike): node is TSESTree.CallExpression;
561
561
  /**
562
562
  * Check if the node is the setup callback passed to a useEffect-like call.
563
563
  * @param node The AST node to check.
564
564
  * @returns `true` if the node is a useEffect setup callback.
565
565
  */
566
- declare function isUseEffectSetupCallback(node: TSESTree.Node | null): boolean;
566
+ export declare function isUseEffectSetupCallback(node: TSESTree.Node | null): boolean;
567
567
  /**
568
568
  * Check if the node is the cleanup callback returned by a useEffect-like setup callback.
569
569
  * @param node The AST node to check.
570
570
  * @returns `true` if the node is a useEffect cleanup callback.
571
571
  */
572
- declare function isUseEffectCleanupCallback(node: TSESTree.Node | null): boolean;
572
+ export declare function isUseEffectCleanupCallback(node: TSESTree.Node | null): boolean;
573
573
  //#endregion
574
574
  //#region src/function-component.d.ts
575
575
  /**
576
576
  * Represents a React Function Component.
577
577
  */
578
- interface FunctionComponentSemanticNode extends SemanticNode {
578
+ export interface FunctionComponentSemanticNode extends SemanticNode {
579
579
  /** The identifier or identifier sequence of the component. */
580
580
  id: FunctionID;
581
581
  /** The kind of component. */
@@ -604,7 +604,7 @@ interface FunctionComponentSemanticNode extends SemanticNode {
604
604
  /**
605
605
  * Component flag constants.
606
606
  */
607
- declare const FunctionComponentFlag: {
607
+ export declare const FunctionComponentFlag: {
608
608
  /** No flags set. */
609
609
  None: bigint;
610
610
  /** Indicates the component is a pure component (ex: extends PureComponent). */
@@ -622,40 +622,40 @@ declare const FunctionComponentFlag: {
622
622
  * @returns The component flag.
623
623
  * @internal
624
624
  */
625
- declare function getFunctionComponentFlagFromInitPath(initPath: FunctionComponentSemanticNode["initPath"]): bigint;
625
+ export declare function getFunctionComponentFlagFromInitPath(initPath: FunctionComponentSemanticNode["initPath"]): bigint;
626
626
  /**
627
627
  * Check if the node is a call expression for a component wrapper.
628
628
  * @param context The ESLint rule context.
629
629
  * @param node The node to check.
630
630
  * @returns `true` if the node is a call expression for a component wrapper.
631
631
  */
632
- declare function isFunctionComponentWrapperCall(context: RuleContext, node: TSESTree.Node): boolean;
632
+ export declare function isFunctionComponentWrapperCall(context: RuleContext, node: TSESTree.Node): boolean;
633
633
  /**
634
634
  * Check if the node is a callback function passed to a component wrapper.
635
635
  * @param context The ESLint rule context.
636
636
  * @param node The node to check.
637
637
  * @returns `true` if the node is a callback function passed to a component wrapper.
638
638
  */
639
- declare function isFunctionComponentWrapperCallback(context: RuleContext, node: TSESTree.Node): boolean;
639
+ export declare function isFunctionComponentWrapperCallback(context: RuleContext, node: TSESTree.Node): boolean;
640
640
  /**
641
641
  * Get function component identifier from `const Component = memo(() => {});`.
642
642
  * @param context The rule context.
643
643
  * @param node The AST node to get the function component identifier from.
644
644
  * @internal
645
645
  */
646
- declare function getFunctionComponentId(context: RuleContext, node: TSESTreeFunction): FunctionID;
646
+ export declare function getFunctionComponentId(context: RuleContext, node: TSESTreeFunction): FunctionID;
647
647
  /**
648
648
  * Check if a string matches the strict component name pattern.
649
649
  * @param name The name to check.
650
650
  * @returns `true` if the name matches the strict component name pattern.
651
651
  */
652
- declare function isFunctionComponentName(name: string): boolean;
652
+ export declare function isFunctionComponentName(name: string): boolean;
653
653
  /**
654
654
  * Check if a string matches the loose component name pattern.
655
655
  * @param name The name to check.
656
656
  * @returns `true` if the name matches the loose component name pattern.
657
657
  */
658
- declare function isFunctionComponentNameLoose(name: string): boolean;
658
+ export declare function isFunctionComponentNameLoose(name: string): boolean;
659
659
  /**
660
660
  * Check if a function has a loose component name.
661
661
  * @param context The rule context.
@@ -663,13 +663,13 @@ declare function isFunctionComponentNameLoose(name: string): boolean;
663
663
  * @param allowNone Whether to allow no name.
664
664
  * @returns `true` if the function has a loose component name.
665
665
  */
666
- declare function isFunctionWithLooseComponentName(context: RuleContext, fn: TSESTreeFunction, allowNone?: boolean): boolean;
666
+ export declare function isFunctionWithLooseComponentName(context: RuleContext, fn: TSESTreeFunction, allowNone?: boolean): boolean;
667
667
  /** The bit-flags for customizing function component detection. */
668
- type FunctionComponentDetectionHint = bigint;
668
+ export type FunctionComponentDetectionHint = bigint;
669
669
  /**
670
670
  * Hints for component collector.
671
671
  */
672
- declare const FunctionComponentDetectionHint: {
672
+ export declare const FunctionComponentDetectionHint: {
673
673
  /** Exclude functions defined as class methods from component detection. */
674
674
  readonly DoNotIncludeFunctionDefinedAsClassMethod: bigint;
675
675
  /** Exclude functions defined as class properties from component detection. */
@@ -702,7 +702,7 @@ declare const FunctionComponentDetectionHint: {
702
702
  /**
703
703
  * Default component detection hint.
704
704
  */
705
- declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
705
+ export declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
706
706
  /**
707
707
  * Check if the function node is a valid React component definition.
708
708
  *
@@ -711,10 +711,10 @@ declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
711
711
  * @param hint Component detection hints (bit flags) to customize detection logic.
712
712
  * @returns `true` if the node is considered a component definition.
713
713
  */
714
- declare function isFunctionComponentDefinition(context: RuleContext, node: TSESTreeFunction, hint: bigint): boolean;
714
+ export declare function isFunctionComponentDefinition(context: RuleContext, node: TSESTreeFunction, hint: bigint): boolean;
715
715
  //#endregion
716
716
  //#region src/function-component-collector.d.ts
717
- declare namespace getFunctionComponentCollector {
717
+ export declare namespace getFunctionComponentCollector {
718
718
  /** The options for {@link getFunctionComponentCollector}. */
719
719
  type Options = {
720
720
  collectDisplayName?: boolean;
@@ -734,10 +734,10 @@ declare namespace getFunctionComponentCollector {
734
734
  * @param options The options to use.
735
735
  * @returns The api and visitor of the collector.
736
736
  */
737
- declare function getFunctionComponentCollector(context: RuleContext, options?: getFunctionComponentCollector.Options): getFunctionComponentCollector.ReturnType;
737
+ export declare function getFunctionComponentCollector(context: RuleContext, options?: getFunctionComponentCollector.Options): getFunctionComponentCollector.ReturnType;
738
738
  //#endregion
739
739
  //#region src/hook-collector.d.ts
740
- declare namespace getHookCollector {
740
+ export declare namespace getHookCollector {
741
741
  /** The api and visitor pair returned by {@link getHookCollector}. */
742
742
  type ReturnType = {
743
743
  api: {
@@ -751,7 +751,7 @@ declare namespace getHookCollector {
751
751
  * @param context The ESLint rule context.
752
752
  * @returns The api and visitor of the collector.
753
753
  */
754
- declare function getHookCollector(context: RuleContext): getHookCollector.ReturnType;
754
+ export declare function getHookCollector(context: RuleContext): getHookCollector.ReturnType;
755
755
  //#endregion
756
756
  //#region src/jsx.d.ts
757
757
  /**
@@ -760,11 +760,11 @@ declare function getHookCollector(context: RuleContext): getHookCollector.Return
760
760
  * Used by `isJsxLike` to control which AST node kinds are considered
761
761
  * "JSX-like". Combine flags with the `|` operator.
762
762
  */
763
- type JsxDetectionHint = bigint;
763
+ export type JsxDetectionHint = bigint;
764
764
  /**
765
765
  * Hints for JSX detection.
766
766
  */
767
- declare const JsxDetectionHint: {
767
+ export declare const JsxDetectionHint: {
768
768
  /** No hints set. */
769
769
  readonly None: 0n;
770
770
  /** Do not treat `null` values as JSX-like. */
@@ -797,7 +797,7 @@ declare const JsxDetectionHint: {
797
797
  * the value types that are commonly returned alongside JSX in React
798
798
  * components but are not themselves renderable elements.
799
799
  */
800
- declare const DEFAULT_JSX_DETECTION_HINT: JsxDetectionHint;
800
+ export declare const DEFAULT_JSX_DETECTION_HINT: JsxDetectionHint;
801
801
  /**
802
802
  * Check if the node represents JSX-like content based on heuristics.
803
803
  *
@@ -822,14 +822,14 @@ declare const DEFAULT_JSX_DETECTION_HINT: JsxDetectionHint;
822
822
  * }
823
823
  * ```
824
824
  */
825
- declare function isJsxLike(context: RuleContext, node: TSESTree.Node | null, hint?: JsxDetectionHint): boolean;
825
+ export declare function isJsxLike(context: RuleContext, node: TSESTree.Node | null, hint?: JsxDetectionHint): boolean;
826
826
  //#endregion
827
827
  //#region src/jsx-config.d.ts
828
828
  /**
829
829
  * Resolved JSX configuration derived from compiler options and / or pragma
830
830
  * annotations found in the source file.
831
831
  */
832
- interface JsxConfig {
832
+ export interface JsxConfig {
833
833
  /** The JSX emit mode. */
834
834
  jsx?: ts.JsxEmit;
835
835
  /** The JSX factory function (ex: `React.createElement`). */
@@ -849,7 +849,7 @@ interface JsxConfig {
849
849
  * @param context The ESLint rule context.
850
850
  * @returns Fully‑populated `JsxConfig` derived from compiler options.
851
851
  */
852
- declare function getJsxConfigFromCompilerOptions(context: RuleContext): Required<JsxConfig>;
852
+ export declare function getJsxConfigFromCompilerOptions(context: RuleContext): Required<JsxConfig>;
853
853
  /**
854
854
  * Extract JSX configuration from `@jsx`, `@jsxFrag`, `@jsxRuntime` and
855
855
  * `@jsxImportSource` pragma comments in the source file.
@@ -860,7 +860,7 @@ declare function getJsxConfigFromCompilerOptions(context: RuleContext): Required
860
860
  * @param context The ESLint rule context.
861
861
  * @returns Partial `JsxConfig` containing only the values found in pragmas.
862
862
  */
863
- declare function getJsxConfigFromAnnotation(context: RuleContext): JsxConfig;
863
+ export declare function getJsxConfigFromAnnotation(context: RuleContext): JsxConfig;
864
864
  /**
865
865
  * Get the fully‑merged JSX configuration for the current file.
866
866
  *
@@ -872,7 +872,7 @@ declare function getJsxConfigFromAnnotation(context: RuleContext): JsxConfig;
872
872
  * @param context The ESLint rule context.
873
873
  * @returns Fully‑populated, merged `JsxConfig`.
874
874
  */
875
- declare function getJsxConfig(context: RuleContext): Required<JsxConfig>;
875
+ export declare function getJsxConfig(context: RuleContext): Required<JsxConfig>;
876
876
  //#endregion
877
877
  //#region src/type-is.d.ts
878
878
  /**
@@ -880,44 +880,44 @@ declare function getJsxConfig(context: RuleContext): Required<JsxConfig>;
880
880
  * @param type The type to check.
881
881
  * @returns `true` if the type is a boolean literal type.
882
882
  */
883
- declare function isBooleanLiteralType<TType extends ts.Type>(type: TType): type is TType & {
883
+ export declare function isBooleanLiteralType<TType extends ts.Type>(type: TType): type is TType & {
884
884
  intrinsicName: "false" | "true";
885
885
  };
886
886
  /**
887
887
  * Check if the type is the `false` literal type.
888
888
  * @internal
889
889
  */
890
- declare const isFalseLiteralType: (type: ts.Type) => boolean;
890
+ export declare const isFalseLiteralType: (type: ts.Type) => boolean;
891
891
  /**
892
892
  * Check if the type is the `true` literal type.
893
893
  * @internal
894
894
  */
895
- declare const isTrueLiteralType: (type: ts.Type) => boolean;
895
+ export declare const isTrueLiteralType: (type: ts.Type) => boolean;
896
896
  /**
897
897
  * Check if the type is an any-like type.
898
898
  * @internal
899
899
  */
900
- declare const isAnyType: (type: ts.Type) => boolean;
900
+ export declare const isAnyType: (type: ts.Type) => boolean;
901
901
  /**
902
902
  * Check if the type is a bigint-like type.
903
903
  * @internal
904
904
  */
905
- declare const isBigIntType: (type: ts.Type) => boolean;
905
+ export declare const isBigIntType: (type: ts.Type) => boolean;
906
906
  /**
907
907
  * Check if the type is a boolean-like type.
908
908
  * @internal
909
909
  */
910
- declare const isBooleanType: (type: ts.Type) => boolean;
910
+ export declare const isBooleanType: (type: ts.Type) => boolean;
911
911
  /**
912
912
  * Check if the type is an enum-like type.
913
913
  * @internal
914
914
  */
915
- declare const isEnumType: (type: ts.Type) => boolean;
915
+ export declare const isEnumType: (type: ts.Type) => boolean;
916
916
  /**
917
917
  * Check if the type is a falsy bigint literal type.
918
918
  * @internal
919
919
  */
920
- declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
920
+ export declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
921
921
  freshType: ts.FreshableType;
922
922
  regularType: ts.FreshableType;
923
923
  flags: ts.TypeFlags;
@@ -957,42 +957,42 @@ declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
957
957
  * Check if the type is a falsy number literal type.
958
958
  * @internal
959
959
  */
960
- declare const isFalsyNumberType: (type: ts.Type) => boolean;
960
+ export declare const isFalsyNumberType: (type: ts.Type) => boolean;
961
961
  /**
962
962
  * Check if the type is a falsy string literal type.
963
963
  * @internal
964
964
  */
965
- declare const isFalsyStringType: (type: ts.Type) => boolean;
965
+ export declare const isFalsyStringType: (type: ts.Type) => boolean;
966
966
  /**
967
967
  * Check if the type is the never type.
968
968
  * @internal
969
969
  */
970
- declare const isNeverType: (type: ts.Type) => boolean;
970
+ export declare const isNeverType: (type: ts.Type) => boolean;
971
971
  /**
972
972
  * Check if the type is a nullish type (null, undefined, or void).
973
973
  * @internal
974
974
  */
975
- declare const isNullishType: (type: ts.Type) => boolean;
975
+ export declare const isNullishType: (type: ts.Type) => boolean;
976
976
  /**
977
977
  * Check if the type is a number-like type.
978
978
  * @internal
979
979
  */
980
- declare const isNumberType: (type: ts.Type) => boolean;
980
+ export declare const isNumberType: (type: ts.Type) => boolean;
981
981
  /**
982
982
  * Check if the type is an object type.
983
983
  * @internal
984
984
  */
985
- declare const isObjectType: (type: ts.Type) => boolean;
985
+ export declare const isObjectType: (type: ts.Type) => boolean;
986
986
  /**
987
987
  * Check if the type is a string-like type.
988
988
  * @internal
989
989
  */
990
- declare const isStringType: (type: ts.Type) => boolean;
990
+ export declare const isStringType: (type: ts.Type) => boolean;
991
991
  /**
992
992
  * Check if the type is a truthy bigint literal type.
993
993
  * @internal
994
994
  */
995
- declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
995
+ export declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
996
996
  freshType: ts.FreshableType;
997
997
  regularType: ts.FreshableType;
998
998
  flags: ts.TypeFlags;
@@ -1029,17 +1029,17 @@ declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
1029
1029
  * Check if the type is a truthy number literal type.
1030
1030
  * @internal
1031
1031
  */
1032
- declare const isTruthyNumberType: (type: ts.Type) => boolean;
1032
+ export declare const isTruthyNumberType: (type: ts.Type) => boolean;
1033
1033
  /**
1034
1034
  * Check if the type is a truthy string literal type.
1035
1035
  * @internal
1036
1036
  */
1037
- declare const isTruthyStringType: (type: ts.Type) => boolean;
1037
+ export declare const isTruthyStringType: (type: ts.Type) => boolean;
1038
1038
  /**
1039
1039
  * Check if the type is the unknown type.
1040
1040
  * @internal
1041
1041
  */
1042
- declare const isUnknownType: (type: ts.Type) => boolean;
1042
+ export declare const isUnknownType: (type: ts.Type) => boolean;
1043
1043
  //#endregion
1044
1044
  //#region src/type-name.d.ts
1045
1045
  /**
@@ -1048,11 +1048,11 @@ declare const isUnknownType: (type: ts.Type) => boolean;
1048
1048
  * @param symbol The symbol to get fully qualified name for.
1049
1049
  * @returns The fully qualified name of the symbol.
1050
1050
  */
1051
- declare function getFullyQualifiedNameEx(checker: ts.TypeChecker, symbol: ts.Symbol): string;
1051
+ export declare function getFullyQualifiedNameEx(checker: ts.TypeChecker, symbol: ts.Symbol): string;
1052
1052
  //#endregion
1053
1053
  //#region src/type-variant.d.ts
1054
1054
  /** Represents the variant of a type for boolean expression analysis. */
1055
- type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" | "number" | "object" | "string" | "unknown" | "falsy bigint" | "falsy boolean" | "falsy number" | "falsy string" | "truthy bigint" | "truthy boolean" | "truthy number" | "truthy string";
1055
+ export type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" | "number" | "object" | "string" | "unknown" | "falsy bigint" | "falsy boolean" | "falsy number" | "falsy string" | "truthy bigint" | "truthy boolean" | "truthy number" | "truthy string";
1056
1056
  /**
1057
1057
  * Get the variants of an array of types.
1058
1058
  * @param types The types to get the variants of.
@@ -1060,6 +1060,5 @@ type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" |
1060
1060
  * @remarks Ported from https://github.com/typescript-eslint/typescript-eslint/blob/eb736bbfc22554694400e6a4f97051d845d32e0b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts#L826 with some enhancements.
1061
1061
  * @internal
1062
1062
  */
1063
- declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
1064
- //#endregion
1065
- export { ClassComponentSemanticNode, ClientFunctionSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, FunctionComponentSemanticNode, FunctionDisplayNameAssignment, FunctionID, FunctionInitPath, FunctionKind, FunctionSemanticNode, HookCall, HookSemanticNode, JsxConfig, JsxDetectionHint, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, SemanticFunc, SemanticNode, ServerFunctionSemanticNode, TypeVariant, getClassComponentCollector, getClassId, getCreateElementChildrenArguments, getCreateElementProp, getCreateElementPropsObject, getCreateElementTypeArgument, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateElementChildrenArgument, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFunctionComponentDefinition, isFunctionComponentName, isFunctionComponentNameLoose, isFunctionComponentWrapperCall, isFunctionComponentWrapperCallback, isFunctionEmpty, isFunctionHasCallInInitPath, isFunctionHasDirective, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHookCall, isHookDefinition, isHookId, isHookName, isHookTag, isInsideCreateElementProps, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isStringType, isThisSetStateCall, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUse, isUseActionState, isUseActionStateCall, isUseCall, isUseCallback, isUseCallbackCall, isUseContext, isUseContextCall, isUseDebugValue, isUseDebugValueCall, isUseDeferredValue, isUseDeferredValueCall, isUseEffect, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatus, isUseFormStatusCall, isUseId, isUseIdCall, isUseImperativeHandle, isUseImperativeHandleCall, isUseInsertionEffect, isUseInsertionEffectCall, isUseLayoutEffect, isUseLayoutEffectCall, isUseMemo, isUseMemoCall, isUseOptimistic, isUseOptimisticCall, isUseReducer, isUseReducerCall, isUseRef, isUseRefCall, isUseRefLikeCall, isUseState, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStore, isUseSyncExternalStoreCall, isUseTransition, isUseTransitionCall };
1063
+ export declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
1064
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "5.18.8",
3
+ "version": "5.18.10",
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": {
@@ -29,10 +29,10 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@eslint-react/ast": "5.18.8",
33
- "@eslint-react/eslint": "5.18.8",
34
- "@eslint-react/shared": "5.18.8",
35
- "@eslint-react/var": "5.18.8",
32
+ "@eslint-react/ast": "5.18.10",
33
+ "@eslint-react/eslint": "5.18.10",
34
+ "@eslint-react/shared": "5.18.10",
35
+ "@eslint-react/var": "5.18.10",
36
36
  "@typescript-eslint/scope-manager": "^8.69.0",
37
37
  "@typescript-eslint/types": "^8.69.0",
38
38
  "@typescript-eslint/utils": "^8.69.0",
@@ -44,10 +44,10 @@
44
44
  "@local/testkit": "0.0.0",
45
45
  "@typescript-eslint/parser": "^8.69.0",
46
46
  "@typescript-eslint/typescript-estree": "^8.69.0",
47
- "eslint": "^10.9.1",
48
- "tsdown": "^0.22.14",
47
+ "eslint": "^10.10.0",
48
+ "tsdown": "^0.23.0",
49
49
  "typescript": "6.0.3",
50
- "vitest": "^4.1.11"
50
+ "vitest": "^5.0.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "eslint": "*",