@eslint-react/core 1.52.3-next.8 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "1.52.3-next.8",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -14,22 +14,14 @@
14
14
  "license": "MIT",
15
15
  "author": "Rel1cx<rel1cx@proton.me>",
16
16
  "sideEffects": false,
17
+ "type": "module",
17
18
  "exports": {
18
19
  ".": {
19
- "import": {
20
- "types": "./dist/index.d.mts",
21
- "default": "./dist/index.mjs"
22
- },
23
- "require": {
24
- "types": "./dist/index.d.ts",
25
- "default": "./dist/index.js"
26
- }
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
27
22
  },
28
23
  "./package.json": "./package.json"
29
24
  },
30
- "main": "dist/index.js",
31
- "module": "dist/index.mjs",
32
- "types": "dist/index.d.ts",
33
25
  "files": [
34
26
  "dist",
35
27
  "./package.json"
@@ -41,11 +33,11 @@
41
33
  "@typescript-eslint/utils": "^8.35.0",
42
34
  "birecord": "^0.1.1",
43
35
  "ts-pattern": "^5.7.1",
44
- "@eslint-react/eff": "1.52.3-next.8",
45
- "@eslint-react/ast": "1.52.3-next.8",
46
- "@eslint-react/kit": "1.52.3-next.8",
47
- "@eslint-react/shared": "1.52.3-next.8",
48
- "@eslint-react/var": "1.52.3-next.8"
36
+ "@eslint-react/eff": "2.0.0-beta.0",
37
+ "@eslint-react/ast": "2.0.0-beta.0",
38
+ "@eslint-react/var": "2.0.0-beta.0",
39
+ "@eslint-react/kit": "2.0.0-beta.0",
40
+ "@eslint-react/shared": "2.0.0-beta.0"
49
41
  },
50
42
  "devDependencies": {
51
43
  "tsup": "^8.5.0",
@@ -53,7 +45,7 @@
53
45
  },
54
46
  "engines": {
55
47
  "bun": ">=1.0.15",
56
- "node": ">=18.18.0"
48
+ "node": ">=20.19.0"
57
49
  },
