@eslint-react/core 5.8.4-next.1 → 5.8.4
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 +2 -8
- package/dist/index.js +4 -24
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -177,13 +177,7 @@ interface ClassComponentSemanticNode extends SemanticNode {
|
|
|
177
177
|
methods: TSESTreeMethodOrPropertyDefinition[];
|
|
178
178
|
node: TSESTreeClass;
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
* @param context The rule context.
|
|
182
|
-
* @param node The AST node to check.
|
|
183
|
-
* @deprecated Class components are legacy. This function exists only to support legacy rules.
|
|
184
|
-
*/
|
|
185
|
-
declare function isClassComponent(context: RuleContext, node: TSESTree.Node): node is TSESTreeClass;
|
|
186
|
-
declare function isClassComponentLoose(node: TSESTree.Node): node is TSESTreeClass;
|
|
180
|
+
declare function isClassComponent(node: TSESTree.Node): node is TSESTreeClass;
|
|
187
181
|
/**
|
|
188
182
|
* @param node The AST node to check.
|
|
189
183
|
* @deprecated Class components are legacy. This function exists only to support legacy rules.
|
|
@@ -844,4 +838,4 @@ type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" |
|
|
|
844
838
|
*/
|
|
845
839
|
declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
|
|
846
840
|
//#endregion
|
|
847
|
-
export { ClassComponentSemanticNode, ClientFunctionSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, FunctionComponentSemanticNode, FunctionDisplayNameAssignment, FunctionID, FunctionInitPath, FunctionKind, FunctionSemanticNode, 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, isAPIFromReact, isAPIFromReactNative, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent,
|
|
841
|
+
export { ClassComponentSemanticNode, ClientFunctionSemanticNode, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FunctionComponentDetectionHint, FunctionComponentFlag, FunctionComponentSemanticNode, FunctionDisplayNameAssignment, FunctionID, FunctionInitPath, FunctionKind, FunctionSemanticNode, 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, isAPIFromReact, isAPIFromReactNative, 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, 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
|
@@ -268,27 +268,7 @@ function getClassId(node) {
|
|
|
268
268
|
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/class-component.ts
|
|
271
|
-
|
|
272
|
-
* @param context The rule context.
|
|
273
|
-
* @param node The AST node to check.
|
|
274
|
-
* @deprecated Class components are legacy. This function exists only to support legacy rules.
|
|
275
|
-
*/
|
|
276
|
-
function isClassComponent(context, node) {
|
|
277
|
-
if ("superClass" in node && node.superClass != null) {
|
|
278
|
-
const re = /^(?:Pure)?Component$/u;
|
|
279
|
-
switch (true) {
|
|
280
|
-
case node.superClass.type === AST_NODE_TYPES.Identifier:
|
|
281
|
-
if (!re.test(node.superClass.name)) return false;
|
|
282
|
-
return isAPIFromReact(node.superClass.name, context.sourceCode.getScope(node), "react");
|
|
283
|
-
case node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier:
|
|
284
|
-
if (!re.test(node.superClass.property.name)) return false;
|
|
285
|
-
if (node.superClass.object.type === AST_NODE_TYPES.Identifier) return isAPIFromReact(node.superClass.object.name, context.sourceCode.getScope(node), "react");
|
|
286
|
-
return true;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
function isClassComponentLoose(node) {
|
|
271
|
+
function isClassComponent(node) {
|
|
292
272
|
if ("superClass" in node && node.superClass != null) {
|
|
293
273
|
const re = /^(?:Pure)?Component$/u;
|
|
294
274
|
switch (true) {
|
|
@@ -361,7 +341,7 @@ function isRenderMethodLike(node) {
|
|
|
361
341
|
function isRenderMethodCallback(node) {
|
|
362
342
|
const parent = node.parent;
|
|
363
343
|
const greatGrandparent = parent.parent?.parent;
|
|
364
|
-
return greatGrandparent != null && isRenderMethodLike(parent) &&
|
|
344
|
+
return greatGrandparent != null && isRenderMethodLike(parent) && isClassComponent(greatGrandparent);
|
|
365
345
|
}
|
|
366
346
|
/**
|
|
367
347
|
* @param node The call expression node to check.
|
|
@@ -393,7 +373,7 @@ function getClassComponentCollector(context) {
|
|
|
393
373
|
} };
|
|
394
374
|
const getText = (n) => context.sourceCode.getText(n);
|
|
395
375
|
const collect = (node) => {
|
|
396
|
-
if (!isClassComponent(
|
|
376
|
+
if (!isClassComponent(node)) return;
|
|
397
377
|
const id = getClassId(node);
|
|
398
378
|
const key = randomBytes(8).toString("hex");
|
|
399
379
|
const name = id == null ? null : Extract.getFullyQualifiedName(id, getText);
|
|
@@ -1335,4 +1315,4 @@ function getTypeVariants(types) {
|
|
|
1335
1315
|
}
|
|
1336
1316
|
|
|
1337
1317
|
//#endregion
|
|
1338
|
-
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, isAPIFromReact, isAPIFromReactNative, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanLiteralType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent,
|
|
1318
|
+
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, isAPIFromReact, isAPIFromReactNative, 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, 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.8.4
|
|
3
|
+
"version": "5.8.4",
|
|
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": {
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@typescript-eslint/scope-manager": "^8.59.
|
|
33
|
-
"@typescript-eslint/types": "^8.59.
|
|
34
|
-
"@typescript-eslint/utils": "^8.59.
|
|
32
|
+
"@typescript-eslint/scope-manager": "^8.59.4",
|
|
33
|
+
"@typescript-eslint/types": "^8.59.4",
|
|
34
|
+
"@typescript-eslint/utils": "^8.59.4",
|
|
35
35
|
"ts-pattern": "^5.9.0",
|
|
36
|
-
"@eslint-react/ast": "5.8.4
|
|
37
|
-
"@eslint-react/eslint": "5.8.4
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/var": "5.8.4
|
|
40
|
-
"@eslint-react/
|
|
36
|
+
"@eslint-react/ast": "5.8.4",
|
|
37
|
+
"@eslint-react/eslint": "5.8.4",
|
|
38
|
+
"@eslint-react/jsx": "5.8.4",
|
|
39
|
+
"@eslint-react/var": "5.8.4",
|
|
40
|
+
"@eslint-react/shared": "5.8.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@typescript-eslint/parser": "^8.59.
|
|
44
|
-
"@typescript-eslint/typescript-estree": "^8.59.
|
|
43
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
44
|
+
"@typescript-eslint/typescript-estree": "^8.59.4",
|
|
45
45
|
"eslint": "^10.4.0",
|
|
46
46
|
"tsdown": "^0.22.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
48
|
"vitest": "^4.1.6",
|
|
49
|
-
"@local/
|
|
50
|
-
"@local/
|
|
49
|
+
"@local/eff": "3.0.0-beta.72",
|
|
50
|
+
"@local/configs": "0.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"eslint": "^10.3.0",
|