@eslint-react/core 3.0.0-next.7 → 3.0.0-next.70

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 (3) hide show
  1. package/dist/index.d.ts +344 -318
  2. package/dist/index.js +607 -595
  3. package/package.json +7 -7
package/dist/index.d.ts CHANGED
@@ -1,11 +1,19 @@
1
1
  import * as ast from "@eslint-react/ast";
2
- import { unit } from "@eslint-react/eff";
3
2
  import { TSESTree } from "@typescript-eslint/types";
4
3
  import { RegExpLike, RuleContext } from "@eslint-react/shared";
5
4
  import { ESLintUtils, TSESTree as TSESTree$1 } from "@typescript-eslint/utils";
6
5
  import { Scope } from "@typescript-eslint/scope-manager";
7
6
  import * as typescript from "typescript";
8
7
 
8
+ //#region src/api/find-import-source.d.ts
9
+ /**
10
+ * Find the import source of a variable
11
+ * @param name The variable name
12
+ * @param initialScope The initial scope to search
13
+ * @returns The import source or null if not found
14
+ */
15
+ declare function findImportSource(name: string, initialScope: Scope): string | null;
16
+ //#endregion
9
17
  //#region src/api/is-from-react.d.ts
10
18
  /**
11
19
  * Check if a variable is initialized from React import
@@ -29,8 +37,8 @@ declare function isInitializedFromReactNative(name: string, initialScope: Scope,
29
37
  //#region src/api/is-react-api.d.ts
30
38
  declare namespace isReactAPI {
31
39
  type ReturnType = {
32
- (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
33
- (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
40
+ (context: RuleContext, node: null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
41
+ (context: RuleContext): (node: null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
34
42
  };
35
43
  }
36
44
  /**
@@ -41,8 +49,8 @@ declare namespace isReactAPI {
41
49
  declare function isReactAPI(api: string): isReactAPI.ReturnType;
42
50
  declare namespace isReactAPICall {
43
51
  type ReturnType = {
44
- (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.CallExpression;
45
- (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.CallExpression;
52
+ (context: RuleContext, node: null | TSESTree.Node): node is TSESTree.CallExpression;
53
+ (context: RuleContext): (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
46
54
  };
47
55
  }
48
56
  /**
@@ -78,19 +86,19 @@ declare const isForwardRefCall: isReactAPICall.ReturnType;
78
86
  declare const isMemoCall: isReactAPICall.ReturnType;
79
87
  declare const isLazyCall: isReactAPICall.ReturnType;
80
88
  //#endregion
81
- //#region src/component/component-detection-hint.d.ts
89
+ //#region src/component/component-detection.d.ts
82
90
  type ComponentDetectionHint = bigint;
83
91
  /**
84
92
  * Hints for component collector
85
93
  */