58
50
  "scripts": {
59
51
  "build": "tsup",
package/dist/index.d.mts DELETED
@@ -1,565 +0,0 @@
1
- import { TSESTree } from '@typescript-eslint/types';
2
- import { ESLintUtils, TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
3
- import * as AST from '@eslint-react/ast';
4
- import { unit } from '@eslint-react/eff';
5
- import { RuleContext } from '@eslint-react/kit';
6
- import * as birecord from 'birecord';
7
- import { Scope } from '@typescript-eslint/scope-manager';
8
- import * as VAR from '@eslint-react/var';
9
-
10
- type ComponentDetectionHint = bigint;
11
- /**
12
- * Hints for component collector
13
- */
14
- declare const ComponentDetectionHint: {
15
- /**
16
- * Skip function component created by React.memo
17
- */
18
- readonly SkipMemo: bigint;
19
- /**
20
- * Skip function component created by React.forwardRef
21
- */
22
- readonly SkipForwardRef: bigint;
23
- /**
24
- * Skip function component defined as array map argument
25
- */
26
- readonly SkipArrayMapArgument: bigint;
27
- /**
28
- * Skip function component defined on object method
29
- */
30
- readonly SkipObjectMethod: bigint;
31
- /**
32
- * Skip function component defined on class method
33
- */
34
- readonly SkipClassMethod: bigint;
35
- /**
36
- * Skip function component defined on class property
37
- */
38
- readonly SkipClassProperty: bigint;
39
- readonly None: 0n;
40
- readonly SkipUndefined: bigint;
41
- readonly SkipNullLiteral: bigint;
42
- readonly SkipBooleanLiteral: bigint;
43
- readonly SkipStringLiteral: bigint;
44
- readonly SkipNumberLiteral: bigint;
45
- readonly SkipBigIntLiteral: bigint;
46
- readonly SkipEmptyArray: bigint;
47
- readonly SkipCreateElement: bigint;
48
- readonly StrictArray: bigint;
49
- readonly StrictLogical: bigint;
50
- readonly StrictConditional: bigint;
51
- };
52
- /**
53
- * Default component detection hint
54
- */
55
- declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
56
-
57
- type ComponentEffectPhaseKind = "cleanup" | "setup";
58
- type ComponentLifecyclePhaseKind = "mount" | "unmount";
59
- type ComponentPhaseKind = ComponentEffectPhaseKind | ComponentLifecyclePhaseKind;
60
- declare const ComponentPhaseRelevance: birecord.BiRecord<{
61
- readonly mount: "unmount";
62
- readonly setup: "cleanup";
63
- }>;
64
- declare const isInversePhase: {
65
- (a: ComponentPhaseKind): (b: ComponentPhaseKind) => boolean;
66
- (a: ComponentPhaseKind, b: ComponentPhaseKind): boolean;
67
- };
68
-
69
- interface SemanticEntry {
70
- node: TSESTree.Node;
71
- phase: ComponentPhaseKind;
72
- }
73
-
74
- interface SemanticNode {
75
- id: unit | TSESTree.Identifier | TSESTree.Identifier[];
76
- key: string;
77
- kind: string;
78
- name: unit | string;
79
- node: TSESTree.Node;
80
- flag: bigint;
81
- hint: bigint;
82
- }
83
-
84
- type ComponentFlag = bigint;
85
- declare const ComponentFlag: {
86
- None: bigint;
87
- PureComponent: bigint;
88
- CreateElement: bigint;
89
- Memo: bigint;
90
- ForwardRef: bigint;
91
- Async: bigint;
92
- };
93
-
94
- interface FunctionComponent extends SemanticNode {
95
- id: unit | TSESTree.Identifier | TSESTree.Identifier[];
96
- kind: "function";
97
- node: AST.TSESTreeFunction;
98
- flag: ComponentFlag;
99
- hint: ComponentDetectionHint;
100
- initPath: unit | AST.FunctionInitPath;
101
- hookCalls: TSESTree.CallExpression[];
102
- displayName: unit | TSESTree.Expression;
103
- }
104
- interface ClassComponent extends SemanticNode {
105
- id: unit | TSESTree.Identifier;
106
- kind: "class";
107
- node: AST.TSESTreeClass;
108
- flag: ComponentFlag;
109
- hint: ComponentDetectionHint;
110
- methods: AST.TSESTreeMethodOrProperty[];
111
- displayName: unit | TSESTree.Expression;
112
- }
113
- type Component = ClassComponent | FunctionComponent;
114
-
115
- type FunctionEntry = {
116
- key: string;
117
- node: AST.TSESTreeFunction;
118
- hookCalls: TSESTree.CallExpression[];
119
- isComponent: boolean;
120
- };
121
- declare namespace useComponentCollector {
122
- type Options = {
123
- collectDisplayName?: boolean;
124
- collectHookCalls?: boolean;
125
- hint?: ComponentDetectionHint;
126
- };
127
- type ReturnType = {
128
- ctx: {
129
- getAllComponents: (node: TSESTree.Program) => Map<string, FunctionComponent>;
130
- getCurrentEntries: () => FunctionEntry[];
131
- getCurrentEntry: () => FunctionEntry | unit;
132
- };
133
- listeners: ESLintUtils.RuleListener;
134
- };
135
- }
136
- /**
137
- * Get a ctx and listeners for the rule to collect function components
138
- * @param context The ESLint rule context
139
- * @param options The options to use
140
- * @returns The component collector
141
- */
142
- declare function useComponentCollector(context: RuleContext, options?: useComponentCollector.Options): useComponentCollector.ReturnType;
143
-
144
- declare namespace useComponentCollectorLegacy {
145
- type ReturnType = {
146
- ctx: {
147
- getAllComponents: (node: TSESTree$1.Program) => Map<string, ClassComponent>;
148
- };
149
- listeners: ESLintUtils.RuleListener;
150
- };
151
- }
152
- /**
153
- * Get a ctx and listeners object for the rule to collect class components
154
- * @returns The context and listeners for the rule
155
- */
156
- declare function useComponentCollectorLegacy(): useComponentCollectorLegacy.ReturnType;
157
-
158
- declare function isValidComponentDefinition(context: RuleContext, node: AST.TSESTreeFunction, hint: bigint): boolean;
159
-
160
- /**
161
- * Determines whether inside `createElement`'s children.
162
- * @param context The rule context
163
- * @param node The AST node to check
164
- * @returns `true` if the node is inside createElement's children
165
- */
166
- declare function isChildrenOfCreateElement(context: RuleContext, node: TSESTree.Node): boolean;
167
- /**
168
- * Check whether given node is declared inside class component's render block
169
- * ```tsx
170
- * class Component extends React.Component {
171
- * render() {
172
- * class NestedClassComponent extends React.Component {
173
- * render() { return <div />; }
174
- * }
175
- * const nestedFunctionComponent = () => <div />;
176
- * }
177
- * }
178
- * ```
179
- * @param node The AST node being checked
180
- * @returns `true` if node is inside class component's render block, `false` if not
181
- */
182
- declare function isInsideRenderMethod(node: TSESTree.Node): boolean;
183
- declare function isFunctionOfComponentDidMount(node: TSESTree.Node): boolean;
184
- declare function isFunctionOfComponentWillUnmount(node: TSESTree.Node): boolean;
185
- /**
186
- * Check whether given node is a function of a render method of a class component
187
- * @example
188
- * ```tsx
189
- * class Component extends React.Component {
190
- * renderHeader = () => <div />;
191
- * renderFooter = () => <div />;
192
- * }
193
- * ```
194
- * @param node The AST node to check
195
- * @returns `true` if node is a render function, `false` if not
196
- */
197
- declare function isFunctionOfRenderMethod(node: AST.TSESTreeFunction): boolean;
198
-
199
- declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | unit;
200
-
201
- declare function getComponentFlagFromInitPath(initPath: FunctionComponent["initPath"]): bigint;
202
-
203
- /**
204
- * Check if a node is a React class component
205
- * @param node The AST node to check
206
- * @returns `true` if the node is a class component, `false` otherwise
207
- */
208
- declare function isClassComponent(node: TSESTree.Node): node is AST.TSESTreeClass;
209
- /**
210
- * Check if a node is a React PureComponent
211
- * @param node The AST node to check
212
- * @returns `true` if the node is a pure component, `false` otherwise
213
- */
214
- declare function isPureComponent(node: TSESTree.Node): boolean;
215
-
216
- type ComponentKind = "classComponent" | "functionComponent";
217
-
218
- declare function isComponentDidCatch(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
219
- declare function isComponentDidMount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
220
- declare function isComponentDidUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
221
- declare function isComponentWillMount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
222
- declare function isComponentWillReceiveProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
223
- declare function isComponentWillUnmount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
224
- declare function isComponentWillUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
225
- declare function isGetChildContext(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
226
- declare function isGetDefaultProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
227
- declare function isGetInitialState(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
228
- declare function isGetSnapshotBeforeUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
229
- declare function isShouldComponentUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
230
- declare function isUnsafeComponentWillMount(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
231
- declare function isUnsafeComponentWillReceiveProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
232
- declare function isUnsafeComponentWillUpdate(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
233
- declare function isGetDerivedStateFromProps(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
234
- declare function isGetDerivedStateFromError(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
235
-
236
- declare function isComponentName(name: string): boolean;
237
- declare function isComponentNameLoose(name: string): boolean;
238
- declare function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | unit): string | undefined;
239
- declare function hasNoneOrLooseComponentName(context: RuleContext, fn: AST.TSESTreeFunction): boolean;
240
-
241
- /**
242
- * Check whether given node is a render function of a class component
243
- * @example
244
- * ```tsx
245
- * class Component extends React.Component {
246
- * render() {
247
- * return <div />;
248
- * }
249
- * }
250
- * ```
251
- * @param node The AST node to check
252
- * @returns `true` if node is a render function, `false` if not
253
- */
254
- declare function isRenderLike(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
255
- /**
256
- * Check whether given node is a function of a render function of a class component
257
- * @example
258
- * ```tsx
259
- * class Component extends React.Component {
260
- * render = () => <div />;
261
- * ```
262
- * @param node The AST node to check
263
- * @returns `true` if node is a render function, `false` if not
264
- */
265
- declare function isFunctionOfRender(node: AST.TSESTreeFunction): boolean;
266
-
267
- /**
268
- * Check whether given node is a render method of a class component
269
- * @example
270
- * ```tsx
271
- * class Component extends React.Component {
272
- * renderHeader = () => <div />;
273
- * renderFooter = () => <div />;
274
- * }
275
- * ```
276
- * @param node The AST node to check
277
- * @returns `true` if node is a render function, `false` if not
278
- */
279
- declare function isRenderMethodLike(node: TSESTree.Node): node is AST.TSESTreeMethodOrProperty;
280
-
281
- /**
282
- * Unsafe check whether given node is a render function
283
- * ```tsx
284
- * const renderRow = () => <div />
285
- * ` ^^^^^^^^^^^^`
286
- * _ = <Component renderRow={() => <div />} />
287
- * ` ^^^^^^^^^^^^^ `
288
- * ```
289
- * @param context The rule context
290
- * @param node The AST node to check
291
- * @returns `true` if node is a render function, `false` if not
292
- */
293
- declare function isRenderFunctionLoose(context: RuleContext, node: AST.TSESTreeFunction): boolean;
294
- /**
295
- * Unsafe check whether given JSXAttribute is a render prop
296
- * ```tsx
297
- * _ = <Component renderRow={() => <div />} />
298
- * ` ^^^^^^^^^^^^^^^^^^^^^^^^^ `
299
- * ```
300
- * @param context The rule context
301
- * @param node The AST node to check
302
- * @returns `true` if node is a render prop, `false` if not
303
- */
304
- declare function isRenderPropLoose(context: RuleContext, node: TSESTree.JSXAttribute): boolean;
305
- /**
306
- * Unsafe check whether given node is declared directly inside a render property
307
- * ```tsx
308
- * const rows = { render: () => <div /> }
309
- * ` ^^^^^^^^^^^^^ `
310
- * _ = <Component rows={ [{ render: () => <div /> }] } />
311
- * ` ^^^^^^^^^^^^^ `
312
- * ```
313
- * @internal
314
- * @param node The AST node to check
315
- * @returns `true` if component is declared inside a render property, `false` if not
316
- */
317
- declare function isDirectValueOfRenderPropertyLoose(node: TSESTree.Node): boolean;
318
- /**
319
- * Unsafe check whether given node is declared inside a render prop
320
- * ```tsx
321
- * _ = <Component renderRow={"node"} />
322
- * ` ^^^^^^ `
323
- * _ = <Component rows={ [{ render: "node" }] } />
324
- * ` ^^^^^^ `
325
- * ```
326
- * @param node The AST node to check
327
- * @returns `true` if component is declared inside a render prop, `false` if not
328
- */
329
- declare function isDeclaredInRenderPropLoose(node: TSESTree.Node): boolean;
330
-
331
- type ComponentStateKind = "actionState" | "state";
332
- declare function isThisSetState(node: TSESTree.CallExpression): boolean;
333
- declare function isAssignmentToThisState(node: TSESTree.AssignmentExpression): boolean;
334
-
335
- /**
336
- * Check if the node is a call expression for a component wrapper
337
- * @param context The ESLint rule context
338
- * @param node The node to check
339
- * @returns `true` if the node is a call expression for a component wrapper
340
- */
341
- declare function isComponentWrapperCall(context: RuleContext, node: TSESTree.Node): boolean;
342
- /**
343
- * Check if the node is a call expression for a component wrapper loosely
344
- * @param context The ESLint rule context
345
- * @param node The node to check
346
- * @returns `true` if the node is a call expression for a component wrapper loosely
347
- */
348
- declare function isComponentWrapperCallLoose(context: RuleContext, node: TSESTree.Node): boolean;
349
-
350
- type EffectKind = "useEffect" | "useLayoutEffect" | "useInsertionEffect";
351
-
352
- interface Hook extends SemanticNode {
353
- id: TSESTree.Identifier | unit;
354
- node: AST.TSESTreeFunction;
355
- name: string;
356
- hookCalls: TSESTree.CallExpression[];
357
- }
358
-
359
- declare namespace useHookCollector {
360
- type ReturnType = {
361
- ctx: {
362
- getAllHooks(node: TSESTree$1.Program): Map<string, Hook>;
363
- };
364
- listeners: ESLintUtils.RuleListener;
365
- };
366
- }
367
- declare function useHookCollector(): useHookCollector.ReturnType;
368
-
369
- declare function isFunctionOfUseEffectSetup(node: TSESTree.Node | unit): boolean;
370
- declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | unit): boolean;
371
-
372
- declare function isReactHook(node: AST.TSESTreeFunction | unit): boolean;
373
- /**
374
- * Check if the given node is a React Hook call by its name.
375
- * @param node The node to check.
376
- * @returns `true` if the node is a React Hook call, `false` otherwise.
377
- */
378
- declare function isReactHookCall(node: TSESTree.Node | unit): boolean;
379
- declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | unit): (name: string) => boolean;
380
- declare function isReactHookCallWithNameLoose(node: TSESTree.Node | unit): (name: string) => boolean;
381
- declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: unit | string[]): (node: TSESTree.CallExpression) => boolean;
382
- declare function isUseEffectCallLoose(node: TSESTree.Node | unit): boolean;
383
- declare const isUseCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
384
- declare const isUseActionStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
385
- declare const isUseCallbackCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
386
- declare const isUseContextCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
387
- declare const isUseDebugValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
388
- declare const isUseDeferredValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
389
- declare const isUseEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
390
- declare const isUseFormStatusCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
391
- declare const isUseIdCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
392
- declare const isUseImperativeHandleCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
393
- declare const isUseInsertionEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
394
- declare const isUseLayoutEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
395
- declare const isUseMemoCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
396
- declare const isUseOptimisticCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
397
- declare const isUseReducerCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
398
- declare const isUseRefCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
399
- declare const isUseStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
400
- declare const isUseSyncExternalStoreCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
401
- declare const isUseTransitionCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
402
-
403
- type HookKind = "custom" | "useActionState" | "useCallback" | "useContext" | "useDebugValue" | "useDeferredValue" | "useEffect" | "useId" | "useImperativeHandle" | "useInsertionEffect" | "useLayoutEffect" | "useMemo" | "useOptimistic" | "useReducer" | "useRef" | "useState" | "useSyncExternalStore" | "useTransition";
404
-
405
- /**
406
- * Catch all identifiers that begin with "use" followed by an uppercase Latin
407
- * character to exclude identifiers like "user".
408
- * @param name The name of the identifier to check.
409
- * @see https://github.com/facebook/react/blob/1d6c8168db1d82713202e842df3167787ffa00ed/packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts#L16
410
- */
411
- declare function isReactHookName(name: string): boolean;
412
-
413
- /**
414
- * Get the JSX attribute node with the given name
415
- * @param context The ESLint rule context
416
- * @param name The name of the attribute
417
- * @param attributes The attributes to search
418
- * @param initialScope The initial scope to use for variable resolution
419
- * @returns The JSX attribute node or undefined
420
- */
421
- declare function getAttribute(context: RuleContext, name: string, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], initialScope?: Scope): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | unit;
422
-
423
- /**
424
- * Get the stringified name of a JSX attribute
425
- * @param context The ESLint rule context
426
- * @param node The JSX attribute node
427
- * @returns The name of the attribute
428
- */
429
- declare function getAttributeName(context: RuleContext, node: TSESTree$1.JSXAttribute): string;
430
-
431
- /**
432
- * Get a StaticValue of the attribute value
433
- * @param context The rule context
434
- * @param node The JSX attribute node
435
- * @param name The name of the attribute
436
- * @returns The StaticValue of the attribute value
437
- */
438
- declare function getAttributeValue(context: RuleContext, node: TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute, name: string): Exclude<VAR.LazyValue, {
439
- kind: "lazy";
440
- }>;
441
-
442
- type JSXDetectionHint = bigint;
443
- declare const JSXDetectionHint: {
444
- readonly None: 0n;
445
- readonly SkipUndefined: bigint;
446
- readonly SkipNullLiteral: bigint;
447
- readonly SkipBooleanLiteral: bigint;
448
- readonly SkipStringLiteral: bigint;
449
- readonly SkipNumberLiteral: bigint;
450
- readonly SkipBigIntLiteral: bigint;
451
- readonly SkipEmptyArray: bigint;
452
- readonly SkipCreateElement: bigint;
453
- readonly StrictArray: bigint;
454
- readonly StrictLogical: bigint;
455
- readonly StrictConditional: bigint;
456
- };
457
- declare const DEFAULT_JSX_DETECTION_HINT: bigint;
458
-
459
- /**
460
- * Check if a node is a `JSXText` or a `Literal` node
461
- * @param node The AST node to check
462
- * @returns `true` if the node is a `JSXText` or a `Literal` node
463
- */
464
- declare function isJsxText(node: TSESTree$1.Node | null | unit): node is TSESTree$1.JSXText | TSESTree$1.Literal;
465
- /**
466
- * Heuristic decision to determine if a node is a JSX-like node.
467
- * @param code The sourceCode object
468
- * @param code.getScope The function to get the scope of a node
469
- * @param node The AST node to check
470
- * @param hint The `JSXDetectionHint` to use
471
- * @returns boolean
472
- */
473
- declare function isJsxLike(code: {
474
- getScope: (node: TSESTree$1.Node) => Scope;
475
- }, node: TSESTree$1.Node | unit | null, hint?: JSXDetectionHint): boolean;
476
-
477
- /**
478
- * Get the stringified type of a JSX element
479
- * @param context The ESLint rule context
480
- * @param node The JSX element node
481
- * @returns The type of the element
482
- */
483
- declare function getElementType(context: RuleContext, node: TSESTree.JSXElement | TSESTree.JSXFragment): string;
484
-
485
- declare function hasAttribute(context: RuleContext, name: string, attributes: TSESTree.JSXOpeningElement["attributes"], initialScope?: Scope): boolean;
486
- declare function hasAnyAttribute(context: RuleContext, names: string[], attributes: TSESTree.JSXOpeningElement["attributes"], initialScope?: Scope): boolean;
487
- declare function hasEveryAttribute(context: RuleContext, names: string[], attributes: TSESTree.JSXOpeningElement["attributes"], initialScope?: Scope): boolean;
488
-
489
- /**
490
- * Find the parent JSX attribute node of a node
491
- * @param node The node to find the parent attribute of
492
- * @param test The test to apply to the parent attribute
493
- * @returns The parent attribute node or undefined
494
- */
495
- declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | unit;
496
-
497
- declare function isHostElement(context: RuleContext, node: TSESTree.Node): boolean;
498
- declare function isKeyedElement(context: RuleContext, node: TSESTree.Node, initialScope?: Scope): boolean;
499
- declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | unit, allowJSXFragment?: false): node is TSESTree.JSXElement;
500
- declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | unit, allowJSXFragment?: true): node is TSESTree.JSXElement | TSESTree.JSXFragment;
501
-
502
- /**
503
- * Get the stringified representation of a JSX node
504
- * @param node The JSX node
505
- * @returns The stringified representation
506
- */
507
- 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;
508
-
509
- /** @internal */
510
- 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.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpression | TSESTree.UpdateExpression | TSESTree.YieldExpression | TSESTree.PrivateIdentifier | undefined;
511
-
512
- /**
513
- * Check if an identifier is initialized from react
514
- * @param name The top-level identifier's name
515
- * @param importSource The import source to check against
516
- * @param initialScope Initial scope to search for the identifier
517
- * @returns Whether the identifier is initialized from react
518
- */
519
- declare function isInitializedFromReact(name: string, importSource: string, initialScope: Scope): boolean;
520
-
521
- /** @internal */
522
- declare function isInstanceIdEqual(context: RuleContext, a: TSESTree.Node, b: TSESTree.Node): boolean;
523
-
524
- declare namespace isReactAPI {
525
- type ReturnType = {
526
- (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
527
- (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
528
- };
529
- }
530
- declare function isReactAPI(api: string): isReactAPI.ReturnType;
531
- declare namespace isReactAPICall {
532
- type ReturnType = {
533
- (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.CallExpression;
534
- (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.CallExpression;
535
- };
536
- }
537
- declare function isReactAPICall(api: string): isReactAPICall.ReturnType;
538
- declare const isCaptureOwnerStack: isReactAPI.ReturnType;
539
- declare const isChildrenCount: isReactAPI.ReturnType;
540
- declare const isChildrenForEach: isReactAPI.ReturnType;
541
- declare const isChildrenMap: isReactAPI.ReturnType;
542
- declare const isChildrenOnly: isReactAPI.ReturnType;
543
- declare const isChildrenToArray: isReactAPI.ReturnType;
544
- declare const isCloneElement: isReactAPI.ReturnType;
545
- declare const isCreateContext: isReactAPI.ReturnType;
546
- declare const isCreateElement: isReactAPI.ReturnType;
547
- declare const isCreateRef: isReactAPI.ReturnType;
548
- declare const isForwardRef: isReactAPI.ReturnType;
549
- declare const isMemo: isReactAPI.ReturnType;
550
- declare const isLazy: isReactAPI.ReturnType;
551
- declare const isCaptureOwnerStackCall: isReactAPICall.ReturnType;
552
- declare const isChildrenCountCall: isReactAPICall.ReturnType;
553
- declare const isChildrenForEachCall: isReactAPICall.ReturnType;
554
- declare const isChildrenMapCall: isReactAPICall.ReturnType;
555
- declare const isChildrenOnlyCall: isReactAPICall.ReturnType;
556
- declare const isChildrenToArrayCall: isReactAPICall.ReturnType;
557
- declare const isCloneElementCall: isReactAPICall.ReturnType;
558
- declare const isCreateContextCall: isReactAPICall.ReturnType;
559
- declare const isCreateElementCall: isReactAPICall.ReturnType;
560
- declare const isCreateRefCall: isReactAPICall.ReturnType;
561
- declare const isForwardRefCall: isReactAPICall.ReturnType;
562
- declare const isMemoCall: isReactAPICall.ReturnType;
563
- declare const isLazyCall: isReactAPICall.ReturnType;
564
-
565
- 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, type HookKind, JSXDetectionHint, type SemanticEntry, type SemanticNode, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAssignmentToThisState, 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, isForwardRef, isForwardRefCall, isFragmentElement, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRender, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isKeyedElement, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, 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 };