@eslint-react/core 1.49.0-beta.0 → 2.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +13 -32
- package/dist/index.js +292 -453
- package/package.json +10 -18
- package/dist/index.d.mts +0 -565
- package/dist/index.mjs +0 -948
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import { RuleContext } from '@eslint-react/kit';
|
|
1
2
|
import { TSESTree } from '@typescript-eslint/types';
|
|
2
3
|
import { ESLintUtils, TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
3
4
|
import * as AST from '@eslint-react/ast';
|
|
4
5
|
import { _ } from '@eslint-react/eff';
|
|
5
|
-
import { RuleContext } from '@eslint-react/kit';
|
|
6
6
|
import * as birecord from 'birecord';
|
|
7
7
|
import { Scope } from '@typescript-eslint/scope-manager';
|
|
8
8
|
import * as VAR from '@eslint-react/var';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Determines whether inside `createElement`'s children.
|
|
12
|
+
* @param context The rule context
|
|
13
|
+
* @param node The AST node to check
|
|
14
|
+
* @returns `true` if the node is inside createElement's children
|
|
15
|
+
*/
|
|
16
|
+
declare function isChildrenOfCreateElement(context: RuleContext, node: TSESTree.Node): boolean;
|
|
17
|
+
|
|
10
18
|
type ComponentDetectionHint = bigint;
|
|
11
19
|
/**
|
|
12
20
|
* Hints for component collector
|
|
@@ -155,33 +163,6 @@ declare namespace useComponentCollectorLegacy {
|
|
|
155
163
|
*/
|
|
156
164
|
declare function useComponentCollectorLegacy(): useComponentCollectorLegacy.ReturnType;
|
|
157
165
|
|
|
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
166
|
/**
|
|
186
167
|
* Check whether given node is a function of a render method of a class component
|
|
187
168
|
* @example
|
|
@@ -195,6 +176,7 @@ declare function isFunctionOfComponentWillUnmount(node: TSESTree.Node): boolean;
|
|
|
195
176
|
* @returns `true` if node is a render function, `false` if not
|
|
196
177
|
*/
|
|
197
178
|
declare function isFunctionOfRenderMethod(node: AST.TSESTreeFunction): boolean;
|
|
179
|
+
declare function isValidComponentDefinition(context: RuleContext, node: AST.TSESTreeFunction, hint: bigint): boolean;
|
|
198
180
|
|
|
199
181
|
declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | _;
|
|
200
182
|
|
|
@@ -366,8 +348,7 @@ declare namespace useHookCollector {
|
|
|
366
348
|
}
|
|
367
349
|
declare function useHookCollector(): useHookCollector.ReturnType;
|
|
368
350
|
|
|
369
|
-
declare function
|
|
370
|
-
declare function isFunctionOfUseEffectCleanup(node: TSESTree.Node | _): boolean;
|
|
351
|
+
declare function isReactHookId(id: TSESTree.Identifier | TSESTree.MemberExpression): boolean;
|
|
371
352
|
|
|
372
353
|
declare function isReactHook(node: AST.TSESTreeFunction | _): boolean;
|
|
373
354
|
/**
|
|
@@ -507,7 +488,7 @@ declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | n
|
|
|
507
488
|
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
489
|
|
|
509
490
|
/** @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.
|
|
491
|
+
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;
|
|
511
492
|
|
|
512
493
|
/**
|
|
513
494
|
* Check if an identifier is initialized from react
|
|
@@ -562,4 +543,4 @@ declare const isForwardRefCall: isReactAPICall.ReturnType;
|
|
|
562
543
|
declare const isMemoCall: isReactAPICall.ReturnType;
|
|
563
544
|
declare const isLazyCall: isReactAPICall.ReturnType;
|
|
564
545
|
|
|
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,
|
|
546
|
+
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, isFunctionOfRender, isFunctionOfRenderMethod, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isKeyedElement, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookId, 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 };
|