86
94
  declare const ComponentDetectionHint: {
87
- readonly DoNotIncludeFunctionDefinedOnObjectMethod: bigint;
95
+ readonly DoNotIncludeFunctionDefinedAsArrayFlatMapCallback: bigint;
96
+ readonly DoNotIncludeFunctionDefinedAsArrayMapCallback: bigint;
97
+ readonly DoNotIncludeFunctionDefinedInArrayExpression: bigint;
98
+ readonly DoNotIncludeFunctionDefinedInArrayPattern: bigint;
88
99
  readonly DoNotIncludeFunctionDefinedOnClassMethod: bigint;
89
100
  readonly DoNotIncludeFunctionDefinedOnClassProperty: bigint;
90
- readonly DoNotIncludeFunctionDefinedInArrayPattern: bigint;
91
- readonly DoNotIncludeFunctionDefinedInArrayExpression: bigint;
92
- readonly DoNotIncludeFunctionDefinedAsArrayMapCallback: bigint;
93
- readonly DoNotIncludeFunctionDefinedAsArrayFlatMapCallback: bigint;
101
+ readonly DoNotIncludeFunctionDefinedOnObjectMethod: bigint;
94
102
  readonly None: 0n;
95
103
  readonly DoNotIncludeJsxWithNullValue: bigint;
96
104
  readonly DoNotIncludeJsxWithNumberValue: bigint;
@@ -108,6 +116,15 @@ declare const ComponentDetectionHint: {
108
116
  * Default component detection hint
109
117
  */
110
118
  declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
119
+ /**
120
+ * Determine if a function node represents a valid React component definition
121
+ *
122
+ * @param context The rule context
123
+ * @param node The function node to analyze
124
+ * @param hint Component detection hints (bit flags) to customize detection logic
125
+ * @returns `true` if the node is considered a component definition
126
+ */
127
+ declare function isComponentDefinition(context: RuleContext, node: ast.TSESTreeFunction, hint: bigint): boolean;
111
128
  //#endregion
112
129
  //#region src/semantic/semantic-node.d.ts
113
130
  /**
@@ -116,19 +133,19 @@ declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
116
133
  */
117
134
  interface SemanticNode {
118
135
  /** The identifier of the node */
119
- id: unit | TSESTree.Node;
136
+ id: null | TSESTree.Node;
120
137
  /** The unique key of the node */
121
138
  key: string;
122
139
  /** The kind of the node */
123
140
  kind: string;
124
141
  /** The name of the node */
125
- name: unit | string;
126
- /** The AST node */
127
- node: TSESTree.Node;
142
+ name: null | string;
128
143
  /** The flag of the node */
129
144
  flag: bigint;
130
145
  /** The hint of the node */
131
146
  hint: bigint;
147
+ /** The AST node */
148
+ node: TSESTree.Node;
132
149
  }
133
150
  //#endregion
134
151
  //#region src/semantic/semantic-func.d.ts
@@ -138,13 +155,13 @@ interface SemanticNode {
138
155
  */
139
156
  interface SemanticFunc extends SemanticNode {
140
157
  /** The identifier of the function */
141
- id: ast.FunctionID | unit;
158
+ id: ast.FunctionID;
142
159
  /** The AST node of the function */
143
160
  node: ast.TSESTreeFunction;
144
161
  /** The name of the function */
145
- name: string | unit;
162
+ name: string | null;
146
163
  /** The return type annotation of the function */
147
- type: TSESTree.TSTypeAnnotation | unit;
164
+ type: TSESTree.TSTypeAnnotation | null;
148
165
  /** The body of the function */
149
166
  body: TSESTree.BlockStatement | TSESTree.Expression;
150
167
  /** The directives of the function (e.g., "use strict", "use client", "use server", etc.) */
@@ -152,22 +169,9 @@ interface SemanticFunc extends SemanticNode {
152
169
  /** The parameters of the function */
153
170
  parameters: TSESTree.Parameter[];
154
171
  /** The type parameters of the function */
155
- typeParameters: TSESTree.TSTypeParameterDeclaration | unit;
172
+ typeParameters: TSESTree.TSTypeParameterDeclaration | null;
156
173
  }
157
174
  //#endregion
158
- //#region src/component/component-flag.d.ts
159
- type ComponentFlag = bigint;
160
- /**
161
- * Component flag constants
162
- */
163
- declare const ComponentFlag: {
164
- /** No flags set */None: bigint; /** Indicates the component is a pure component (e.g., extends PureComponent) */
165
- PureComponent: bigint; /** Indicates the component creates elements using `createElement` instead of JSX */
166
- CreateElement: bigint; /** Indicates the component is memoized (e.g., React.memo) */
167
- Memo: bigint; /** Indicates the component forwards a ref (e.g., React.forwardRef) */
168
- ForwardRef: bigint;
169
- };
170
- //#endregion
171
175
  //#region src/component/component-semantic-node.d.ts
172
176
  /**
173
177
  * Represents a React Function Component
@@ -176,7 +180,7 @@ interface FunctionComponentSemanticNode extends SemanticNode {
176
180
  /**
177
181
  * The identifier or identifier sequence of the component
178
182
  */
179
- id: unit | ast.FunctionID;
183
+ id: ast.FunctionID;
180
184
  /**
181
185
  * The kind of component
182
186
  */
@@ -188,11 +192,11 @@ interface FunctionComponentSemanticNode extends SemanticNode {
188
192
  /**
189
193
  * Flags describing the component's characteristics
190
194
  */
191
- flag: ComponentFlag;
195
+ flag: bigint;
192
196
  /**
193
197
  * Hint for how the component was detected
194
198
  */
195
- hint: ComponentDetectionHint;
199
+ hint: bigint;
196
200
  /**
197
201
  * List of expressions returned by the component
198
202
  */
@@ -200,7 +204,7 @@ interface FunctionComponentSemanticNode extends SemanticNode {
200
204
  /**
201
205
  * The initialization path of the function
202
206
  */
203
- initPath: unit | ast.FunctionInitPath;
207
+ initPath: null | ast.FunctionInitPath;
204
208
  /**
205
209
  * Indicates if the component is inside an export default declaration
206
210
  */
@@ -216,7 +220,7 @@ interface FunctionComponentSemanticNode extends SemanticNode {
216
220
  /**
217
221
  * The display name of the component
218
222
  */
219
- displayName: unit | TSESTree.Expression;
223
+ displayName: null | TSESTree.Expression;
220
224
  /**
221
225
  * The directives used in the function (e.g., "use strict", "use client", etc.)
222
226
  */
@@ -229,7 +233,7 @@ interface ClassComponentSemanticNode extends SemanticNode {
229
233
  /**
230
234
  * The identifier of the component
231
235
  */
232
- id: unit | TSESTree.BindingName;
236
+ id: null | TSESTree.BindingName;
233
237
  /**
234
238
  * The kind of component
235
239
  */
@@ -241,11 +245,11 @@ interface ClassComponentSemanticNode extends SemanticNode {
241
245
  /**
242
246
  * Flags describing the component's characteristics
243
247
  */
244
- flag: ComponentFlag;
248
+ flag: bigint;
245
249
  /**
246
250
  * Hint for how the component was detected
247
251
  */
248
- hint: ComponentDetectionHint;
252
+ hint: bigint;
249
253
  /**
250
254
  * List of methods and properties in the class
251
255
  */
@@ -253,7 +257,7 @@ interface ClassComponentSemanticNode extends SemanticNode {
253
257
  /**
254
258
  * The display name of the component
255
259
  */
256
- displayName: unit | TSESTree.Expression;
260
+ displayName: null | TSESTree.Expression;
257
261
  }
258
262
  /**
259
263
  * Represents a React Component
@@ -273,7 +277,7 @@ declare namespace useComponentCollector {
273
277
  ctx: {
274
278
  getAllComponents: (node: TSESTree.Program) => FunctionComponentSemanticNode[];
275
279
  getCurrentEntries: () => FunctionEntry$1[];
276
- getCurrentEntry: () => FunctionEntry$1 | unit;
280
+ getCurrentEntry: () => FunctionEntry$1 | null;
277
281
  };
278
282
  visitor: ESLintUtils.RuleListener;
279
283
  };
@@ -301,48 +305,8 @@ declare namespace useComponentCollectorLegacy {
301
305
  * @returns The ctx and visitor of the collector
302
306
  */
303
307
  declare function useComponentCollectorLegacy(context: RuleContext): useComponentCollectorLegacy.ReturnType;
304
- /**
305
- * Check whether the given node is a this.setState() call
306
- * @param node The node to check
307
- * @internal
308
- */
309
- declare function isThisSetState(node: TSESTree$1.CallExpression): boolean;
310
- /**
311
- * Check whether the given node is an assignment to this.state
312
- * @param node The node to check
313
- * @internal
314
- */
315
- declare function isAssignmentToThisState(node: TSESTree$1.AssignmentExpression): boolean;
316
308
  //#endregion
317
- //#region src/component/component-definition.d.ts
318
- /**
319
- * Determine if a function node represents a valid React component definition
320
- *
321
- * @param context The rule context
322
- * @param node The function node to analyze
323
- * @param hint Component detection hints (bit flags) to customize detection logic
324
- * @returns `true` if the node is considered a component definition
325
- */
326
- declare function isComponentDefinition(context: RuleContext, node: ast.TSESTreeFunction, hint: bigint): boolean;
327
- //#endregion
328
- //#region src/component/component-id.d.ts
329
- /**
330
- * Get function component identifier from `const Component = memo(() => {});`
331
- * @param context The rule context
332
- * @param node The function node to analyze
333
- * @returns The function identifier or `unit` if not found
334
- */
335
- declare function getFunctionComponentId(context: RuleContext, node: ast.TSESTreeFunction): ast.FunctionID | unit;
336
- //#endregion
337
- //#region src/component/component-init-path.d.ts
338
- /**
339
- * Get component flag from init path
340
- * @param initPath The init path of the function component
341
- * @returns The component flag
342
- */
343
- declare function getComponentFlagFromInitPath(initPath: FunctionComponentSemanticNode["initPath"]): bigint;
344
- //#endregion
345
- //#region src/component/component-is.d.ts
309
+ //#region src/component/component-detection-legacy.d.ts
346
310
  /**
347
311
  * Check if a node is a React class component
348
312
  * @param node The AST node to check
@@ -355,22 +319,6 @@ declare function isClassComponent(node: TSESTree.Node): node is ast.TSESTreeClas
355
319
  * @returns `true` if the node is a PureComponent, `false` otherwise
356
320
  */
357
321
  declare function isPureComponent(node: TSESTree.Node): boolean;
358
- //#endregion
359
- //#region src/component/component-method-callback.d.ts
360
- /**
361
- * Check if the given node is a componentDidMount callback
362
- * @param node The node to check
363
- * @returns True if the node is a componentDidMount callback, false otherwise
364
- */
365
- declare function isComponentDidMountCallback(node: TSESTree.Node): boolean;
366
- /**
367
- * Check if the given node is a componentWillUnmount callback
368
- * @param node The node to check
369
- * @returns True if the node is a componentWillUnmount callback, false otherwise
370
- */
371
- declare function isComponentWillUnmountCallback(node: TSESTree.Node): boolean;
372
- //#endregion
373
- //#region src/component/component-method-is.d.ts
374
322
  declare const isRender: (node: TSESTree.Node) => node is ast.TSESTreeMethodOrProperty;
375
323
  declare const isComponentDidCatch: (node: TSESTree.Node) => node is ast.TSESTreeMethodOrProperty;
376
324
  declare const isComponentDidMount: (node: TSESTree.Node) => node is ast.TSESTreeMethodOrProperty;
@@ -389,28 +337,18 @@ declare const isUnsafeComponentWillUpdate: (node: TSESTree.Node) => node is ast.
389
337
  declare const isGetDefaultProps: (node: TSESTree.Node) => node is ast.TSESTreeMethodOrProperty;
390
338
  declare const isGetDerivedStateFromProps: (node: TSESTree.Node) => node is ast.TSESTreeMethodOrProperty;
391
339
  declare const isGetDerivedStateFromError: (node: TSESTree.Node) => node is ast.TSESTreeMethodOrProperty;
392
- //#endregion
393
- //#region src/component/component-name.d.ts
394
- /**
395
- * Check if a string matches the strict component name pattern
396
- * @param name The name to check
397
- */
398
- declare function isComponentName(name: string): boolean;
399
340
  /**
400
- * Check if a string matches the loose component name pattern
401
- * @param name The name to check
341
+ * Check if the given node is a componentDidMount callback
342
+ * @param node The node to check
343
+ * @returns True if the node is a componentDidMount callback, false otherwise
402
344
  */
403
- declare function isComponentNameLoose(name: string): boolean;
345
+ declare function isComponentDidMountCallback(node: TSESTree.Node): boolean;
404
346
  /**
405
- * Check if a function has a loose component name
406
- * @param context The rule context
407
- * @param fn The function to check
408
- * @param allowNone Whether to allow no name
409
- * @returns Whether the function has a loose component name
347
+ * Check if the given node is a componentWillUnmount callback
348
+ * @param node The node to check
349
+ * @returns True if the node is a componentWillUnmount callback, false otherwise
410
350
  */
411
- declare function isFunctionWithLooseComponentName(context: RuleContext, fn: ast.TSESTreeFunction, allowNone?: boolean): boolean;
412
- //#endregion
413
- //#region src/component/component-render-method.d.ts
351
+ declare function isComponentWillUnmountCallback(node: TSESTree.Node): boolean;
414
352
  /**
415
353
  * Check whether given node is a render method of a class component
416
354
  * @example
@@ -424,57 +362,79 @@ declare function isFunctionWithLooseComponentName(context: RuleContext, fn: ast.
424
362
  * @returns `true` if node is a render function, `false` if not
425
363
  */
426
364
  declare function isRenderMethodLike(node: TSESTree.Node): node is ast.TSESTreeMethodOrProperty;
427
- //#endregion
428
- //#region src/component/component-render-prop.d.ts
429
365
  /**
430
- * Unsafe check whether given node is a render function
366
+ * Check if the given node is a function within a render method of a class component
367
+ *
368
+ * @param node The AST node to check
369
+ * @returns `true` if the node is a render function inside a class component
370
+ *
371
+ * @example
431
372
  * ```tsx
432
- * const renderRow = () => <div />
433
- * ` ^^^^^^^^^^^^`
434
- * _ = <Component renderRow={() => <div />} />
435
- * ` ^^^^^^^^^^^^^ `
373
+ * class Component extends React.Component {
374
+ * renderHeader = () => <div />; // Returns true
375
+ * }
436
376
  * ```
437
- * @param context The rule context
438
- * @param node The AST node to check
439
- * @returns `true` if node is a render function, `false` if not
440
377
  */
441
- declare function isRenderFunctionLoose(context: RuleContext, node: TSESTree.Node): node is ast.TSESTreeFunction;
378
+ declare function isRenderMethodCallback(node: ast.TSESTreeFunction): boolean;
442
379
  /**
443
- * Unsafe check whether given JSXAttribute is a render prop
444
- * ```tsx
445
- * _ = <Component renderRow={() => <div />} />
446
- * ` ^^^^^^^^^^^^^^^^^^^^^^^^^ `
447
- * ```
448
- * @param context The rule context
449
- * @param node The AST node to check
450
- * @returns `true` if node is a render prop, `false` if not
380
+ * Check whether the given node is a this.setState() call
381
+ * @param node The node to check
382
+ * @internal
451
383
  */
452
- declare function isRenderPropLoose(context: RuleContext, node: TSESTree.JSXAttribute): boolean;
384
+ declare function isThisSetState(node: TSESTree.CallExpression): boolean;
453
385
  /**
454
- * Unsafe check whether given node is declared directly inside a render property
455
- * ```tsx
456
- * const rows = { render: () => <div /> }
457
- * ` ^^^^^^^^^^^^^ `
458
- * _ = <Component rows={ [{ render: () => <div /> }] } />
459
- * ` ^^^^^^^^^^^^^ `
460
- * ```
386
+ * Check whether the given node is an assignment to this.state
387
+ * @param node The node to check
461
388
  * @internal
462
- * @param node The AST node to check
463
- * @returns `true` if component is declared inside a render property, `false` if not
464
389
  */
465
- declare function isDirectValueOfRenderPropertyLoose(node: TSESTree.Node): boolean;
390
+ declare function isAssignmentToThisState(node: TSESTree.AssignmentExpression): boolean;
391
+ //#endregion
392
+ //#region src/component/component-flag.d.ts
466
393
  /**
467
- * Unsafe check whether given node is declared inside a render prop
468
- * ```tsx
469
- * _ = <Component renderRow={"node"} />
470
- * ` ^^^^^^ `
471
- * _ = <Component rows={ [{ render: "node" }] } />
472
- * ` ^^^^^^ `
473
- * ```
474
- * @param node The AST node to check
475
- * @returns `true` if component is declared inside a render prop, `false` if not
394
+ * Component flag constants
476
395
  */
477
- declare function isDeclaredInRenderPropLoose(node: TSESTree.Node): boolean;
396
+ declare const ComponentFlag: {
397
+ /** Indicates the component creates elements using `createElement` instead of JSX */CreateElement: bigint; /** Indicates the component forwards a ref (e.g., React.forwardRef) */
398
+ ForwardRef: bigint; /** Indicates the component is memoized (e.g., React.memo) */
399
+ Memo: bigint; /** No flags set */
400
+ None: bigint; /** Indicates the component is a pure component (e.g., extends PureComponent) */
401
+ PureComponent: bigint;
402
+ };
403
+ /**
404
+ * Get component flag from init path
405
+ * @param initPath The init path of the function component
406
+ * @returns The component flag
407
+ */
408
+ declare function getComponentFlagFromInitPath(initPath: FunctionComponentSemanticNode["initPath"]): bigint;
409
+ //#endregion
410
+ //#region src/component/component-id.d.ts
411
+ /**
412
+ * Get function component identifier from `const Component = memo(() => {});`
413
+ * @param context The rule context
414
+ * @param node The function node to analyze
415
+ * @returns The function identifier or `null` if not found
416
+ */
417
+ declare function getFunctionComponentId(context: RuleContext, node: ast.TSESTreeFunction): ast.FunctionID;
418
+ //#endregion
419
+ //#region src/component/component-name.d.ts
420
+ /**
421
+ * Check if a string matches the strict component name pattern
422
+ * @param name The name to check
423
+ */
424
+ declare function isComponentName(name: string): boolean;
425
+ /**
426
+ * Check if a string matches the loose component name pattern
427
+ * @param name The name to check
428
+ */
429
+ declare function isComponentNameLoose(name: string): boolean;
430
+ /**
431
+ * Check if a function has a loose component name
432
+ * @param context The rule context
433
+ * @param fn The function to check
434
+ * @param allowNone Whether to allow no name
435
+ * @returns Whether the function has a loose component name
436
+ */
437
+ declare function isFunctionWithLooseComponentName(context: RuleContext, fn: ast.TSESTreeFunction, allowNone?: boolean): boolean;
478
438
  //#endregion
479
439
  //#region src/component/component-wrapper.d.ts
480
440
  /**
@@ -510,7 +470,7 @@ declare function isComponentWrapperCallbackLoose(context: RuleContext, node: TSE
510
470
  /**
511
471
  * Represents the kind of a React function
512
472
  */
513
- type ComponentKind = "client-function" | "server-function";
473
+ type FunctionKind = "client-function" | "server-function";
514
474
  //#endregion
515
475
  //#region src/function/function-semantic-node.d.ts
516
476
  /**
@@ -536,35 +496,17 @@ interface ServerFunctionSemanticNode extends SemanticFunc {
536
496
  */
537
497
  type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSemanticNode;
538
498
  //#endregion
539
- //#region src/hierarchy/find-enclosing-component-or-hook.d.ts
540
- type FindEnclosingComponentOrHookFilter = (n: TSESTree.Node, name: string | null) => boolean;
541
- /**
542
- * Find the enclosing React component or hook for a given AST node
543
- * @param node The AST node to start the search from
544
- * @param test Optional test function to customize component or hook identification
545
- * @returns The enclosing component or hook node, or `null` if none is ASAST.
546
- */
547
- declare function findEnclosingComponentOrHook(node: TSESTree.Node | unit, test?: FindEnclosingComponentOrHookFilter): TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | undefined;
548
- //#endregion
549
- //#region src/hierarchy/is-inside-component-or-hook.d.ts
550
- /**
551
- * Check if a given AST node is inside a React component or hook
552
- * @param node The AST node to check
553
- * @returns True if the node is inside a component or hook, false otherwise
554
- */
555
- declare function isInsideComponentOrHook(node: TSESTree.Node | unit): boolean;
556
- //#endregion
557
499
  //#region src/hook/hook-callback.d.ts
558
500
  /**
559
501
  * Determine if a node is the setup function passed to a useEffect-like hook
560
502
  * @param node The AST node to check
561
503
  */
562
- declare function isUseEffectSetupCallback(node: TSESTree.Node | unit): boolean;
504
+ declare function isUseEffectSetupCallback(node: TSESTree.Node | null): boolean;
563
505
  /**
564
506
  * Determine if a node is the cleanup function returned by a useEffect-like hook's setup function
565
507
  * @param node The AST node to check
566
508
  */
567
- declare function isUseEffectCleanupCallback(node: TSESTree.Node | unit): boolean;
509
+ declare function isUseEffectCleanupCallback(node: TSESTree.Node | null): boolean;
568
510
  //#endregion
569
511
  //#region src/hook/hook-semantic-node.d.ts
570
512
  /**
@@ -573,7 +515,7 @@ declare function isUseEffectCleanupCallback(node: TSESTree.Node | unit): boolean
573
515
  */
574
516
  interface HookSemanticNode extends SemanticNode {
575
517
  /** The identifier of the hook */
576
- id: ast.FunctionID | unit;
518
+ id: ast.FunctionID;
577
519
  /** The AST node of the hook */
578
520
  node: ast.TSESTreeFunction;
579
521
  /** The name of the hook */
@@ -594,7 +536,7 @@ declare namespace useHookCollector {
594
536
  ctx: {
595
537
  getAllHooks(node: TSESTree$1.Program): HookSemanticNode[];
596
538
  getCurrentEntries(): FunctionEntry[];
597
- getCurrentEntry(): FunctionEntry | unit;
539
+ getCurrentEntry(): FunctionEntry | null;
598
540
  };
599
541
  visitor: ESLintUtils.RuleListener;
600
542
  };
@@ -620,53 +562,53 @@ declare function isHookId(id: TSESTree.Node): id is TSESTree.Identifier | TSESTr
620
562
  * @param node The function node to check
621
563
  * @returns True if the function is a React Hook, false otherwise
622
564
  */
623
- declare function isHook(node: ast.TSESTreeFunction | unit): boolean;
565
+ declare function isHook(node: ast.TSESTreeFunction | null): boolean;
624
566
  /**
625
567
  * Check if the given node is a React Hook call by its name.
626
568
  * @param node The node to check.
627
569
  * @returns `true` if the node is a React Hook call, `false` otherwise.
628
570
  */
629
- declare function isHookCall(node: TSESTree.Node | unit): node is TSESTree.CallExpression;
571
+ declare function isHookCall(node: TSESTree.Node | null): node is TSESTree.CallExpression;
630
572
  /**
631
573
  * Check if a node is a call to a specific React hook.
632
574
  * Returns a function that accepts a hook name to check against.
633
575
  * @param node The AST node to check
634
576
  * @returns A function that takes a hook name and returns boolean
635
577
  */
636
- declare function isHookCallWithName(node: TSESTree.Node | unit): (name: string) => boolean;
578
+ declare function isHookCallWithName(node: TSESTree.Node | null): (name: string) => boolean;
637
579
  /**
638
580
  * Detect useEffect calls and variations (useLayoutEffect, etc.) using a regex pattern
639
581
  * @param node The AST node to check
640
582
  * @param additionalEffectHooks Regex pattern matching custom hooks that should be treated as effect hooks
641
583
  * @returns True if the node is a useEffect-like call
642
584
  */
643
- declare function isUseEffectLikeCall(node: TSESTree.Node | unit, additionalEffectHooks?: RegExpLike): node is TSESTree.CallExpression;
585
+ declare function isUseEffectLikeCall(node: TSESTree.Node | null, additionalEffectHooks?: RegExpLike): node is TSESTree.CallExpression;
644
586
  /**
645
587
  * Detect useState calls and variations (useCustomState, etc.) using a regex pattern
646
588
  * @param node The AST node to check
647
589
  * @param additionalStateHooks Regex pattern matching custom hooks that should be treated as state hooks
648
590
  * @returns True if the node is a useState-like call
649
591
  */
650
- declare function isUseStateLikeCall(node: TSESTree.Node | unit, additionalStateHooks?: RegExpLike): node is TSESTree.CallExpression;
651
- declare const isUseCall: (node: TSESTree.Node | undefined) => boolean;
652
- declare const isUseActionStateCall: (node: TSESTree.Node | undefined) => boolean;
653
- declare const isUseCallbackCall: (node: TSESTree.Node | undefined) => boolean;
654
- declare const isUseContextCall: (node: TSESTree.Node | undefined) => boolean;
655
- declare const isUseDebugValueCall: (node: TSESTree.Node | undefined) => boolean;
656
- declare const isUseDeferredValueCall: (node: TSESTree.Node | undefined) => boolean;
657
- declare const isUseEffectCall: (node: TSESTree.Node | undefined) => boolean;
658
- declare const isUseFormStatusCall: (node: TSESTree.Node | undefined) => boolean;
659
- declare const isUseIdCall: (node: TSESTree.Node | undefined) => boolean;
660
- declare const isUseImperativeHandleCall: (node: TSESTree.Node | undefined) => boolean;
661
- declare const isUseInsertionEffectCall: (node: TSESTree.Node | undefined) => boolean;
662
- declare const isUseLayoutEffectCall: (node: TSESTree.Node | undefined) => boolean;
663
- declare const isUseMemoCall: (node: TSESTree.Node | undefined) => boolean;
664
- declare const isUseOptimisticCall: (node: TSESTree.Node | undefined) => boolean;
665
- declare const isUseReducerCall: (node: TSESTree.Node | undefined) => boolean;
666
- declare const isUseRefCall: (node: TSESTree.Node | undefined) => boolean;
667
- declare const isUseStateCall: (node: TSESTree.Node | undefined) => boolean;
668
- declare const isUseSyncExternalStoreCall: (node: TSESTree.Node | undefined) => boolean;
669
- declare const isUseTransitionCall: (node: TSESTree.Node | undefined) => boolean;
592
+ declare function isUseStateLikeCall(node: TSESTree.Node | null, additionalStateHooks?: RegExpLike): node is TSESTree.CallExpression;
593
+ declare const isUseCall: (node: TSESTree.Node | null) => boolean;
594
+ declare const isUseActionStateCall: (node: TSESTree.Node | null) => boolean;
595
+ declare const isUseCallbackCall: (node: TSESTree.Node | null) => boolean;
596
+ declare const isUseContextCall: (node: TSESTree.Node | null) => boolean;
597
+ declare const isUseDebugValueCall: (node: TSESTree.Node | null) => boolean;
598
+ declare const isUseDeferredValueCall: (node: TSESTree.Node | null) => boolean;
599
+ declare const isUseEffectCall: (node: TSESTree.Node | null) => boolean;
600
+ declare const isUseFormStatusCall: (node: TSESTree.Node | null) => boolean;
601
+ declare const isUseIdCall: (node: TSESTree.Node | null) => boolean;
602
+ declare const isUseImperativeHandleCall: (node: TSESTree.Node | null) => boolean;
603
+ declare const isUseInsertionEffectCall: (node: TSESTree.Node | null) => boolean;
604
+ declare const isUseLayoutEffectCall: (node: TSESTree.Node | null) => boolean;
605
+ declare const isUseMemoCall: (node: TSESTree.Node | null) => boolean;
606
+ declare const isUseOptimisticCall: (node: TSESTree.Node | null) => boolean;
607
+ declare const isUseReducerCall: (node: TSESTree.Node | null) => boolean;
608
+ declare const isUseRefCall: (node: TSESTree.Node | null) => boolean;
609
+ declare const isUseStateCall: (node: TSESTree.Node | null) => boolean;
610
+ declare const isUseSyncExternalStoreCall: (node: TSESTree.Node | null) => boolean;
611
+ declare const isUseTransitionCall: (node: TSESTree.Node | null) => boolean;
670
612
  //#endregion
671
613
  //#region src/hook/hook-name.d.ts
672
614
  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"];
@@ -678,30 +620,15 @@ declare const REACT_BUILTIN_HOOK_NAMES: readonly ["use", "useActionState", "useC
678
620
  */
679
621
  declare function isHookName(name: string): boolean;
680
622
  //#endregion
681
- //#region src/jsx/jsx-attribute.d.ts
682
- /**
683
- * Creates a helper function to find a specific JSX attribute by name
684
- * Handles direct attributes and spread attributes (variables or object literals)
685
- * @param context The ESLint rule context
686
- * @param node The JSX element node
687
- * @param initialScope (Optional) The initial scope to use for variable resolution
688
- */
689
- declare function getJsxAttribute(context: RuleContext, node: TSESTree.JSXElement, initialScope?: Scope): (name: string) => TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute | undefined;
690
- //#endregion
691
- //#region src/jsx/jsx-attribute-name.d.ts
692
- /**
693
- * Get the stringified name of a JSX attribute
694
- * @param context The ESLint rule context
695
- * @param node The JSX attribute node
696
- * @returns The name of the attribute
697
- */
698
- declare function getJsxAttributeName(context: RuleContext, node: TSESTree$1.JSXAttribute): string;
699
- //#endregion
700
623
  //#region src/jsx/jsx-attribute-value.d.ts
701
624
  /**
702
625
  * Represents possible JSX attribute value types that can be resolved
703
626
  */
704
627
  type JsxAttributeValue = {
628
+ kind: "missing";
629
+ node: TSESTree.JSXEmptyExpression;
630
+ toStatic(): "{}";
631
+ } | {
705
632
  kind: "boolean";
706
633
  toStatic(): true;
707
634
  } | {
@@ -718,45 +645,15 @@ type JsxAttributeValue = {
718
645
  toStatic(): unknown;
719
646
  } | {
720
647
  kind: "spreadProps";
648
+ getProperty(name: string): unknown;
721
649
  node: TSESTree.JSXSpreadAttribute["argument"];
722
- toStatic(name?: string): unknown;
650
+ toStatic(): unknown;
723
651
  } | {
724
652
  kind: "spreadChild";
653
+ getChildren(at: number): unknown;
725
654
  node: TSESTree.JSXSpreadChild["expression"];
726
655
  toStatic(): unknown;
727
656
  };
728
- /**
729
- * Resolve the static value of a JSX attribute or spread attribute
730
- *
731
- * @param context - The ESLint rule context
732
- * @param attribute - The JSX attribute node to resolve
733
- * @returns An object containing the value kind, the node (if applicable), and a `toStatic` helper
734
- */
735
- declare function resolveJsxAttributeValue(context: RuleContext, attribute: ast.TSESTreeJSXAttributeLike): {
736
- readonly kind: "boolean";
737
- readonly toStatic: () => true;
738
- readonly node?: never;
739
- } | {
740
- readonly kind: "literal";
741
- readonly node: TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral;
742
- readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
743
- } | {
744
- readonly kind: "expression";
745
- readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
746
- readonly toStatic: () => unknown;
747
- } | {
748
- readonly kind: "element";
749
- readonly node: TSESTree.JSXElement;
750
- readonly toStatic: () => undefined;
751
- } | {
752
- readonly kind: "spreadChild";
753
- readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
754
- readonly toStatic: () => undefined;
755
- } | {
756
- readonly kind: "spreadProps";
757
- readonly node: TSESTree.Expression;
758
- readonly toStatic: (name?: string) => unknown;
759
- };
760
657
  //#endregion
761
658
  //#region src/jsx/jsx-config.d.ts
762
659
  declare const JsxEmit: {
@@ -815,81 +712,210 @@ declare const JsxDetectionHint: {
815
712
  * Skips undefined and boolean literals (common in React)
816
713
  */
817
714
  declare const DEFAULT_JSX_DETECTION_HINT: bigint;
818
- /**
819
- * Check if a node is a `JSXText` or a `Literal` node
820
- * @param node The AST node to check
821
- * @returns `true` if the node is a `JSXText` or a `Literal` node
822
- */
823
- declare function isJsxText(node: TSESTree$1.Node | null | unit): node is TSESTree$1.JSXText | TSESTree$1.Literal;
824
715
  /**
825
716
  * Determine if a node represents JSX-like content based on heuristics
826
717
  * Supports configuration through hint flags to customize detection behavior
827
718
  *
828
- * @param code The source code with scope lookup capability
829
- * @param code.getScope The function to get the scope of a node
719
+ * @param context The rule context with scope lookup capability
830
720
  * @param node The AST node to analyze
831
721
  * @param hint The configuration flags to adjust detection behavior
832
722
  * @returns boolean Whether the node is considered JSX-like
833
723
  */
834
- declare function isJsxLike(code: {
835
- getScope: (node: TSESTree$1.Node) => Scope;
836
- }, node: TSESTree$1.Node | unit | null, hint?: JsxDetectionHint): boolean;
724
+ declare function isJsxLike(context: RuleContext, node: TSESTree$1.Node | null, hint?: JsxDetectionHint): boolean;
837
725
  //#endregion
838
- //#region src/jsx/jsx-element-is.d.ts
726
+ //#region src/jsx/jsx-inspector.d.ts
839
727
  /**
840
- * Determine if a JSX element is a host element
841
- * Host elements in React start with lowercase letters (e.g., div, span)
728
+ * A stateful helper that binds an ESLint `RuleContext` once and exposes
729
+ * ergonomic methods for the most common JSX inspection tasks that rules need.
842
730
  *
843
- * @param context ESLint rule context
844
- * @param node AST node to check
845
- * @returns boolean indicating if the element is a host element
846
- */
847
- declare function isJsxHostElement(context: RuleContext, node: TSESTree.Node): boolean;
848
- /**
849
- * Determine if a JSX element is a React Fragment
850
- * Fragments can be imported from React and used like <Fragment> or <React.Fragment>
731
+ * ### Typical usage inside a rule's `create` function
851
732
  *
852
- * @param context ESLint rule context
853
- * @param node AST node to check
854
- * @param jsxConfig Optional JSX configuration
855
- * @param jsxConfig.jsxFragmentFactory Name of the fragment factory (e.g., React.Fragment)
856
- * @returns boolean indicating if the element is a Fragment
857
- */
858
- declare function isJsxFragmentElement(context: RuleContext, node: TSESTree.Node, jsxConfig?: Pick<JsxConfig, "jsxFragmentFactory">): boolean;
859
- //#endregion
860
- //#region src/jsx/jsx-element-type.d.ts
861
- /**
862
- * Extracts the element type name from a JSX element or fragment
863
- * For JSX elements, returns the stringified name (e.g., "div", "Button", "React.Fragment")
864
- * For JSX fragments, returns an empty string
733
+ * ```ts
734
+ * export function create(context: RuleContext) {
735
+ * const jsx = JsxInspector.from(context);
865
736
  *
866
- * @param context ESLint rule context
867
- * @param node JSX element or fragment node
868
- * @returns String representation of the element type
869
- */
870
- declare function getJsxElementType(context: RuleContext, node: TSESTree.JSXElement | TSESTree.JSXFragment): string;
871
- //#endregion
872
- //#region src/jsx/jsx-hierarchy.d.ts
873
- /**
874
- * Traverses up the AST to find a parent JSX attribute node that matches a given test
737
+ * return defineRuleListener({
738
+ * JSXElement(node) {
739
+ * // element type
740
+ * const type = jsx.getElementType(node); // "div" | "React.Fragment" | …
875
741
  *
876
- * @param node The starting AST node
877
- * @param test Optional predicate function to test if the attribute meets criteria
878
- * Defaults to always returning true (matches any attribute)
879
- * @returns The first matching JSX attribute node found when traversing upwards, or undefined
880
- */
881
- declare function findParentJsxAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | unit;
882
- //#endregion
883
- //#region src/jsx/jsx-stringify.d.ts
884
- /**
885
- * Incomplete but sufficient stringification of JSX nodes for common use cases
742
+ * // attribute lookup + value resolution in one step
743
+ * const val = jsx.getAttributeValue(node, "sandbox");
744
+ * if (typeof val?.getStatic() === "string") { }
886
745
  *
887
- * @param node JSX node from TypeScript ESTree
888
- * @returns String representation of the JSX node
746
+ * // simple boolean checks
747
+ * if (jsx.isHostElement(node)) { }
748
+ * if (jsx.isFragmentElement(node)) { … }
749
+ * if (jsx.hasAttribute(node, "key")) { … }
750
+ * },
751
+ * });
752
+ * }
753
+ * ```
889
754
  */
890
- declare function stringifyJsx(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXClosingElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXText): string;
755
+ declare class JsxInspector {
756
+ #private;
757
+ readonly context: RuleContext;
758
+ /**
759
+ * Merged JSX configuration (tsconfig compiler options + pragma annotations).
760
+ * The result is lazily computed and cached for the lifetime of this inspector.
761
+ */
762
+ get jsxConfig(): Required<JsxConfig>;
763
+ private constructor();
764
+ /**
765
+ * Walk **up** the AST from `node` to find the nearest ancestor that is a
766
+ * `JSXAttribute` and passes the optional `test` predicate.
767
+ * @param node The starting node for the search.
768
+ * @param test A predicate function to test each ancestor node.
769
+ */
770
+ static findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | null;
771
+ /**
772
+ * Create a new `JsxInspector` bound to the given rule context.
773
+ * @param context The ESLint rule context to bind to this inspector instance.
774
+ */
775
+ static from(context: RuleContext): JsxInspector;
776
+ /**
777
+ * Whether the node is a `JSXText` or a `Literal` node.
778
+ * @param node The node to check.
779
+ */
780
+ static isJsxText(node: TSESTree.Node | null): node is TSESTree.JSXText | TSESTree.Literal;
781
+ /**
782
+ * Find a JSX attribute (or spread attribute containing the property) by name
783
+ * on a given element.
784
+ *
785
+ * Returns the **last** matching attribute (to mirror React's behaviour where
786
+ * later props win), or `undefined` if not found.
787
+ * @param node The JSX element to search for the attribute.
788
+ * @param name The name of the attribute to find (e.g. `"className"`).
789
+ * @param initialScope An optional scope to use for resolving spread attributes. If not provided,
790
+ */
791
+ findAttribute(node: TSESTree.JSXElement, name: string, initialScope?: Scope): ast.TSESTreeJSXAttributeLike | undefined;
792
+ /**
793
+ * Get the stringified name of a `JSXAttribute` node
794
+ * (e.g. `"className"`, `"aria-label"`, `"xml:space"`).
795
+ * @param node The `JSXAttribute` node to extract the name from.
796
+ * @returns The stringified name of the attribute.
797
+ */
798
+ getAttributeName(node: TSESTree.JSXAttribute): string;
799
+ /**
800
+ * Resolve the static value of an attribute, automatically handling the
801
+ * `spreadProps` case by extracting the named property.
802
+ *
803
+ * This eliminates the repetitive pattern:
804
+ * ```ts
805
+ * const v = core.resolveJsxAttributeValue(ctx, attr);
806
+ * const s = v.kind === "spreadProps" ? v.getProperty(name) : v.toStatic();
807
+ * ```
808
+ *
809
+ * Returns `undefined` when the attribute is not present or its value
810
+ * cannot be statically determined.
811
+ * @param node The JSX element to search for the attribute.
812
+ * @param name The name of the attribute to resolve (e.g. `"className"`).
813
+ * @param initialScope An optional scope to use for resolving spread attributes. If not provided, the scope will be determined from the context of the attribute node.
814
+ * @returns The static value of the attribute, or `undefined` if not found or not statically resolvable.
815
+ */
816
+ getAttributeStaticValue(node: TSESTree.JSXElement, name: string, initialScope?: Scope): unknown;
817
+ /**
818
+ * **All-in-one helper** – find an attribute by name on an element *and*
819
+ * resolve its value in a single call.
820
+ *
821
+ * Returns `undefined` when the attribute is not present.
822
+ * @param node The JSX element to search for the attribute.
823
+ * @param name The name of the attribute to find and resolve (e.g. `"className"`).
824
+ * @param initialScope An optional scope to use for resolving spread attributes. If not provided, the scope will be determined from the context of the attribute node.
825
+ * @returns A descriptor of the attribute's value that can be further inspected, or `undefined` if the attribute is not found.
826
+ */
827
+ getAttributeValue(node: TSESTree.JSXElement, name: string, initialScope?: Scope): JsxAttributeValue | undefined;
828
+ /**
829
+ * Get the **self name** (last segment) of a JSX element type.
830
+ *
831
+ * - `<Foo.Bar.Baz>` → `"Baz"`
832
+ * - `<div>` → `"div"`
833
+ * - `<></>` → `""`
834
+ * @param node The JSX element or fragment to extract the self name from.
835
+ */
836
+ getElementSelfName(node: TSESTree.JSXElement | TSESTree.JSXFragment): string;
837
+ /**
838
+ * Get the string representation of a JSX element's type.
839
+ *
840
+ * - `<div>` → `"div"`
841
+ * - `<Foo.Bar>` → `"Foo.Bar"`
842
+ * - `<React.Fragment>` → `"React.Fragment"`
843
+ * - `<></>` (JSXFragment) → `""`
844
+ * @param node The JSX element or fragment to extract the type from.
845
+ */
846
+ getElementType(node: TSESTree.JSXElement | TSESTree.JSXFragment): string;
847
+ /**
848
+ * Shorthand: check whether an attribute exists on the element.
849
+ * @param node The JSX element to check for the attribute.
850
+ * @param name The name of the attribute to check for (e.g. `"className"`).
851
+ * @param initialScope An optional scope to use for resolving spread attributes. If not provided, the scope will be determined from the context of the attribute node.
852
+ * @returns `true` if the attribute exists on the element, `false` otherwise.
853
+ */
854
+ hasAttribute(node: TSESTree.JSXElement, name: string, initialScope?: Scope): boolean;
855
+ /**
856
+ * Whether the node is a React **Fragment** element (either `<Fragment>` /
857
+ * `<React.Fragment>` or the shorthand `<>` syntax).
858
+ *
859
+ * The check honours the configured `jsxFragmentFactory`.
860
+ * @param node The node to check.
861
+ */
862
+ isFragmentElement(node: TSESTree.Node): node is TSESTree.JSXElement | TSESTree.JSXFragment;
863
+ /**
864
+ * Whether the node is a **host** (intrinsic / DOM) element – i.e. its tag
865
+ * name starts with a lowercase letter.
866
+ * @param node The node to check.
867
+ */
868
+ isHostElement(node: TSESTree.Node): node is TSESTree.JSXElement;
869
+ /**
870
+ * Resolve the *value* of a JSX attribute (or spread attribute) into a
871
+ * descriptor that can be inspected further.
872
+ *
873
+ * See {@link JsxAttributeValue} for the full set of `kind` discriminants.
874
+ * @param attribute The attribute node to resolve the value of.
875
+ * @returns A descriptor of the attribute's value that can be further inspected.
876
+ */
877
+ resolveAttributeValue(attribute: ast.TSESTreeJSXAttributeLike): {
878
+ readonly kind: "boolean";
879
+ readonly toStatic: () => true;
880
+ readonly node?: never;
881
+ readonly getChildren?: never;
882
+ } | {
883
+ readonly kind: "literal";
884
+ readonly node: TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral;
885
+ readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
886
+ readonly getChildren?: never;
887
+ } | {
888
+ readonly kind: "missing";
889
+ readonly node: TSESTree.JSXEmptyExpression;
890
+ readonly toStatic: () => "{}";
891
+ readonly getChildren?: never;
892
+ } | {
893
+ readonly kind: "expression";
894
+ readonly node: TSESTree.Expression;
895
+ readonly toStatic: () => unknown;
896
+ readonly getChildren?: never;
897
+ } | {
898
+ readonly kind: "element";
899
+ readonly node: TSESTree.JSXElement;
900
+ readonly toStatic: () => null;
901
+ readonly getChildren?: never;
902
+ } | {
903
+ readonly kind: "spreadChild";
904
+ readonly getChildren: (_at: number) => null;
905
+ readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
906
+ readonly toStatic: () => unknown;
907
+ } | {
908
+ readonly kind: "spreadProps";
909
+ readonly getProperty: (name: string) => unknown;
910
+ readonly node: TSESTree.Expression;
911
+ readonly toStatic: () => unknown;
912
+ };
913
+ }
914
+ //#endregion
915
+ //#region src/ref/ref-id.d.ts
916
+ declare function isRefId(node: TSESTree.Expression | TSESTree.PrivateIdentifier): boolean;
891
917
  //#endregion
892
- //#region src/ref/is-from-ref.d.ts
918
+ //#region src/ref/ref-init.d.ts
893
919
  /**
894
920
  * Check if the variable with the given name is initialized or derived from a ref
895
921
  * @param name The variable name
@@ -901,9 +927,9 @@ declare function isInitializedFromRef(name: string, initialScope: Scope): boolea
901
927
  * Get the init expression of a ref variable
902
928
  * @param name The variable name
903
929
  * @param initialScope The initial scope
904
- * @returns The init expression node if the variable is derived from a ref, or undefined otherwise
930
+ * @returns The init expression node if the variable is derived from a ref, or null otherwise
905
931
  */
906
- declare function getRefInit(name: string, initialScope: Scope): TSESTree$1.Expression | unit;
932
+ declare function getRefInit(name: string, initialScope: Scope): TSESTree$1.Expression | null;
907
933
  //#endregion
908
934
  //#region src/ref/ref-name.d.ts
909
935
  /**
@@ -911,6 +937,6 @@ declare function getRefInit(name: string, initialScope: Scope): TSESTree$1.Expre
911
937
  * @param name The name to check
912
938
  * @returns True if the name is "ref" or ends with "Ref"
913
939
  */
914
- declare function isRefName(name: string): boolean;
940
+ declare function isRefLikeName(name: string): boolean;
915
941
  //#endregion
916
- export { ClassComponentSemanticNode, ClientFunctionSemanticNode, ComponentDetectionHint, ComponentFlag, ComponentKind, ComponentSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FindEnclosingComponentOrHookFilter, FunctionComponentSemanticNode, FunctionSemanticNode, HookSemanticNode, JsxAttributeValue, JsxConfig, JsxDetectionHint, JsxEmit, REACT_BUILTIN_HOOK_NAMES, SemanticFunc, SemanticNode, ServerFunctionSemanticNode, findEnclosingComponentOrHook, findParentJsxAttribute, getComponentFlagFromInitPath, getFunctionComponentId, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, getRefInit, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDefinition, isComponentDidCatch, isComponentDidMount, isComponentDidMountCallback, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUnmountCallback, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isComponentWrapperCallback, isComponentWrapperCallbackLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHook, isHookCall, isHookCallWithName, isHookId, isHookName, isInitializedFromReact, isInitializedFromReactNative, isInitializedFromRef, isInsideComponentOrHook, isJsxFragmentElement, isJsxHostElement, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isRefName, isRender, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStoreCall, isUseTransitionCall, resolveJsxAttributeValue, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
942
+ export { ClassComponentSemanticNode, ClientFunctionSemanticNode, ComponentDetectionHint, ComponentFlag, ComponentSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FunctionComponentSemanticNode, FunctionKind, FunctionSemanticNode, HookSemanticNode, JsxAttributeValue, JsxConfig, JsxDetectionHint, JsxEmit, JsxInspector, REACT_BUILTIN_HOOK_NAMES, SemanticFunc, SemanticNode, ServerFunctionSemanticNode, findImportSource, getComponentFlagFromInitPath, getFunctionComponentId, getJsxConfigFromAnnotation, getJsxConfigFromContext, getRefInit, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDefinition, isComponentDidCatch, isComponentDidMount, isComponentDidMountCallback, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUnmountCallback, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isComponentWrapperCallback, isComponentWrapperCallbackLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isForwardRef, isForwardRefCall, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHook, isHookCall, isHookCallWithName, isHookId, isHookName, isInitializedFromReact, isInitializedFromReactNative, isInitializedFromRef, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isRefId, isRefLikeName, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };