@eslint-react/core 2.0.0-beta.20 → 2.0.0-beta.200

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 +470 -377
  2. package/dist/index.js +1122 -945
  3. package/package.json +12 -12
package/dist/index.d.ts CHANGED
@@ -1,14 +1,13 @@
1
- import { RuleContext } from '@eslint-react/kit';
2
- import { TSESTree } from '@typescript-eslint/types';
3
- import { ESLintUtils, TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
4
- import * as AST from '@eslint-react/ast';
5
- import { unit } from '@eslint-react/eff';
6
- import * as birecord from 'birecord';
7
- import { Scope } from '@typescript-eslint/scope-manager';
8
- import * as VAR from '@eslint-react/var';
9
- import ts from 'typescript';
10
- export { isFalseLiteralType, isTrueLiteralType } from 'ts-api-utils';
11
-
1
+ import { TSESTree } from "@typescript-eslint/types";
2
+ import * as AST from "@eslint-react/ast";
3
+ import { unit } from "@eslint-react/eff";
4
+ import { RuleContext } from "@eslint-react/kit";
5
+ import * as birecord0 from "birecord";
6
+ import { ESLintUtils, TSESTree as TSESTree$1 } from "@typescript-eslint/utils";
7
+ import { Scope } from "@typescript-eslint/scope-manager";
8
+ import * as typescript0 from "typescript";
9
+
10
+ //#region src/component/component-children.d.ts
12
11
  /**
13
12
  * Determines whether inside `createElement`'s children.
14
13
  * @param context The rule context
@@ -16,132 +15,135 @@ export { isFalseLiteralType, isTrueLiteralType } from 'ts-api-utils';
16
15
  * @returns `true` if the node is inside createElement's children
17
16
  */
18
17
  declare function isChildrenOfCreateElement(context: RuleContext, node: TSESTree.Node): boolean;
19
-
18
+ //#endregion
19
+ //#region src/component/component-detection-hint.d.ts
20
20
  type ComponentDetectionHint = bigint;
21
21
  /**
22
22
  * Hints for component collector
23
23
  */
24
24
  declare const ComponentDetectionHint: {
25
- /**
26
- * Skip function component created by React.memo
27
- */
28
- readonly SkipMemo: bigint;
29
- /**
30
- * Skip function component created by React.forwardRef
31
- */
32
- readonly SkipForwardRef: bigint;
33
- /**
34
- * Skip function component defined as array map argument
35
- */
36
- readonly SkipArrayMapArgument: bigint;
37
- /**
38
- * Skip function component defined on object method
39
- */
40
- readonly SkipObjectMethod: bigint;
41
- /**
42
- * Skip function component defined on class method
43
- */
44
- readonly SkipClassMethod: bigint;
45
- /**
46
- * Skip function component defined on class property
47
- */
48
- readonly SkipClassProperty: bigint;
49
- readonly None: 0n;
50
- readonly SkipUndefined: bigint;
51
- readonly SkipNullLiteral: bigint;
52
- readonly SkipBooleanLiteral: bigint;
53
- readonly SkipStringLiteral: bigint;
54
- readonly SkipNumberLiteral: bigint;
55
- readonly SkipBigIntLiteral: bigint;
56
- readonly SkipEmptyArray: bigint;
57
- readonly SkipCreateElement: bigint;
58
- readonly StrictArray: bigint;
59
- readonly StrictLogical: bigint;
60
- readonly StrictConditional: bigint;
25
+ /**
26
+ * Skip function component created by React.memo
27
+ */
28
+ readonly SkipMemo: bigint;
29
+ /**
30
+ * Skip function component created by React.forwardRef
31
+ */
32
+ readonly SkipForwardRef: bigint;
33
+ /**
34
+ * Skip function component defined as array map argument
35
+ */
36
+ readonly SkipArrayMapArgument: bigint;
37
+ /**
38
+ * Skip function component defined on object method
39
+ */
40
+ readonly SkipObjectMethod: bigint;
41
+ /**
42
+ * Skip function component defined on class method
43
+ */
44
+ readonly SkipClassMethod: bigint;
45
+ /**
46
+ * Skip function component defined on class property
47
+ */
48
+ readonly SkipClassProperty: bigint;
49
+ readonly None: 0n;
50
+ readonly SkipUndefined: bigint;
51
+ readonly SkipNullLiteral: bigint;
52
+ readonly SkipBooleanLiteral: bigint;
53
+ readonly SkipStringLiteral: bigint;
54
+ readonly SkipNumberLiteral: bigint;
55
+ readonly SkipBigIntLiteral: bigint;
56
+ readonly SkipEmptyArray: bigint;
57
+ readonly SkipCreateElement: bigint;
58
+ readonly StrictArray: bigint;
59
+ readonly StrictLogical: bigint;
60
+ readonly StrictConditional: bigint;
61
61
  };
62
62
  /**
63
63
  * Default component detection hint
64
64
  */
65
65
  declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
66
-
66
+ //#endregion
67
+ //#region src/component/component-phase.d.ts
67
68
  type ComponentEffectPhaseKind = "cleanup" | "setup";
68
69
  type ComponentLifecyclePhaseKind = "mount" | "unmount";
69
70
  type ComponentPhaseKind = ComponentEffectPhaseKind | ComponentLifecyclePhaseKind;
70
- declare const ComponentPhaseRelevance: birecord.BiRecord<{
71
- readonly mount: "unmount";
72
- readonly setup: "cleanup";
71
+ declare const ComponentPhaseRelevance: birecord0.BiRecord<{
72
+ readonly mount: "unmount";
73
+ readonly setup: "cleanup";
73
74
  }>;
74
- declare const isInversePhase: {
75
- (a: ComponentPhaseKind): (b: ComponentPhaseKind) => boolean;
76
- (a: ComponentPhaseKind, b: ComponentPhaseKind): boolean;
77
- };
78
-
75
+ //#endregion
76
+ //#region src/semantic/semantic-entry.d.ts
79
77
  interface SemanticEntry {
80
- node: TSESTree.Node;
81
- phase: ComponentPhaseKind;
78
+ node: TSESTree.Node;
79
+ phase: ComponentPhaseKind;
82
80
  }
83
-
81
+ //#endregion
82
+ //#region src/semantic/semantic-node.d.ts
84
83
  interface SemanticNode {
85
- id: unit | TSESTree.Identifier | TSESTree.Identifier[];
86
- key: string;
87
- kind: string;
88
- name: unit | string;
89
- node: TSESTree.Node;
90
- flag: bigint;
91
- hint: bigint;
84
+ id: unit | TSESTree.Identifier | TSESTree.Identifier[];
85
+ key: string;
86
+ kind: string;
87
+ name: unit | string;
88
+ node: TSESTree.Node;
89
+ flag: bigint;
90
+ hint: bigint;
92
91
  }
93
-
92
+ //#endregion
93
+ //#region src/component/component-flag.d.ts
94
94
  type ComponentFlag = bigint;
95
95
  declare const ComponentFlag: {
96
- None: bigint;
97
- PureComponent: bigint;
98
- CreateElement: bigint;
99
- Memo: bigint;
100
- ForwardRef: bigint;
101
- Async: bigint;
96
+ None: bigint;
97
+ PureComponent: bigint;
98
+ CreateElement: bigint;
99
+ Memo: bigint;
100
+ ForwardRef: bigint;
101
+ Async: bigint;
102
102
  };
103
-
103
+ //#endregion
104
+ //#region src/component/component-semantic-node.d.ts
104
105
  interface FunctionComponent extends SemanticNode {
105
- id: unit | TSESTree.Identifier | TSESTree.Identifier[];
106
- kind: "function";
107
- node: AST.TSESTreeFunction;
108
- flag: ComponentFlag;
109
- hint: ComponentDetectionHint;
110
- initPath: unit | AST.FunctionInitPath;
111
- hookCalls: TSESTree.CallExpression[];
112
- displayName: unit | TSESTree.Expression;
106
+ id: unit | TSESTree.Identifier | TSESTree.Identifier[];
107
+ kind: "function";
108
+ node: AST.TSESTreeFunction;
109
+ flag: ComponentFlag;
110
+ hint: ComponentDetectionHint;
111
+ initPath: unit | AST.FunctionInitPath;
112
+ hookCalls: TSESTree.CallExpression[];
113
+ displayName: unit | TSESTree.Expression;
113
114
  }
114
115
  interface ClassComponent extends SemanticNode {
115
- id: unit | TSESTree.Identifier;
116
- kind: "class";
117
- node: AST.TSESTreeClass;
118
- flag: ComponentFlag;
119
- hint: ComponentDetectionHint;
120
- methods: AST.TSESTreeMethodOrProperty[];
121
- displayName: unit | TSESTree.Expression;
116
+ id: unit | TSESTree.Identifier;
117
+ kind: "class";
118
+ node: AST.TSESTreeClass;
119
+ flag: ComponentFlag;
120
+ hint: ComponentDetectionHint;
121
+ methods: AST.TSESTreeMethodOrProperty[];
122
+ displayName: unit | TSESTree.Expression;
122
123
  }
123
124
  type Component = ClassComponent | FunctionComponent;
124
-
125
+ //#endregion
126
+ //#region src/component/component-collector.d.ts
125
127
  type FunctionEntry = {
126
- key: string;
127
- node: AST.TSESTreeFunction;
128
- hookCalls: TSESTree.CallExpression[];
129
- isComponent: boolean;
128
+ key: string;
129
+ node: AST.TSESTreeFunction;
130
+ hookCalls: TSESTree.CallExpression[];
131
+ isComponent: boolean;
130
132
  };
131
133
  declare namespace useComponentCollector {
132
- type Options = {
133
- collectDisplayName?: boolean;
134
- collectHookCalls?: boolean;
135
- hint?: ComponentDetectionHint;
136
- };
137
- type ReturnType = {
138
- ctx: {
139
- getAllComponents: (node: TSESTree.Program) => Map<string, FunctionComponent>;
140
- getCurrentEntries: () => FunctionEntry[];
141
- getCurrentEntry: () => FunctionEntry | unit;
142
- };
143
- listeners: ESLintUtils.RuleListener;
134
+ type Options = {
135
+ collectDisplayName?: boolean;
136
+ collectHookCalls?: boolean;
137
+ hint?: ComponentDetectionHint;
138
+ };
139
+ type ReturnType = {
140
+ ctx: {
141
+ getAllComponents: (node: TSESTree.Program) => Map<string, FunctionComponent>;
142
+ getCurrentEntries: () => FunctionEntry[];
143
+ getCurrentEntry: () => FunctionEntry | unit;
144
144
  };
145
+ listeners: ESLintUtils.RuleListener;
146
+ };
145
147
  }
146
148
  /**
147
149
  * Get a ctx and listeners for the rule to collect function components
@@ -150,21 +152,23 @@ declare namespace useComponentCollector {
150
152
  * @returns The component collector
151
153
  */
152
154
  declare function useComponentCollector(context: RuleContext, options?: useComponentCollector.Options): useComponentCollector.ReturnType;
153
-
155
+ //#endregion
156
+ //#region src/component/component-collector-legacy.d.ts
154
157
  declare namespace useComponentCollectorLegacy {
155
- type ReturnType = {
156
- ctx: {
157
- getAllComponents: (node: TSESTree$1.Program) => Map<string, ClassComponent>;
158
- };
159
- listeners: ESLintUtils.RuleListener;
158
+ type ReturnType = {
159
+ ctx: {
160
+ getAllComponents: (node: TSESTree$1.Program) => Map<string, ClassComponent>;
160
161
  };
162
+ listeners: ESLintUtils.RuleListener;
163
+ };
161
164
  }
162
165
  /**
163
166
  * Get a ctx and listeners object for the rule to collect class components
164
167
  * @returns The context and listeners for the rule
165
168
  */
166
169
  declare function useComponentCollectorLegacy(): useComponentCollectorLegacy.ReturnType;
167
-
170
+ //#endregion
171
+ //#region src/component/component-definition.d.ts
168
172
  /**
169
173
  * Check whether given node is a function of a render method of a class component
170
174
  * @example
@@ -178,12 +182,22 @@ declare function useComponentCollectorLegacy(): useComponentCollectorLegacy.Retu
178
182
  * @returns `true` if node is a render function, `false` if not
179
183
  */
180
184
  declare function isFunctionOfRenderMethod(node: AST.TSESTreeFunction): boolean;
181
- declare function isValidComponentDefinition(context: RuleContext, node: AST.TSESTreeFunction, hint: bigint): boolean;
182
-
185
+ /**
186
+ * Determines if a function node represents a valid React component definition
187
+ * @param context The rule context
188
+ * @param node The function node to check
189
+ * @param hint Component detection hints as bit flags
190
+ * @returns `true` if the node is a valid component definition, `false` otherwise
191
+ */
192
+ declare function isComponentDefinition(context: RuleContext, node: AST.TSESTreeFunction, hint: bigint): boolean;
193
+ //#endregion
194
+ //#region src/component/component-id.d.ts
183
195
  declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | unit;
184
-
196
+ //#endregion
197
+ //#region src/component/component-init-path.d.ts
185
198
  declare function getComponentFlagFromInitPath(initPath: FunctionComponent["initPath"]): bigint;
186
-
199
+ //#endregion
200
+ //#region src/component/component-is.d.ts
187
201
  /**
188
202
  * Check if a node is a React class component
189
203
  * @param node The AST node to check
@@ -196,58 +210,48 @@ declare function isClassComponent(node: TSESTree.Node): node is AST.TSESTreeClas
196
210
  * @returns `true` if the node is a pure component, `false` otherwise
197
211
  */
198
212
  declare function isPureComponent(node: TSESTree.Node): boolean;
199
-
213
+ //#endregion
214
+ //#region src/component/component-kind.d.ts
200
215
  type ComponentKind = "classComponent" | "functionComponent";
201
-
202
- declare function isComponentDidCatch(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
203
- declare function isComponentDidMount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
204
- declare function isComponentDidUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
205
- declare function isComponentWillMount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
206
- declare function isComponentWillReceiveProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
207
- declare function isComponentWillUnmount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
208
- declare function isComponentWillUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
209
- declare function isGetChildContext(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
210
- declare function isGetDefaultProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
211
- declare function isGetInitialState(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
212
- declare function isGetSnapshotBeforeUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
213
- declare function isShouldComponentUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
214
- declare function isUnsafeComponentWillMount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
215
- declare function isUnsafeComponentWillReceiveProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
216
- declare function isUnsafeComponentWillUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
217
- declare function isGetDerivedStateFromProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
218
- declare function isGetDerivedStateFromError(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
219
-
216
+ //#endregion
217
+ //#region src/component/component-method.d.ts
218
+ declare const isRender: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
219
+ declare const isComponentDidCatch: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
220
+ declare const isComponentDidMount: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
221
+ declare const isComponentDidUpdate: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
222
+ declare const isComponentWillMount: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
223
+ declare const isComponentWillReceiveProps: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
224
+ declare const isComponentWillUnmount: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
225
+ declare const isComponentWillUpdate: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
226
+ declare const isGetChildContext: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
227
+ declare const isGetInitialState: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
228
+ declare const isGetSnapshotBeforeUpdate: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
229
+ declare const isShouldComponentUpdate: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
230
+ declare const isUnsafeComponentWillMount: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
231
+ declare const isUnsafeComponentWillReceiveProps: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
232
+ declare const isUnsafeComponentWillUpdate: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
233
+ declare const isGetDefaultProps: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
234
+ declare const isGetDerivedStateFromProps: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
235
+ declare const isGetDerivedStateFromError: (node: TSESTree.Node) => node is AST.TSESTreeMethodOrProperty;
236
+ //#endregion
237
+ //#region src/component/component-method-parts.d.ts
238
+ declare function isFunctionOfComponentDidMount(node: TSESTree.Node): boolean;
239
+ declare function isFunctionOfComponentWillUnmount(node: TSESTree.Node): boolean;
240
+ //#endregion
241
+ //#region src/component/component-name.d.ts
220
242
  declare function isComponentName(name: string): boolean;
221
243
  declare function isComponentNameLoose(name: string): boolean;
222
244
  declare function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | unit): string | undefined;
223
245
  declare function hasNoneOrLooseComponentName(context: RuleContext, fn: AST.TSESTreeFunction): boolean;
224
-
225
- /**
226
- * Check whether given node is a render function of a class component
227
- * @example
228
- * ```tsx
229
- * class Component extends React.Component {
230
- * render() {
231
- * return <div />;
232
- * }
233
- * }
234
- * ```
235
- * @param node The AST node to check
236
- * @returns `true` if node is a render function, `false` if not
237
- */
238
- declare function isRenderLike(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
239
- /**
240
- * Check whether given node is a function of a render function of a class component
241
- * @example
242
- * ```tsx
243
- * class Component extends React.Component {
244
- * render = () => <div />;
245
- * ```
246
- * @param node The AST node to check
247
- * @returns `true` if node is a render function, `false` if not
248
- */
249
- declare function isFunctionOfRender(node: AST.TSESTreeFunction): boolean;
250
-
246
+ //#endregion
247
+ //#region src/component/component-phase-helpers.d.ts
248
+ declare const isInversePhase: {
249
+ (a: ComponentPhaseKind): (b: ComponentPhaseKind) => boolean;
250
+ (a: ComponentPhaseKind, b: ComponentPhaseKind): boolean;
251
+ };
252
+ declare function getPhaseKindOfFunction(node: AST.TSESTreeFunction): ComponentPhaseKind | null;
253
+ //#endregion
254
+ //#region src/component/component-render-method.d.ts
251
255
  /**
252
256
  * Check whether given node is a render method of a class component
253
257
  * @example
@@ -261,7 +265,8 @@ declare function isFunctionOfRender(node: AST.TSESTreeFunction): boolean;
261
265
  * @returns `true` if node is a render function, `false` if not
262
266
  */
263
267
  declare function isRenderMethodLike(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
264
-
268
+ //#endregion
269
+ //#region src/component/component-render-prop.d.ts
265
270
  /**
266
271
  * Unsafe check whether given node is a render function
267
272
  * ```tsx
@@ -311,11 +316,13 @@ declare function isDirectValueOfRenderPropertyLoose(node: TSESTree.Node): boolea
311
316
  * @returns `true` if component is declared inside a render prop, `false` if not
312
317
  */
313
318
  declare function isDeclaredInRenderPropLoose(node: TSESTree.Node): boolean;
314
-
319
+ //#endregion
320
+ //#region src/component/component-state.d.ts
315
321
  type ComponentStateKind = "actionState" | "state";
316
322
  declare function isThisSetState(node: TSESTree.CallExpression): boolean;
317
323
  declare function isAssignmentToThisState(node: TSESTree.AssignmentExpression): boolean;
318
-
324
+ //#endregion
325
+ //#region src/component/component-wrapper.d.ts
319
326
  /**
320
327
  * Check if the node is a call expression for a component wrapper
321
328
  * @param context The ESLint rule context
@@ -330,59 +337,86 @@ declare function isComponentWrapperCall(context: RuleContext, node: TSESTree.Nod
330
337
  * @returns `true` if the node is a call expression for a component wrapper loosely
331
338
  */
332
339
  declare function isComponentWrapperCallLoose(context: RuleContext, node: TSESTree.Node): boolean;
333
-
340
+ //#endregion
341
+ //#region src/effect/effect-kind.d.ts
334
342
  type EffectKind = "useEffect" | "useLayoutEffect" | "useInsertionEffect";
335
-
343
+ //#endregion
344
+ //#region src/hook/hook-semantic-node.d.ts
336
345
  interface Hook extends SemanticNode {
337
- id: TSESTree.Identifier | unit;
338
- node: AST.TSESTreeFunction;
339
- name: string;
340
- hookCalls: TSESTree.CallExpression[];
346
+ id: TSESTree.Identifier | unit;
347
+ node: AST.TSESTreeFunction;
348
+ name: string;
349
+ hookCalls: TSESTree.CallExpression[];
341
350
  }
342
-
351
+ //#endregion
352
+ //#region src/hook/hook-collector.d.ts
343
353
  declare namespace useHookCollector {
344
- type ReturnType = {
345
- ctx: {
346
- getAllHooks(node: TSESTree$1.Program): Map<string, Hook>;
347
- };
348
- listeners: ESLintUtils.RuleListener;
354
+ type ReturnType = {
355
+ ctx: {
356
+ getAllHooks(node: TSESTree$1.Program): Map<string, Hook>;
349
357
  };
358
+ listeners: ESLintUtils.RuleListener;
359
+ };
350
360
  }
351
361
  declare function useHookCollector(): useHookCollector.ReturnType;
352
-
362
+ //#endregion
363
+ //#region src/hook/hook-id.d.ts
353
364
  declare function isReactHookId(id: TSESTree.Identifier | TSESTree.MemberExpression): boolean;
354
-
365
+ //#endregion
366
+ //#region src/hook/hook-is.d.ts
367
+ /**
368
+ * Determines if a function node is a React Hook based on its name.
369
+ * @param node The function node to check
370
+ * @returns True if the function is a React Hook, false otherwise
371
+ */
355
372
  declare function isReactHook(node: AST.TSESTreeFunction | unit): boolean;
356
373
  /**
357
374
  * Check if the given node is a React Hook call by its name.
358
375
  * @param node The node to check.
359
376
  * @returns `true` if the node is a React Hook call, `false` otherwise.
360
377
  */
361
- declare function isReactHookCall(node: TSESTree.Node | unit): boolean;
362
- declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | unit): (name: string) => boolean;
363
- declare function isReactHookCallWithNameLoose(node: TSESTree.Node | unit): (name: string) => boolean;
364
- declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: unit | string[]): (node: TSESTree.CallExpression) => boolean;
365
- declare function isUseEffectCallLoose(node: TSESTree.Node | unit): boolean;
366
- declare const isUseCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
367
- declare const isUseActionStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
368
- declare const isUseCallbackCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
369
- declare const isUseContextCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
370
- declare const isUseDebugValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
371
- declare const isUseDeferredValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
372
- declare const isUseEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
373
- declare const isUseFormStatusCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
374
- declare const isUseIdCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
375
- declare const isUseImperativeHandleCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
376
- declare const isUseInsertionEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
377
- declare const isUseLayoutEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
378
- declare const isUseMemoCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
379
- declare const isUseOptimisticCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
380
- declare const isUseReducerCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
381
- declare const isUseRefCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
382
- declare const isUseStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
383
- declare const isUseSyncExternalStoreCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
384
- declare const isUseTransitionCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
385
-
378
+ declare function isReactHookCall(node: TSESTree.Node | unit): node is TSESTree.CallExpression;
379
+ /**
380
+ * Checks if a node is a call to a specific React hook.
381
+ * Returns a function that accepts a hook name to check against.
382
+ * @param node The AST node to check
383
+ * @returns A function that takes a hook name and returns boolean
384
+ */
385
+ declare function isReactHookCallWithName(node: TSESTree.Node | unit): (name: string) => boolean;
386
+ /**
387
+ * Checks if a node is a call to a specific React hook or one of its aliases.
388
+ * @param name The primary hook name to check
389
+ * @param alias Optional array of alias names to also accept
390
+ * @returns Function that checks if a node matches the hook name or aliases
391
+ */
392
+ declare function isReactHookCallWithNameAlias(name: string, alias?: unit | string[]): (node: TSESTree.CallExpression) => boolean;
393
+ /**
394
+ * Detects useEffect calls and variations (useLayoutEffect, etc.) using regex pattern.
395
+ * @param node The AST node to check
396
+ * @returns True if the node is a useEffect-like call
397
+ */
398
+ declare function isUseEffectLikeCall(node: TSESTree.Node | unit): boolean;
399
+ declare const isUseCall: (node: TSESTree.Node | undefined) => boolean;
400
+ declare const isUseActionStateCall: (node: TSESTree.Node | undefined) => boolean;
401
+ declare const isUseCallbackCall: (node: TSESTree.Node | undefined) => boolean;
402
+ declare const isUseContextCall: (node: TSESTree.Node | undefined) => boolean;
403
+ declare const isUseDebugValueCall: (node: TSESTree.Node | undefined) => boolean;
404
+ declare const isUseDeferredValueCall: (node: TSESTree.Node | undefined) => boolean;
405
+ declare const isUseEffectCall: (node: TSESTree.Node | undefined) => boolean;
406
+ declare const isUseFormStatusCall: (node: TSESTree.Node | undefined) => boolean;
407
+ declare const isUseIdCall: (node: TSESTree.Node | undefined) => boolean;
408
+ declare const isUseImperativeHandleCall: (node: TSESTree.Node | undefined) => boolean;
409
+ declare const isUseInsertionEffectCall: (node: TSESTree.Node | undefined) => boolean;
410
+ declare const isUseLayoutEffectCall: (node: TSESTree.Node | undefined) => boolean;
411
+ declare const isUseMemoCall: (node: TSESTree.Node | undefined) => boolean;
412
+ declare const isUseOptimisticCall: (node: TSESTree.Node | undefined) => boolean;
413
+ declare const isUseReducerCall: (node: TSESTree.Node | undefined) => boolean;
414
+ declare const isUseRefCall: (node: TSESTree.Node | undefined) => boolean;
415
+ declare const isUseStateCall: (node: TSESTree.Node | undefined) => boolean;
416
+ declare const isUseSyncExternalStoreCall: (node: TSESTree.Node | undefined) => boolean;
417
+ declare const isUseTransitionCall: (node: TSESTree.Node | undefined) => boolean;
418
+ //#endregion
419
+ //#region src/hook/hook-name.d.ts
386
420
  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"];
387
421
  /**
388
422
  * Catch all identifiers that begin with "use" followed by an uppercase Latin
@@ -391,17 +425,15 @@ declare const REACT_BUILTIN_HOOK_NAMES: readonly ["use", "useActionState", "useC
391
425
  * @see https://github.com/facebook/react/blob/1d6c8168db1d82713202e842df3167787ffa00ed/packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts#L16
392
426
  */
393
427
  declare function isReactHookName(name: string): boolean;
394
-
395
- /**
396
- * Get the JSX attribute node with the given name
397
- * @param context The ESLint rule context
398
- * @param name The name of the attribute
399
- * @param attributes The attributes to search
400
- * @param initialScope The initial scope to use for variable resolution
401
- * @returns The JSX attribute node or undefined
402
- */
403
- declare function getAttribute(context: RuleContext, name: string, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], initialScope?: Scope): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | unit;
404
-
428
+ //#endregion
429
+ //#region src/hook/hook-parts.d.ts
430
+ declare function isFunctionOfUseEffectSetup(node: TSESTree.Node | unit): boolean;
431
+ declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | unit): boolean;
432
+ //#endregion
433
+ //#region src/jsx/jsx-attribute.d.ts
434
+ declare function getAttribute(context: RuleContext, attributes: AST.TSESTreeJSXAttributeLike[], initialScope?: Scope): (name: string) => AST.TSESTreeJSXAttributeLike | undefined;
435
+ //#endregion
436
+ //#region src/jsx/jsx-attribute-name.d.ts
405
437
  /**
406
438
  * Get the stringified name of a JSX attribute
407
439
  * @param context The ESLint rule context
@@ -409,205 +441,266 @@ declare function getAttribute(context: RuleContext, name: string, attributes: (T
409
441
  * @returns The name of the attribute
410
442
  */
411
443
  declare function getAttributeName(context: RuleContext, node: TSESTree$1.JSXAttribute): string;
412
-
444
+ //#endregion
445
+ //#region src/jsx/jsx-attribute-value.d.ts
413
446
  /**
414
- * Get a StaticValue of the attribute value
415
- * @param context The rule context
416
- * @param node The JSX attribute node
417
- * @param name The name of the attribute
418
- * @returns The StaticValue of the attribute value
447
+ * Represents possible JSX attribute value types that can be resolved
448
+ */
449
+ type AttributeValue = {
450
+ kind: "boolean";
451
+ toStatic(): true;
452
+ } | {
453
+ kind: "element";
454
+ node: TSESTree.JSXElement;
455
+ toStatic(): unknown;
456
+ } | {
457
+ kind: "literal";
458
+ node: TSESTree.Literal;
459
+ toStatic(): TSESTree.Literal["value"];
460
+ } | {
461
+ kind: "expression";
462
+ node: TSESTree.JSXExpressionContainer["expression"];
463
+ toStatic(): unknown;
464
+ } | {
465
+ kind: "spreadProps";
466
+ node: TSESTree.JSXSpreadAttribute["argument"];
467
+ toStatic(name?: string): unknown;
468
+ } | {
469
+ kind: "spreadChild";
470
+ node: TSESTree.JSXSpreadChild["expression"];
471
+ toStatic(): unknown;
472
+ };
473
+ declare function resolveAttributeValue(context: RuleContext, attribute: AST.TSESTreeJSXAttributeLike): {
474
+ readonly kind: "boolean";
475
+ readonly toStatic: () => true;
476
+ readonly node?: never;
477
+ } | {
478
+ readonly kind: "literal";
479
+ readonly node: TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral;
480
+ readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
481
+ } | {
482
+ readonly kind: "expression";
483
+ readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
484
+ readonly toStatic: () => unknown;
485
+ } | {
486
+ readonly kind: "element";
487
+ readonly node: TSESTree.JSXElement;
488
+ readonly toStatic: () => undefined;
489
+ } | {
490
+ readonly kind: "spreadChild";
491
+ readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
492
+ readonly toStatic: () => undefined;
493
+ } | {
494
+ readonly kind: "spreadProps";
495
+ readonly node: TSESTree.Expression;
496
+ readonly toStatic: (name?: string) => unknown;
497
+ };
498
+ //#endregion
499
+ //#region src/jsx/jsx-config.d.ts
500
+ declare const JsxEmit: {
501
+ readonly None: 0;
502
+ readonly Preserve: 1;
503
+ readonly React: 2;
504
+ readonly ReactNative: 3;
505
+ readonly ReactJSX: 4;
506
+ readonly ReactJSXDev: 5;
507
+ };
508
+ interface JsxConfig {
509
+ jsx?: number;
510
+ jsxFactory?: string;
511
+ jsxFragmentFactory?: string;
512
+ jsxImportSource?: string;
513
+ }
514
+ /**
515
+ * Get JsxConfig from the rule context by reading compiler options.
516
+ * @param context The RuleContext.
517
+ * @returns JsxConfig derived from compiler options.
518
+ */
519
+ declare function getJsxConfigFromContext(context: RuleContext): {
520
+ jsx: 4 | typescript0.JsxEmit;
521
+ jsxFactory: string;
522
+ jsxFragmentFactory: string;
523
+ jsxImportSource: string;
524
+ };
525
+ /**
526
+ * Get JsxConfig from pragma comments (annotations) in the source code.
527
+ * @param context The RuleContext.
528
+ * @returns JsxConfig derived from pragma comments.
529
+ */
530
+ declare function getJsxConfigFromAnnotation(context: RuleContext): JsxConfig;
531
+ //#endregion
532
+ //#region src/jsx/jsx-detection.d.ts
533
+ /**
534
+ * BitFlags for configuring JSX detection behavior
535
+ * Uses BigInt for bit operations to support many flags
419
536
  */
420
- declare function getAttributeValue(context: RuleContext, node: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, name: string): Exclude<VAR.LazyValue, {
421
- kind: "lazy";
422
- }>;
423
-
424
537
  type JSXDetectionHint = bigint;
538
+ /**
539
+ * Flags to control JSX detection behavior:
540
+ * - Skip* flags: Ignore specific node types when detecting JSX
541
+ * - Strict* flags: Enforce stricter rules for container types
542
+ */
425
543
  declare const JSXDetectionHint: {
426
- readonly None: 0n;
427
- readonly SkipUndefined: bigint;
428
- readonly SkipNullLiteral: bigint;
429
- readonly SkipBooleanLiteral: bigint;
430
- readonly SkipStringLiteral: bigint;
431
- readonly SkipNumberLiteral: bigint;
432
- readonly SkipBigIntLiteral: bigint;
433
- readonly SkipEmptyArray: bigint;
434
- readonly SkipCreateElement: bigint;
435
- readonly StrictArray: bigint;
436
- readonly StrictLogical: bigint;
437
- readonly StrictConditional: bigint;
544
+ readonly None: 0n;
545
+ readonly SkipUndefined: bigint;
546
+ readonly SkipNullLiteral: bigint;
547
+ readonly SkipBooleanLiteral: bigint;
548
+ readonly SkipStringLiteral: bigint;
549
+ readonly SkipNumberLiteral: bigint;
550
+ readonly SkipBigIntLiteral: bigint;
551
+ readonly SkipEmptyArray: bigint;
552
+ readonly SkipCreateElement: bigint;
553
+ readonly StrictArray: bigint;
554
+ readonly StrictLogical: bigint;
555
+ readonly StrictConditional: bigint;
438
556
  };
557
+ /**
558
+ * Default JSX detection configuration
559
+ * Skips undefined and boolean literals (common in React)
560
+ */
439
561
  declare const DEFAULT_JSX_DETECTION_HINT: bigint;
440
-
441
562
  /**
442
- * Check if a node is a `JSXText` or a `Literal` node
563
+ * Checks if a node is a `JSXText` or a `Literal` node
443
564
  * @param node The AST node to check
444
565
  * @returns `true` if the node is a `JSXText` or a `Literal` node
445
566
  */
446
567
  declare function isJsxText(node: TSESTree$1.Node | null | unit): node is TSESTree$1.JSXText | TSESTree$1.Literal;
447
568
  /**
448
- * Heuristic decision to determine if a node is a JSX-like node.
449
- * @param code The sourceCode object
569
+ * Determines if a node represents JSX-like content based on heuristics
570
+ * Supports configuration through hint flags to customize detection behavior
571
+ *
572
+ * @param code The source code with scope lookup capability
450
573
  * @param code.getScope The function to get the scope of a node
451
- * @param node The AST node to check
452
- * @param hint The `JSXDetectionHint` to use
453
- * @returns boolean
574
+ * @param node The AST node to analyze
575
+ * @param hint The configuration flags to adjust detection behavior
576
+ * @returns boolean Whether the node is considered JSX-like
454
577
  */
455
578
  declare function isJsxLike(code: {
456
- getScope: (node: TSESTree$1.Node) => Scope;
579
+ getScope: (node: TSESTree$1.Node) => Scope;
457
580
  }, node: TSESTree$1.Node | unit | null, hint?: JSXDetectionHint): boolean;
458
-
581
+ //#endregion
582
+ //#region src/jsx/jsx-element-is.d.ts
459
583
  /**
460
- * Get the stringified type of a JSX element
461
- * @param context The ESLint rule context
462
- * @param node The JSX element node
463
- * @returns The type of the element
584
+ * Determines if a JSX element is a host element
585
+ * Host elements in React start with lowercase letters (e.g., div, span)
586
+ *
587
+ * @param context - ESLint rule context
588
+ * @param node - AST node to check
589
+ * @returns boolean indicating if the element is a host element
590
+ */
591
+ declare function isHostElement(context: RuleContext, node: TSESTree.Node): boolean;
592
+ /**
593
+ * Determines if a JSX element is a React Fragment
594
+ * Fragments can be imported from React and used like <Fragment> or <React.Fragment>
595
+ *
596
+ * @param context - ESLint rule context
597
+ * @param node - AST node to check
598
+ * @returns boolean indicating if the element is a Fragment with type narrowing
599
+ */
600
+ declare function isFragmentElement(context: RuleContext, node: TSESTree.Node): node is TSESTree.JSXElement;
601
+ //#endregion
602
+ //#region src/jsx/jsx-element-type.d.ts
603
+ /**
604
+ * Extracts the element type name from a JSX element or fragment
605
+ * For JSX elements, returns the stringified name (e.g., "div", "Button", "React.Fragment")
606
+ * For JSX fragments, returns an empty string
607
+ *
608
+ * @param context - ESLint rule context
609
+ * @param node - JSX element or fragment node
610
+ * @returns String representation of the element type
464
611
  */
465
612
  declare function getElementType(context: RuleContext, node: TSESTree.JSXElement | TSESTree.JSXFragment): string;
466
-
613
+ //#endregion
614
+ //#region src/jsx/jsx-has.d.ts
615
+ /**
616
+ * Checks if a JSX element has a specific attribute
617
+ *
618
+ * @param context - ESLint rule context
619
+ * @param name - Name of the attribute to check for
620
+ * @param attributes - List of JSX attributes from opening element
621
+ * @param initialScope - Optional scope for resolving variables in spread attributes
622
+ * @returns boolean indicating whether the attribute exists
623
+ */
467
624
  declare function hasAttribute(context: RuleContext, name: string, attributes: TSESTree.JSXOpeningElement["attributes"], initialScope?: Scope): boolean;
625
+ /**
626
+ * Checks if a JSX element has at least one of the specified attributes
627
+ *
628
+ * @param context - ESLint rule context
629
+ * @param names - Array of attribute names to check for
630
+ * @param attributes - List of JSX attributes from opening element
631
+ * @param initialScope - Optional scope for resolving variables in spread attributes
632
+ * @returns boolean indicating whether any of the attributes exist
633
+ */
468
634
  declare function hasAnyAttribute(context: RuleContext, names: string[], attributes: TSESTree.JSXOpeningElement["attributes"], initialScope?: Scope): boolean;
635
+ /**
636
+ * Checks if a JSX element has all of the specified attributes
637
+ *
638
+ * @param context - ESLint rule context
639
+ * @param names - Array of attribute names to check for
640
+ * @param attributes - List of JSX attributes from opening element
641
+ * @param initialScope - Optional scope for resolving variables in spread attributes
642
+ * @returns boolean indicating whether all of the attributes exist
643
+ */
469
644
  declare function hasEveryAttribute(context: RuleContext, names: string[], attributes: TSESTree.JSXOpeningElement["attributes"], initialScope?: Scope): boolean;
470
-
645
+ //#endregion
646
+ //#region src/jsx/jsx-hierarchy.d.ts
471
647
  /**
472
- * Find the parent JSX attribute node of a node
473
- * @param node The node to find the parent attribute of
474
- * @param test The test to apply to the parent attribute
475
- * @returns The parent attribute node or undefined
648
+ * Traverses up the AST to find a parent JSX attribute node that matches a given test
649
+ *
650
+ * @param node - The starting AST node
651
+ * @param test - Optional predicate function to test if the attribute meets criteria
652
+ * Defaults to always returning true (matches any attribute)
653
+ * @returns The first matching JSX attribute node found when traversing upwards, or undefined
476
654
  */
477
655
  declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | unit;
478
-
479
- declare function isHostElement(context: RuleContext, node: TSESTree.Node): boolean;
480
- declare function isKeyedElement(context: RuleContext, node: TSESTree.Node, initialScope?: Scope): boolean;
481
- declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | unit, allowJSXFragment?: false): node is TSESTree.JSXElement;
482
- declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | unit, allowJSXFragment?: true): node is TSESTree.JSXElement | TSESTree.JSXFragment;
483
-
656
+ //#endregion
657
+ //#region src/jsx/jsx-stringify.d.ts
484
658
  /**
485
- * Get the stringified representation of a JSX node
486
- * @param node The JSX node
487
- * @returns The stringified representation
659
+ * Incomplete but sufficient stringification of JSX nodes for common use cases
660
+ *
661
+ * @param node - JSX node from TypeScript ESTree
662
+ * @returns String representation of the JSX node
488
663
  */
489
- declare function stringifyJsx(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXClosingElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXText): string;
490
-
491
- declare const isAnyType: (type: ts.Type) => boolean;
492
- declare const isBigIntType: (type: ts.Type) => boolean;
493
- declare const isBooleanType: (type: ts.Type) => boolean;
494
- declare const isEnumType: (type: ts.Type) => boolean;
495
- declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
496
- freshType: ts.FreshableType;
497
- regularType: ts.FreshableType;
498
- flags: ts.TypeFlags;
499
- symbol: ts.Symbol;
500
- pattern?: ts.DestructuringPattern;
501
- aliasSymbol?: ts.Symbol;
502
- aliasTypeArguments?: readonly ts.Type[];
503
- getFlags: () => ts.TypeFlags;
504
- getSymbol: () => ts.Symbol | undefined;
505
- getProperties: () => ts.Symbol[];
506
- getProperty: (propertyName: string) => ts.Symbol | undefined;
507
- getApparentProperties: () => ts.Symbol[];
508
- getCallSignatures: () => readonly ts.Signature[];
509
- getConstructSignatures: () => readonly ts.Signature[];
510
- getStringIndexType: () => ts.Type | undefined;
511
- getNumberIndexType: () => ts.Type | undefined;
512
- getBaseTypes: () => ts.BaseType[] | undefined;
513
- getNonNullableType: () => ts.Type;
514
- getConstraint: () => ts.Type | undefined;
515
- getDefault: () => ts.Type | undefined;
516
- isUnion: () => this is ts.UnionType;
517
- isIntersection: () => this is ts.IntersectionType;
518
- isUnionOrIntersection: () => this is ts.UnionOrIntersectionType;
519
- isLiteral: () => this is ts.LiteralType;
520
- isStringLiteral: () => this is ts.StringLiteralType;
521
- isNumberLiteral: () => this is ts.NumberLiteralType;
522
- isTypeParameter: () => this is ts.TypeParameter;
523
- isClassOrInterface: () => this is ts.InterfaceType;
524
- isClass: () => this is ts.InterfaceType;
525
- isIndexType: () => this is ts.IndexType;
526
- value: {
527
- negative: boolean;
528
- base10Value: "0";
529
- };
530
- };
531
- declare const isFalsyNumberType: (type: ts.Type) => boolean;
532
- declare const isFalsyStringType: (type: ts.Type) => boolean;
533
- declare const isNeverType: (type: ts.Type) => boolean;
534
- declare const isNullishType: (type: ts.Type) => boolean;
535
- declare const isNumberType: (type: ts.Type) => boolean;
536
- declare const isObjectType: (type: ts.Type) => boolean;
537
- declare const isStringType: (type: ts.Type) => boolean;
538
- declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
539
- freshType: ts.FreshableType;
540
- regularType: ts.FreshableType;
541
- flags: ts.TypeFlags;
542
- symbol: ts.Symbol;
543
- pattern?: ts.DestructuringPattern;
544
- aliasSymbol?: ts.Symbol;
545
- aliasTypeArguments?: readonly ts.Type[];
546
- getFlags: () => ts.TypeFlags;
547
- getSymbol: () => ts.Symbol | undefined;
548
- getProperties: () => ts.Symbol[];
549
- getProperty: (propertyName: string) => ts.Symbol | undefined;
550
- getApparentProperties: () => ts.Symbol[];
551
- getCallSignatures: () => readonly ts.Signature[];
552
- getConstructSignatures: () => readonly ts.Signature[];
553
- getStringIndexType: () => ts.Type | undefined;
554
- getNumberIndexType: () => ts.Type | undefined;
555
- getBaseTypes: () => ts.BaseType[] | undefined;
556
- getNonNullableType: () => ts.Type;
557
- getConstraint: () => ts.Type | undefined;
558
- getDefault: () => ts.Type | undefined;
559
- isUnion: () => this is ts.UnionType;
560
- isIntersection: () => this is ts.IntersectionType;
561
- isUnionOrIntersection: () => this is ts.UnionOrIntersectionType;
562
- isLiteral: () => this is ts.LiteralType;
563
- isStringLiteral: () => this is ts.StringLiteralType;
564
- isNumberLiteral: () => this is ts.NumberLiteralType;
565
- isTypeParameter: () => this is ts.TypeParameter;
566
- isClassOrInterface: () => this is ts.InterfaceType;
567
- isClass: () => this is ts.InterfaceType;
568
- isIndexType: () => this is ts.IndexType;
569
- value: ts.PseudoBigInt;
570
- };
571
- declare const isTruthyNumberType: (type: ts.Type) => boolean;
572
- declare const isTruthyStringType: (type: ts.Type) => boolean;
573
- declare const isUnknownType: (type: ts.Type) => boolean;
574
-
575
- 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";
664
+ 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;
665
+ //#endregion
666
+ //#region src/utils/get-instance-id.d.ts
576
667
  /**
577
- * Ported from https://github.com/typescript-eslint/typescript-eslint/blob/eb736bbfc22554694400e6a4f97051d845d32e0b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts#L826 with some enhancements
578
- * Get the variants of an array of types.
579
- * @param types The types to get the variants of
580
- * @returns The variants of the types
668
+ * Gets the identifier node of an instance based on AST node relationships.
669
+ * Used for tracking where hooks or components are being assigned in the code.
670
+ * @param node The current AST node to evaluate
671
+ * @param prev The previous AST node in the traversal (used for context)
672
+ * @internal
581
673
  */
582
- declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
583
-
584
- /** @internal */
585
674
  declare function getInstanceId(node: TSESTree.Node, prev?: TSESTree.Node): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.BinaryExpression | 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.UnaryExpression | TSESTree.UpdateExpression | TSESTree.YieldExpression | undefined;
586
-
675
+ //#endregion
676
+ //#region src/utils/is-from-react.d.ts
587
677
  /**
588
- * Check if an identifier is initialized from react
678
+ * Check if an identifier name is initialized from react
589
679
  * @param name The top-level identifier's name
590
680
  * @param importSource The import source to check against
591
681
  * @param initialScope Initial scope to search for the identifier
592
- * @returns Whether the identifier is initialized from react
682
+ * @returns Whether the identifier name is initialized from react
683
+ * @internal
593
684
  */
594
685
  declare function isInitializedFromReact(name: string, importSource: string, initialScope: Scope): boolean;
595
-
686
+ //#endregion
687
+ //#region src/utils/is-instance-id-equal.d.ts
596
688
  /** @internal */
597
689
  declare function isInstanceIdEqual(context: RuleContext, a: TSESTree.Node, b: TSESTree.Node): boolean;
598
-
690
+ //#endregion
691
+ //#region src/utils/is-react-api.d.ts
599
692
  declare namespace isReactAPI {
600
- type ReturnType = {
601
- (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
602
- (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
603
- };
693
+ type ReturnType = {
694
+ (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
695
+ (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
696
+ };
604
697
  }
605
698
  declare function isReactAPI(api: string): isReactAPI.ReturnType;
606
699
  declare namespace isReactAPICall {
607
- type ReturnType = {
608
- (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.CallExpression;
609
- (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.CallExpression;
610
- };
700
+ type ReturnType = {
701
+ (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.CallExpression;
702
+ (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.CallExpression;
703
+ };
611
704
  }
612
705
  declare function isReactAPICall(api: string): isReactAPICall.ReturnType;
613
706
  declare const isCaptureOwnerStack: isReactAPI.ReturnType;
@@ -636,5 +729,5 @@ declare const isCreateRefCall: isReactAPICall.ReturnType;
636
729
  declare const isForwardRefCall: isReactAPICall.ReturnType;
637
730
  declare const isMemoCall: isReactAPICall.ReturnType;
638
731
  declare const isLazyCall: isReactAPICall.ReturnType;
639
-
640
- export { type ClassComponent, type Component, ComponentDetectionHint, type ComponentEffectPhaseKind, ComponentFlag, type ComponentKind, type ComponentLifecyclePhaseKind, type ComponentPhaseKind, ComponentPhaseRelevance, type ComponentStateKind, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, type EffectKind, type FunctionComponent, type Hook, JSXDetectionHint, REACT_BUILTIN_HOOK_NAMES, type SemanticEntry, type SemanticNode, type TypeVariant, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, getTypeVariants, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isEnumType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFragmentElement, isFunctionOfRender, isFunctionOfRenderMethod, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isKeyedElement, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookId, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isStringType, isThisSetState, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, isValidComponentDefinition, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
732
+ //#endregion
733
+ export { AttributeValue, ClassComponent, Component, ComponentDetectionHint, ComponentEffectPhaseKind, ComponentFlag, ComponentKind, ComponentLifecyclePhaseKind, ComponentPhaseKind, ComponentPhaseRelevance, ComponentStateKind, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, EffectKind, FunctionComponent, Hook, JSXDetectionHint, JsxConfig, JsxEmit, REACT_BUILTIN_HOOK_NAMES, SemanticEntry, SemanticNode, findParentAttribute, getAttribute, getAttributeName, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, getJsxConfigFromAnnotation, getJsxConfigFromContext, getPhaseKindOfFunction, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDefinition, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookId, isReactHookName, isRender, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectLikeCall, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, resolveAttributeValue, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };