@eslint-react/core 5.17.1 → 5.17.3
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 +33 -2
- package/dist/index.js +91 -67
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TSESTreeClass, TSESTreeDirective, TSESTreeFunction, TSESTreeMethodOrPropertyDefinition } from "@eslint-react/ast";
|
|
2
2
|
import { TSESTree } from "@typescript-eslint/types";
|
|
3
|
-
import { JsxDetectionHint } from "@eslint-react/jsx";
|
|
4
3
|
import { RegExpLike } from "@eslint-react/shared";
|
|
5
4
|
import ts from "typescript";
|
|
6
5
|
import { RuleContext } from "@eslint-react/eslint";
|
|
@@ -599,6 +598,38 @@ declare namespace getHookCollector {
|
|
|
599
598
|
declare function getHookCollector(context: RuleContext): getHookCollector.ReturnType;
|
|
600
599
|
//#endregion
|
|
601
600
|
//#region src/jsx.d.ts
|
|
601
|
+
/**
|
|
602
|
+
* BitFlags for configuring JSX detection behavior.
|
|
603
|
+
*
|
|
604
|
+
* Used by `isJsxLike` to control which AST node kinds are considered
|
|
605
|
+
* "JSX-like". Combine flags with the `|` operator.
|
|
606
|
+
*/
|
|
607
|
+
type JsxDetectionHint = bigint;
|
|
608
|
+
/**
|
|
609
|
+
* Hints for JSX detection.
|
|
610
|
+
*/
|
|
611
|
+
declare const JsxDetectionHint: {
|
|
612
|
+
readonly None: 0n;
|
|
613
|
+
readonly DoNotIncludeJsxWithNullValue: bigint;
|
|
614
|
+
readonly DoNotIncludeJsxWithNumberValue: bigint;
|
|
615
|
+
readonly DoNotIncludeJsxWithBigIntValue: bigint;
|
|
616
|
+
readonly DoNotIncludeJsxWithStringValue: bigint;
|
|
617
|
+
readonly DoNotIncludeJsxWithBooleanValue: bigint;
|
|
618
|
+
readonly DoNotIncludeJsxWithUndefinedValue: bigint;
|
|
619
|
+
readonly DoNotIncludeJsxWithEmptyArrayValue: bigint;
|
|
620
|
+
readonly DoNotIncludeJsxWithCreateElementValue: bigint;
|
|
621
|
+
readonly RequireAllArrayElementsToBeJsx: bigint;
|
|
622
|
+
readonly RequireBothSidesOfLogicalExpressionToBeJsx: bigint;
|
|
623
|
+
readonly RequireBothBranchesOfConditionalExpressionToBeJsx: bigint;
|
|
624
|
+
};
|
|
625
|
+
/**
|
|
626
|
+
* Default JSX detection hint.
|
|
627
|
+
*
|
|
628
|
+
* Skips number, bigint, boolean, string, and undefined literals,
|
|
629
|
+
* the value types that are commonly returned alongside JSX in React
|
|
630
|
+
* components but are not themselves renderable elements.
|
|
631
|
+
*/
|
|
632
|
+
declare const DEFAULT_JSX_DETECTION_HINT: JsxDetectionHint;
|
|
602
633
|
/**
|
|
603
634
|
* Determine whether a node represents JSX-like content based on heuristics.
|
|
604
635
|
*
|
|
@@ -799,4 +830,4 @@ type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" |
|
|
|
799
830
|
*/
|
|
800
831
|
declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
|
|
801
832
|
//#endregion
|
|
802
|
-
export { ClassComponentSemanticNode, ClientFunctionSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, FunctionComponentSemanticNode, FunctionDisplayNameAssignment, FunctionID, FunctionInitPath, FunctionKind, FunctionSemanticNode, HookCall, HookSemanticNode, JsxConfig, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, SemanticFunc, SemanticNode, ServerFunctionSemanticNode, TypeVariant, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFunctionComponentDefinition, isFunctionComponentName, isFunctionComponentNameLoose, isFunctionComponentWrapperCall, isFunctionComponentWrapperCallback, isFunctionEmpty, isFunctionHasCallInInitPath, isFunctionHasDirective, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHookCall, isHookDefinition, isHookId, isHookName, isHookTag, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isStringType, isThisSetStateCall, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUse, isUseActionState, isUseActionStateCall, isUseCall, isUseCallback, isUseCallbackCall, isUseContext, isUseContextCall, isUseDebugValue, isUseDebugValueCall, isUseDeferredValue, isUseDeferredValueCall, isUseEffect, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatus, isUseFormStatusCall, isUseId, isUseIdCall, isUseImperativeHandle, isUseImperativeHandleCall, isUseInsertionEffect, isUseInsertionEffectCall, isUseLayoutEffect, isUseLayoutEffectCall, isUseMemo, isUseMemoCall, isUseOptimistic, isUseOptimisticCall, isUseReducer, isUseReducerCall, isUseRef, isUseRefCall, isUseState, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStore, isUseSyncExternalStoreCall, isUseTransition, isUseTransitionCall };
|
|
833
|
+
export { ClassComponentSemanticNode, ClientFunctionSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, FunctionComponentSemanticNode, FunctionDisplayNameAssignment, FunctionID, FunctionInitPath, FunctionKind, FunctionSemanticNode, HookCall, HookSemanticNode, JsxConfig, JsxDetectionHint, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, SemanticFunc, SemanticNode, ServerFunctionSemanticNode, TypeVariant, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFunctionComponentDefinition, isFunctionComponentName, isFunctionComponentNameLoose, isFunctionComponentWrapperCall, isFunctionComponentWrapperCallback, isFunctionEmpty, isFunctionHasCallInInitPath, isFunctionHasDirective, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHookCall, isHookDefinition, isHookId, isHookName, isHookTag, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isStringType, isThisSetStateCall, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUse, isUseActionState, isUseActionStateCall, isUseCall, isUseCallback, isUseCallbackCall, isUseContext, isUseContextCall, isUseDebugValue, isUseDebugValueCall, isUseDeferredValue, isUseDeferredValueCall, isUseEffect, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatus, isUseFormStatusCall, isUseId, isUseIdCall, isUseImperativeHandle, isUseImperativeHandleCall, isUseInsertionEffect, isUseInsertionEffectCall, isUseLayoutEffect, isUseLayoutEffectCall, isUseMemo, isUseMemoCall, isUseOptimistic, isUseOptimisticCall, isUseReducer, isUseReducerCall, isUseRef, isUseRefCall, isUseState, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStore, isUseSyncExternalStoreCall, isUseTransition, isUseTransitionCall };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Check, Extract, Traverse } from "@eslint-react/ast";
|
|
2
2
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
|
-
import { DEFAULT_JSX_DETECTION_HINT, JsxDetectionHint } from "@eslint-react/jsx";
|
|
5
4
|
import { RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE } from "@eslint-react/shared";
|
|
6
5
|
import { resolve } from "@eslint-react/var";
|
|
7
6
|
import ts from "typescript";
|
|
@@ -862,6 +861,96 @@ const SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT = [
|
|
|
862
861
|
"[left.property.name='displayName']"
|
|
863
862
|
].join("");
|
|
864
863
|
|
|
864
|
+
//#endregion
|
|
865
|
+
//#region src/jsx.ts
|
|
866
|
+
/**
|
|
867
|
+
* Hints for JSX detection.
|
|
868
|
+
*/
|
|
869
|
+
const JsxDetectionHint = {
|
|
870
|
+
None: 0n,
|
|
871
|
+
DoNotIncludeJsxWithNullValue: 1n << 0n,
|
|
872
|
+
DoNotIncludeJsxWithNumberValue: 1n << 1n,
|
|
873
|
+
DoNotIncludeJsxWithBigIntValue: 1n << 2n,
|
|
874
|
+
DoNotIncludeJsxWithStringValue: 1n << 3n,
|
|
875
|
+
DoNotIncludeJsxWithBooleanValue: 1n << 4n,
|
|
876
|
+
DoNotIncludeJsxWithUndefinedValue: 1n << 5n,
|
|
877
|
+
DoNotIncludeJsxWithEmptyArrayValue: 1n << 6n,
|
|
878
|
+
DoNotIncludeJsxWithCreateElementValue: 1n << 7n,
|
|
879
|
+
RequireAllArrayElementsToBeJsx: 1n << 8n,
|
|
880
|
+
RequireBothSidesOfLogicalExpressionToBeJsx: 1n << 9n,
|
|
881
|
+
RequireBothBranchesOfConditionalExpressionToBeJsx: 1n << 10n
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* Default JSX detection hint.
|
|
885
|
+
*
|
|
886
|
+
* Skips number, bigint, boolean, string, and undefined literals,
|
|
887
|
+
* the value types that are commonly returned alongside JSX in React
|
|
888
|
+
* components but are not themselves renderable elements.
|
|
889
|
+
*/
|
|
890
|
+
const DEFAULT_JSX_DETECTION_HINT = 0n | JsxDetectionHint.DoNotIncludeJsxWithNumberValue | JsxDetectionHint.DoNotIncludeJsxWithBigIntValue | JsxDetectionHint.DoNotIncludeJsxWithBooleanValue | JsxDetectionHint.DoNotIncludeJsxWithStringValue | JsxDetectionHint.DoNotIncludeJsxWithUndefinedValue;
|
|
891
|
+
/**
|
|
892
|
+
* Determine whether a node represents JSX-like content based on heuristics.
|
|
893
|
+
*
|
|
894
|
+
* The detection behaviour is configurable through {@link JsxDetectionHint}
|
|
895
|
+
* bit-flags so that callers can opt individual value kinds in or out.
|
|
896
|
+
*
|
|
897
|
+
* Identifiers are resolved to their definitions via scope analysis;
|
|
898
|
+
* circular definitions (e.g. `var a = b; var b = a;`) are detected and
|
|
899
|
+
* treated as not JSX-like instead of recursing indefinitely.
|
|
900
|
+
*
|
|
901
|
+
* @param context The ESLint rule context (needed for variable resolution).
|
|
902
|
+
* @param node The AST node to analyse.
|
|
903
|
+
* @param hint Optional bit-flags to adjust detection behaviour. Defaults to {@link DEFAULT_JSX_DETECTION_HINT}.
|
|
904
|
+
* @returns Whether the node is considered JSX-like.
|
|
905
|
+
*
|
|
906
|
+
* @example
|
|
907
|
+
* ```ts
|
|
908
|
+
* import { isJsxLike } from "@eslint-react/core";
|
|
909
|
+
*
|
|
910
|
+
* if (isJsxLike(context, node)) {
|
|
911
|
+
* // node looks like it evaluates to a React element
|
|
912
|
+
* }
|
|
913
|
+
* ```
|
|
914
|
+
*/
|
|
915
|
+
function isJsxLike(context, node, hint = DEFAULT_JSX_DETECTION_HINT) {
|
|
916
|
+
const seen = /* @__PURE__ */ new Set();
|
|
917
|
+
function visit(node) {
|
|
918
|
+
if (node == null) return false;
|
|
919
|
+
if (Check.isJSX(node)) return true;
|
|
920
|
+
switch (node.type) {
|
|
921
|
+
case AST_NODE_TYPES.Literal:
|
|
922
|
+
switch (typeof node.value) {
|
|
923
|
+
case "boolean": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithBooleanValue);
|
|
924
|
+
case "string": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithStringValue);
|
|
925
|
+
case "number": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithNumberValue);
|
|
926
|
+
case "bigint": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithBigIntValue);
|
|
927
|
+
}
|
|
928
|
+
return node.value == null && !(hint & JsxDetectionHint.DoNotIncludeJsxWithNullValue);
|
|
929
|
+
case AST_NODE_TYPES.TemplateLiteral: return !(hint & JsxDetectionHint.DoNotIncludeJsxWithStringValue);
|
|
930
|
+
case AST_NODE_TYPES.ArrayExpression:
|
|
931
|
+
if (node.elements.length === 0) return !(hint & JsxDetectionHint.DoNotIncludeJsxWithEmptyArrayValue);
|
|
932
|
+
return hint & JsxDetectionHint.RequireAllArrayElementsToBeJsx ? node.elements.every(visit) : node.elements.some(visit);
|
|
933
|
+
case AST_NODE_TYPES.LogicalExpression:
|
|
934
|
+
if (hint & JsxDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx) return visit(node.left) && visit(node.right);
|
|
935
|
+
return visit(node.left) || visit(node.right);
|
|
936
|
+
case AST_NODE_TYPES.ConditionalExpression:
|
|
937
|
+
if (hint & JsxDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx) return visit(node.consequent) && visit(node.alternate);
|
|
938
|
+
return visit(node.consequent) || visit(node.alternate);
|
|
939
|
+
case AST_NODE_TYPES.SequenceExpression: return visit(node.expressions.at(-1) ?? null);
|
|
940
|
+
case AST_NODE_TYPES.CallExpression:
|
|
941
|
+
if (hint & JsxDetectionHint.DoNotIncludeJsxWithCreateElementValue) return false;
|
|
942
|
+
return Extract.getCalleeName(node) === "createElement";
|
|
943
|
+
case AST_NODE_TYPES.Identifier:
|
|
944
|
+
if (node.name === "undefined") return !(hint & JsxDetectionHint.DoNotIncludeJsxWithUndefinedValue);
|
|
945
|
+
if (seen.has(node)) return false;
|
|
946
|
+
seen.add(node);
|
|
947
|
+
return visit(resolve(context, node));
|
|
948
|
+
}
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
return visit(node);
|
|
952
|
+
}
|
|
953
|
+
|
|
865
954
|
//#endregion
|
|
866
955
|
//#region src/function-component.ts
|
|
867
956
|
/**
|
|
@@ -1166,71 +1255,6 @@ function isUseEffectCleanupCallback(node) {
|
|
|
1166
1255
|
return isUseEffectSetupCallback(enclosingFunction);
|
|
1167
1256
|
}
|
|
1168
1257
|
|
|
1169
|
-
//#endregion
|
|
1170
|
-
//#region src/jsx.ts
|
|
1171
|
-
/**
|
|
1172
|
-
* Determine whether a node represents JSX-like content based on heuristics.
|
|
1173
|
-
*
|
|
1174
|
-
* The detection behaviour is configurable through {@link JsxDetectionHint}
|
|
1175
|
-
* bit-flags so that callers can opt individual value kinds in or out.
|
|
1176
|
-
*
|
|
1177
|
-
* Identifiers are resolved to their definitions via scope analysis;
|
|
1178
|
-
* circular definitions (e.g. `var a = b; var b = a;`) are detected and
|
|
1179
|
-
* treated as not JSX-like instead of recursing indefinitely.
|
|
1180
|
-
*
|
|
1181
|
-
* @param context The ESLint rule context (needed for variable resolution).
|
|
1182
|
-
* @param node The AST node to analyse.
|
|
1183
|
-
* @param hint Optional bit-flags to adjust detection behaviour. Defaults to {@link DEFAULT_JSX_DETECTION_HINT}.
|
|
1184
|
-
* @returns Whether the node is considered JSX-like.
|
|
1185
|
-
*
|
|
1186
|
-
* @example
|
|
1187
|
-
* ```ts
|
|
1188
|
-
* import { isJsxLike } from "@eslint-react/core";
|
|
1189
|
-
*
|
|
1190
|
-
* if (isJsxLike(context, node)) {
|
|
1191
|
-
* // node looks like it evaluates to a React element
|
|
1192
|
-
* }
|
|
1193
|
-
* ```
|
|
1194
|
-
*/
|
|
1195
|
-
function isJsxLike(context, node, hint = DEFAULT_JSX_DETECTION_HINT) {
|
|
1196
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1197
|
-
function visit(node) {
|
|
1198
|
-
if (node == null) return false;
|
|
1199
|
-
if (Check.isJSX(node)) return true;
|
|
1200
|
-
switch (node.type) {
|
|
1201
|
-
case AST_NODE_TYPES.Literal:
|
|
1202
|
-
switch (typeof node.value) {
|
|
1203
|
-
case "boolean": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithBooleanValue);
|
|
1204
|
-
case "string": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithStringValue);
|
|
1205
|
-
case "number": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithNumberValue);
|
|
1206
|
-
case "bigint": return !(hint & JsxDetectionHint.DoNotIncludeJsxWithBigIntValue);
|
|
1207
|
-
}
|
|
1208
|
-
return node.value == null && !(hint & JsxDetectionHint.DoNotIncludeJsxWithNullValue);
|
|
1209
|
-
case AST_NODE_TYPES.TemplateLiteral: return !(hint & JsxDetectionHint.DoNotIncludeJsxWithStringValue);
|
|
1210
|
-
case AST_NODE_TYPES.ArrayExpression:
|
|
1211
|
-
if (node.elements.length === 0) return !(hint & JsxDetectionHint.DoNotIncludeJsxWithEmptyArrayValue);
|
|
1212
|
-
return hint & JsxDetectionHint.RequireAllArrayElementsToBeJsx ? node.elements.every(visit) : node.elements.some(visit);
|
|
1213
|
-
case AST_NODE_TYPES.LogicalExpression:
|
|
1214
|
-
if (hint & JsxDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx) return visit(node.left) && visit(node.right);
|
|
1215
|
-
return visit(node.left) || visit(node.right);
|
|
1216
|
-
case AST_NODE_TYPES.ConditionalExpression:
|
|
1217
|
-
if (hint & JsxDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx) return visit(node.consequent) && visit(node.alternate);
|
|
1218
|
-
return visit(node.consequent) || visit(node.alternate);
|
|
1219
|
-
case AST_NODE_TYPES.SequenceExpression: return visit(node.expressions.at(-1) ?? null);
|
|
1220
|
-
case AST_NODE_TYPES.CallExpression:
|
|
1221
|
-
if (hint & JsxDetectionHint.DoNotIncludeJsxWithCreateElementValue) return false;
|
|
1222
|
-
return Extract.getCalleeName(node) === "createElement";
|
|
1223
|
-
case AST_NODE_TYPES.Identifier:
|
|
1224
|
-
if (node.name === "undefined") return !(hint & JsxDetectionHint.DoNotIncludeJsxWithUndefinedValue);
|
|
1225
|
-
if (seen.has(node)) return false;
|
|
1226
|
-
seen.add(node);
|
|
1227
|
-
return visit(resolve(context, node));
|
|
1228
|
-
}
|
|
1229
|
-
return false;
|
|
1230
|
-
}
|
|
1231
|
-
return visit(node);
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
1258
|
//#endregion
|
|
1235
1259
|
//#region src/function-component-collector.ts
|
|
1236
1260
|
/**
|
|
@@ -1634,4 +1658,4 @@ function getTypeVariants(types) {
|
|
|
1634
1658
|
}
|
|
1635
1659
|
|
|
1636
1660
|
//#endregion
|
|
1637
|
-
export { DEFAULT_COMPONENT_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFunctionComponentDefinition, isFunctionComponentName, isFunctionComponentNameLoose, isFunctionComponentWrapperCall, isFunctionComponentWrapperCallback, isFunctionEmpty, isFunctionHasCallInInitPath, isFunctionHasDirective, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHookCall, isHookDefinition, isHookId, isHookName, isHookTag, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isStringType, isThisSetStateCall, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUse, isUseActionState, isUseActionStateCall, isUseCall, isUseCallback, isUseCallbackCall, isUseContext, isUseContextCall, isUseDebugValue, isUseDebugValueCall, isUseDeferredValue, isUseDeferredValueCall, isUseEffect, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatus, isUseFormStatusCall, isUseId, isUseIdCall, isUseImperativeHandle, isUseImperativeHandleCall, isUseInsertionEffect, isUseInsertionEffectCall, isUseLayoutEffect, isUseLayoutEffectCall, isUseMemo, isUseMemoCall, isUseOptimistic, isUseOptimisticCall, isUseReducer, isUseReducerCall, isUseRef, isUseRefCall, isUseState, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStore, isUseSyncExternalStoreCall, isUseTransition, isUseTransitionCall };
|
|
1661
|
+
export { DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, JsxDetectionHint, REACT_BUILTIN_HOOK_NAMES, SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT, getClassComponentCollector, getClassId, getFullyQualifiedNameEx, getFunctionComponentCollector, getFunctionComponentFlagFromInitPath, getFunctionComponentId, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHookCollector, getJsxConfig, getJsxConfigFromAnnotation, getJsxConfigFromCompilerOptions, getTypeVariants, isAPI, isAPICall, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFunctionComponentDefinition, isFunctionComponentName, isFunctionComponentNameLoose, isFunctionComponentWrapperCall, isFunctionComponentWrapperCallback, isFunctionEmpty, isFunctionHasCallInInitPath, isFunctionHasDirective, isFunctionWithLooseComponentName, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHookCall, isHookDefinition, isHookId, isHookName, isHookTag, isJsxLike, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isRender, isRenderMethodCallback, isRenderMethodLike, isShouldComponentUpdate, isStringType, isThisSetStateCall, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUse, isUseActionState, isUseActionStateCall, isUseCall, isUseCallback, isUseCallbackCall, isUseContext, isUseContextCall, isUseDebugValue, isUseDebugValueCall, isUseDeferredValue, isUseDeferredValueCall, isUseEffect, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatus, isUseFormStatusCall, isUseId, isUseIdCall, isUseImperativeHandle, isUseImperativeHandleCall, isUseInsertionEffect, isUseInsertionEffectCall, isUseLayoutEffect, isUseLayoutEffectCall, isUseMemo, isUseMemoCall, isUseOptimistic, isUseOptimisticCall, isUseReducer, isUseReducerCall, isUseRef, isUseRefCall, isUseState, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStore, isUseSyncExternalStoreCall, isUseTransition, isUseTransitionCall };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.17.
|
|
3
|
+
"version": "5.17.3",
|
|
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": {
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"@typescript-eslint/types": "^8.64.0",
|
|
34
34
|
"@typescript-eslint/utils": "^8.64.0",
|
|
35
35
|
"ts-pattern": "^5.9.0",
|
|
36
|
-
"@eslint-react/
|
|
37
|
-
"@eslint-react/
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/var": "5.17.
|
|
40
|
-
"@eslint-react/shared": "5.17.1"
|
|
36
|
+
"@eslint-react/eslint": "5.17.3",
|
|
37
|
+
"@eslint-react/ast": "5.17.3",
|
|
38
|
+
"@eslint-react/shared": "5.17.3",
|
|
39
|
+
"@eslint-react/var": "5.17.3"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@typescript-eslint/parser": "^8.64.0",
|
|
44
43
|
"@typescript-eslint/typescript-estree": "^8.64.0",
|
|
45
44
|
"eslint": "^10.7.0",
|
|
46
|
-
"tsdown": "^0.22.
|
|
45
|
+
"tsdown": "^0.22.9",
|
|
47
46
|
"typescript": "6.0.3",
|
|
48
47
|
"vitest": "^4.1.10",
|
|
49
48
|
"@local/configs": "0.0.0",
|
|
50
|
-
"@local/eff": "0.0.0"
|
|
49
|
+
"@local/eff": "0.0.0",
|
|
50
|
+
"@local/testkit": "0.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"eslint": "*",
|