@eslint-react/core 2.0.0-next.122 → 2.0.0-next.125
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 +21 -6
- package/dist/index.js +10 -13
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -456,6 +456,9 @@ declare function isJsxLike(code: {
|
|
|
456
456
|
getScope: (node: TSESTree$1.Node) => Scope;
|
|
457
457
|
}, node: TSESTree$1.Node | unit | null, hint?: JSXDetectionHint): boolean;
|
|
458
458
|
|
|
459
|
+
declare function isHostElement(context: RuleContext, node: TSESTree.Node): boolean;
|
|
460
|
+
declare function isFragmentElement(context: RuleContext, node: TSESTree.Node): node is TSESTree.JSXElement;
|
|
461
|
+
|
|
459
462
|
/**
|
|
460
463
|
* Get the stringified type of a JSX element
|
|
461
464
|
* @param context The ESLint rule context
|
|
@@ -476,11 +479,6 @@ declare function hasEveryAttribute(context: RuleContext, names: string[], attrib
|
|
|
476
479
|
*/
|
|
477
480
|
declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | unit;
|
|
478
481
|
|
|
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
|
-
|
|
484
482
|
/**
|
|
485
483
|
* Get the stringified representation of a JSX node
|
|
486
484
|
* @param node The JSX node
|
|
@@ -488,10 +486,15 @@ declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | n
|
|
|
488
486
|
*/
|
|
489
487
|
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
488
|
|
|
489
|
+
/** @internal */
|
|
491
490
|
declare const isAnyType: (type: ts.Type) => boolean;
|
|
491
|
+
/** @internal */
|
|
492
492
|
declare const isBigIntType: (type: ts.Type) => boolean;
|
|
493
|
+
/** @internal */
|
|
493
494
|
declare const isBooleanType: (type: ts.Type) => boolean;
|
|
495
|
+
/** @internal */
|
|
494
496
|
declare const isEnumType: (type: ts.Type) => boolean;
|
|
497
|
+
/** @internal */
|
|
495
498
|
declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
|
|
496
499
|
freshType: ts.FreshableType;
|
|
497
500
|
regularType: ts.FreshableType;
|
|
@@ -528,13 +531,21 @@ declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
|
|
|
528
531
|
base10Value: "0";
|
|
529
532
|
};
|
|
530
533
|
};
|
|
534
|
+
/** @internal */
|
|
531
535
|
declare const isFalsyNumberType: (type: ts.Type) => boolean;
|
|
536
|
+
/** @internal */
|
|
532
537
|
declare const isFalsyStringType: (type: ts.Type) => boolean;
|
|
538
|
+
/** @internal */
|
|
533
539
|
declare const isNeverType: (type: ts.Type) => boolean;
|
|
540
|
+
/** @internal */
|
|
534
541
|
declare const isNullishType: (type: ts.Type) => boolean;
|
|
542
|
+
/** @internal */
|
|
535
543
|
declare const isNumberType: (type: ts.Type) => boolean;
|
|
544
|
+
/** @internal */
|
|
536
545
|
declare const isObjectType: (type: ts.Type) => boolean;
|
|
546
|
+
/** @internal */
|
|
537
547
|
declare const isStringType: (type: ts.Type) => boolean;
|
|
548
|
+
/** @internal */
|
|
538
549
|
declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
|
|
539
550
|
freshType: ts.FreshableType;
|
|
540
551
|
regularType: ts.FreshableType;
|
|
@@ -568,8 +579,11 @@ declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
|
|
|
568
579
|
isIndexType: () => this is ts.IndexType;
|
|
569
580
|
value: ts.PseudoBigInt;
|
|
570
581
|
};
|
|
582
|
+
/** @internal */
|
|
571
583
|
declare const isTruthyNumberType: (type: ts.Type) => boolean;
|
|
584
|
+
/** @internal */
|
|
572
585
|
declare const isTruthyStringType: (type: ts.Type) => boolean;
|
|
586
|
+
/** @internal */
|
|
573
587
|
declare const isUnknownType: (type: ts.Type) => boolean;
|
|
574
588
|
|
|
575
589
|
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";
|
|
@@ -578,6 +592,7 @@ type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" |
|
|
|
578
592
|
* Get the variants of an array of types.
|
|
579
593
|
* @param types The types to get the variants of
|
|
580
594
|
* @returns The variants of the types
|
|
595
|
+
* @internal
|
|
581
596
|
*/
|
|
582
597
|
declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
|
|
583
598
|
|
|
@@ -637,4 +652,4 @@ declare const isForwardRefCall: isReactAPICall.ReturnType;
|
|
|
637
652
|
declare const isMemoCall: isReactAPICall.ReturnType;
|
|
638
653
|
declare const isLazyCall: isReactAPICall.ReturnType;
|
|
639
654
|
|
|
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,
|
|
655
|
+
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, 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 };
|
package/dist/index.js
CHANGED
|
@@ -507,6 +507,15 @@ function getElementType(context, node) {
|
|
|
507
507
|
return stringifyJsx(node.openingElement.name);
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
+
// src/jsx/jsx-element-is.ts
|
|
511
|
+
function isHostElement(context, node) {
|
|
512
|
+
return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
|
|
513
|
+
}
|
|
514
|
+
function isFragmentElement(context, node) {
|
|
515
|
+
if (node.type !== AST_NODE_TYPES.JSXElement) return false;
|
|
516
|
+
return getElementType(context, node).split(".").at(-1) === "Fragment";
|
|
517
|
+
}
|
|
518
|
+
|
|
510
519
|
// src/jsx/jsx-has.ts
|
|
511
520
|
function hasAttribute(context, name, attributes, initialScope) {
|
|
512
521
|
return getAttribute(context, name, attributes, initialScope) != null;
|
|
@@ -523,18 +532,6 @@ function findParentAttribute(node, test = constTrue) {
|
|
|
523
532
|
};
|
|
524
533
|
return AST14.findParentNode(node, guard);
|
|
525
534
|
}
|
|
526
|
-
function isHostElement(context, node) {
|
|
527
|
-
return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
|
|
528
|
-
}
|
|
529
|
-
function isKeyedElement(context, node, initialScope) {
|
|
530
|
-
return node.type === AST_NODE_TYPES.JSXElement && hasAttribute(context, "key", node.openingElement.attributes, initialScope);
|
|
531
|
-
}
|
|
532
|
-
function isFragmentElement(context, node, allowJSXFragment = false) {
|
|
533
|
-
if (node == null) return false;
|
|
534
|
-
if (node.type !== AST_NODE_TYPES.JSXElement && node.type !== AST_NODE_TYPES.JSXFragment) return false;
|
|
535
|
-
if (node.type === AST_NODE_TYPES.JSXFragment) return allowJSXFragment;
|
|
536
|
-
return getElementType(context, node).split(".").at(-1) === "Fragment";
|
|
537
|
-
}
|
|
538
535
|
|
|
539
536
|
// src/component/component-detection-hint.ts
|
|
540
537
|
var ComponentDetectionHint = {
|
|
@@ -1033,4 +1030,4 @@ function getTypeVariants(types) {
|
|
|
1033
1030
|
return variants;
|
|
1034
1031
|
}
|
|
1035
1032
|
|
|
1036
|
-
export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, REACT_BUILTIN_HOOK_NAMES, 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,
|
|
1033
|
+
export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, REACT_BUILTIN_HOOK_NAMES, 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, 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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.125",
|
|
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": {
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"./package.json"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
31
|
-
"@typescript-eslint/type-utils": "^8.
|
|
32
|
-
"@typescript-eslint/types": "^8.
|
|
33
|
-
"@typescript-eslint/utils": "^8.
|
|
30
|
+
"@typescript-eslint/scope-manager": "^8.39.1",
|
|
31
|
+
"@typescript-eslint/type-utils": "^8.39.1",
|
|
32
|
+
"@typescript-eslint/types": "^8.39.1",
|
|
33
|
+
"@typescript-eslint/utils": "^8.39.1",
|
|
34
34
|
"birecord": "^0.1.1",
|
|
35
35
|
"ts-api-utils": "^2.1.0",
|
|
36
36
|
"ts-pattern": "^5.8.0",
|
|
37
|
-
"@eslint-react/ast": "2.0.0-next.
|
|
38
|
-
"@eslint-react/eff": "2.0.0-next.
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/
|
|
37
|
+
"@eslint-react/ast": "2.0.0-next.125",
|
|
38
|
+
"@eslint-react/eff": "2.0.0-next.125",
|
|
39
|
+
"@eslint-react/kit": "2.0.0-next.125",
|
|
40
|
+
"@eslint-react/shared": "2.0.0-next.125",
|
|
41
|
+
"@eslint-react/var": "2.0.0-next.125"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsup": "^8.5.0",
|