@eslint-react/core 1.24.0 → 1.24.1-next.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/dist/index.d.mts +8 -9
- package/dist/index.d.ts +8 -9
- package/dist/index.js +11 -21
- package/dist/index.mjs +11 -20
- package/package.json +11 -11
package/dist/index.d.mts
CHANGED
|
@@ -45,15 +45,13 @@ declare const ERComponentHint: {
|
|
|
45
45
|
};
|
|
46
46
|
declare const DEFAULT_COMPONENT_HINT: bigint;
|
|
47
47
|
|
|
48
|
-
type
|
|
49
|
-
declare const
|
|
48
|
+
type ERComponentFlag = bigint;
|
|
49
|
+
declare const ERComponentFlag: {
|
|
50
50
|
None: bigint;
|
|
51
51
|
PureComponent: bigint;
|
|
52
|
-
|
|
53
|
-
type ERFunctionComponentFlag = bigint;
|
|
54
|
-
declare const ERFunctionComponentFlag: {
|
|
55
|
-
None: bigint;
|
|
52
|
+
CreateElement: bigint;
|
|
56
53
|
Memo: bigint;
|
|
54
|
+
Async: bigint;
|
|
57
55
|
ForwardRef: bigint;
|
|
58
56
|
};
|
|
59
57
|
|
|
@@ -61,7 +59,7 @@ interface ERFunctionComponent extends ERSemanticNode {
|
|
|
61
59
|
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
|
|
62
60
|
kind: "function";
|
|
63
61
|
node: AST.TSESTreeFunction;
|
|
64
|
-
flag:
|
|
62
|
+
flag: ERComponentFlag;
|
|
65
63
|
hint: ERComponentHint;
|
|
66
64
|
initPath: _ | AST.FunctionInitPath;
|
|
67
65
|
hookCalls: TSESTree.CallExpression[];
|
|
@@ -71,7 +69,7 @@ interface ERClassComponent extends ERSemanticNode {
|
|
|
71
69
|
id: _ | TSESTree.Identifier;
|
|
72
70
|
kind: "class";
|
|
73
71
|
node: AST.TSESTreeClass;
|
|
74
|
-
flag:
|
|
72
|
+
flag: ERComponentFlag;
|
|
75
73
|
hint: ERComponentHint;
|
|
76
74
|
methods: AST.TSESTreeMethodOrProperty[];
|
|
77
75
|
displayName: _ | TSESTree.Expression;
|
|
@@ -1976,6 +1974,7 @@ declare interface TSImportEqualsRequireDeclaration extends TSImportEqualsDeclara
|
|
|
1976
1974
|
declare interface TSImportType extends BaseNode {
|
|
1977
1975
|
type: AST_NODE_TYPES.TSImportType;
|
|
1978
1976
|
argument: TypeNode;
|
|
1977
|
+
attributes: ImportAttribute[];
|
|
1979
1978
|
qualifier: EntityName | null;
|
|
1980
1979
|
typeArguments: TSTypeParameterInstantiation | null;
|
|
1981
1980
|
}
|
|
@@ -2587,4 +2586,4 @@ declare const isMemoCall: {
|
|
|
2587
2586
|
(node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
|
|
2588
2587
|
};
|
|
2589
2588
|
|
|
2590
|
-
export { COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ComponentCollectorOptions, DEFAULT_COMPONENT_HINT, type ERClassComponent,
|
|
2589
|
+
export { COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ComponentCollectorOptions, DEFAULT_COMPONENT_HINT, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDisplayNameAssignment, isComponentName, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,15 +45,13 @@ declare const ERComponentHint: {
|
|
|
45
45
|
};
|
|
46
46
|
declare const DEFAULT_COMPONENT_HINT: bigint;
|
|
47
47
|
|
|
48
|
-
type
|
|
49
|
-
declare const
|
|
48
|
+
type ERComponentFlag = bigint;
|
|
49
|
+
declare const ERComponentFlag: {
|
|
50
50
|
None: bigint;
|
|
51
51
|
PureComponent: bigint;
|
|
52
|
-
|
|
53
|
-
type ERFunctionComponentFlag = bigint;
|
|
54
|
-
declare const ERFunctionComponentFlag: {
|
|
55
|
-
None: bigint;
|
|
52
|
+
CreateElement: bigint;
|
|
56
53
|
Memo: bigint;
|
|
54
|
+
Async: bigint;
|
|
57
55
|
ForwardRef: bigint;
|
|
58
56
|
};
|
|
59
57
|
|
|
@@ -61,7 +59,7 @@ interface ERFunctionComponent extends ERSemanticNode {
|
|
|
61
59
|
id: _ | TSESTree.Identifier | TSESTree.Identifier[];
|
|
62
60
|
kind: "function";
|
|
63
61
|
node: AST.TSESTreeFunction;
|
|
64
|
-
flag:
|
|
62
|
+
flag: ERComponentFlag;
|
|
65
63
|
hint: ERComponentHint;
|
|
66
64
|
initPath: _ | AST.FunctionInitPath;
|
|
67
65
|
hookCalls: TSESTree.CallExpression[];
|
|
@@ -71,7 +69,7 @@ interface ERClassComponent extends ERSemanticNode {
|
|
|
71
69
|
id: _ | TSESTree.Identifier;
|
|
72
70
|
kind: "class";
|
|
73
71
|
node: AST.TSESTreeClass;
|
|
74
|
-
flag:
|
|
72
|
+
flag: ERComponentFlag;
|
|
75
73
|
hint: ERComponentHint;
|
|
76
74
|
methods: AST.TSESTreeMethodOrProperty[];
|
|
77
75
|
displayName: _ | TSESTree.Expression;
|
|
@@ -1976,6 +1974,7 @@ declare interface TSImportEqualsRequireDeclaration extends TSImportEqualsDeclara
|
|
|
1976
1974
|
declare interface TSImportType extends BaseNode {
|
|
1977
1975
|
type: AST_NODE_TYPES.TSImportType;
|
|
1978
1976
|
argument: TypeNode;
|
|
1977
|
+
attributes: ImportAttribute[];
|
|
1979
1978
|
qualifier: EntityName | null;
|
|
1980
1979
|
typeArguments: TSTypeParameterInstantiation | null;
|
|
1981
1980
|
}
|
|
@@ -2587,4 +2586,4 @@ declare const isMemoCall: {
|
|
|
2587
2586
|
(node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
|
|
2588
2587
|
};
|
|
2589
2588
|
|
|
2590
|
-
export { COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ComponentCollectorOptions, DEFAULT_COMPONENT_HINT, type ERClassComponent,
|
|
2589
|
+
export { COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ComponentCollectorOptions, DEFAULT_COMPONENT_HINT, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDisplayNameAssignment, isComponentName, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
|
package/dist/index.js
CHANGED
|
@@ -348,22 +348,13 @@ function isComponentDisplayNameAssignment(node) {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
// src/component/component-flag.ts
|
|
351
|
-
var
|
|
351
|
+
var ERComponentFlag = {
|
|
352
352
|
None: 0n,
|
|
353
|
-
PureComponent: 1n << 0n
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
None: 0n,
|
|
359
|
-
Memo: 1n << 0n,
|
|
360
|
-
ForwardRef: 1n << 1n
|
|
361
|
-
// Reserved for future use
|
|
362
|
-
// CreateElement: 1n << 2n,
|
|
363
|
-
// Reserved for future use
|
|
364
|
-
// hasHooks: 1n << 3n,
|
|
365
|
-
// Reserved for future use
|
|
366
|
-
// Async: 1n << 4n,
|
|
353
|
+
PureComponent: 1n << 0n,
|
|
354
|
+
CreateElement: 1n << 1n,
|
|
355
|
+
Memo: 1n << 2n,
|
|
356
|
+
Async: 1n << 3n,
|
|
357
|
+
ForwardRef: 1n << 4n
|
|
367
358
|
};
|
|
368
359
|
function isComponentWrapperCall(node, context) {
|
|
369
360
|
if (node.type !== types.AST_NODE_TYPES.CallExpression) {
|
|
@@ -489,12 +480,12 @@ function hasValidHierarchy(node, context, hint) {
|
|
|
489
480
|
return boundaryNode == null || boundaryNode.type !== types.AST_NODE_TYPES.JSXExpressionContainer;
|
|
490
481
|
}
|
|
491
482
|
function getComponentFlag(initPath) {
|
|
492
|
-
let flag =
|
|
483
|
+
let flag = ERComponentFlag.None;
|
|
493
484
|
if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("memo", initPath)) {
|
|
494
|
-
flag |=
|
|
485
|
+
flag |= ERComponentFlag.Memo;
|
|
495
486
|
}
|
|
496
487
|
if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("forwardRef", initPath)) {
|
|
497
|
-
flag |=
|
|
488
|
+
flag |= ERComponentFlag.ForwardRef;
|
|
498
489
|
}
|
|
499
490
|
return flag;
|
|
500
491
|
}
|
|
@@ -630,7 +621,7 @@ function useComponentCollectorLegacy() {
|
|
|
630
621
|
}
|
|
631
622
|
const id = AST8__namespace.getClassIdentifier(node);
|
|
632
623
|
const key = shared.getId();
|
|
633
|
-
const flag = isPureComponent(node) ?
|
|
624
|
+
const flag = isPureComponent(node) ? ERComponentFlag.PureComponent : ERComponentFlag.None;
|
|
634
625
|
components.set(
|
|
635
626
|
key,
|
|
636
627
|
{
|
|
@@ -711,9 +702,8 @@ function isFunctionOfUseEffectCleanup(node) {
|
|
|
711
702
|
|
|
712
703
|
exports.COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR = COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR;
|
|
713
704
|
exports.DEFAULT_COMPONENT_HINT = DEFAULT_COMPONENT_HINT;
|
|
714
|
-
exports.
|
|
705
|
+
exports.ERComponentFlag = ERComponentFlag;
|
|
715
706
|
exports.ERComponentHint = ERComponentHint;
|
|
716
|
-
exports.ERFunctionComponentFlag = ERFunctionComponentFlag;
|
|
717
707
|
exports.ERPhaseRelevance = ERPhaseRelevance;
|
|
718
708
|
exports.RE_COMPONENT_NAME = RE_COMPONENT_NAME;
|
|
719
709
|
exports.RE_HOOK_NAME = RE_HOOK_NAME;
|
package/dist/index.mjs
CHANGED
|
@@ -321,22 +321,13 @@ function isComponentDisplayNameAssignment(node) {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// src/component/component-flag.ts
|
|
324
|
-
var
|
|
324
|
+
var ERComponentFlag = {
|
|
325
325
|
None: 0n,
|
|
326
|
-
PureComponent: 1n << 0n
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
None: 0n,
|
|
332
|
-
Memo: 1n << 0n,
|
|
333
|
-
ForwardRef: 1n << 1n
|
|
334
|
-
// Reserved for future use
|
|
335
|
-
// CreateElement: 1n << 2n,
|
|
336
|
-
// Reserved for future use
|
|
337
|
-
// hasHooks: 1n << 3n,
|
|
338
|
-
// Reserved for future use
|
|
339
|
-
// Async: 1n << 4n,
|
|
326
|
+
PureComponent: 1n << 0n,
|
|
327
|
+
CreateElement: 1n << 1n,
|
|
328
|
+
Memo: 1n << 2n,
|
|
329
|
+
Async: 1n << 3n,
|
|
330
|
+
ForwardRef: 1n << 4n
|
|
340
331
|
};
|
|
341
332
|
function isComponentWrapperCall(node, context) {
|
|
342
333
|
if (node.type !== AST_NODE_TYPES.CallExpression) {
|
|
@@ -462,12 +453,12 @@ function hasValidHierarchy(node, context, hint) {
|
|
|
462
453
|
return boundaryNode == null || boundaryNode.type !== AST_NODE_TYPES.JSXExpressionContainer;
|
|
463
454
|
}
|
|
464
455
|
function getComponentFlag(initPath) {
|
|
465
|
-
let flag =
|
|
456
|
+
let flag = ERComponentFlag.None;
|
|
466
457
|
if (initPath != null && AST8.hasCallInFunctionInitPath("memo", initPath)) {
|
|
467
|
-
flag |=
|
|
458
|
+
flag |= ERComponentFlag.Memo;
|
|
468
459
|
}
|
|
469
460
|
if (initPath != null && AST8.hasCallInFunctionInitPath("forwardRef", initPath)) {
|
|
470
|
-
flag |=
|
|
461
|
+
flag |= ERComponentFlag.ForwardRef;
|
|
471
462
|
}
|
|
472
463
|
return flag;
|
|
473
464
|
}
|
|
@@ -603,7 +594,7 @@ function useComponentCollectorLegacy() {
|
|
|
603
594
|
}
|
|
604
595
|
const id = AST8.getClassIdentifier(node);
|
|
605
596
|
const key = getId();
|
|
606
|
-
const flag = isPureComponent(node) ?
|
|
597
|
+
const flag = isPureComponent(node) ? ERComponentFlag.PureComponent : ERComponentFlag.None;
|
|
607
598
|
components.set(
|
|
608
599
|
key,
|
|
609
600
|
{
|
|
@@ -682,4 +673,4 @@ function isFunctionOfUseEffectCleanup(node) {
|
|
|
682
673
|
return nearFunction === nearFunctionOfReturn && isFunctionOfUseEffectSetup(nearFunction);
|
|
683
674
|
}
|
|
684
675
|
|
|
685
|
-
export { COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR, DEFAULT_COMPONENT_HINT,
|
|
676
|
+
export { COMPONENT_DISPLAY_NAME_ASSIGNMENT_SELECTOR, DEFAULT_COMPONENT_HINT, ERComponentFlag, ERComponentHint, ERPhaseRelevance, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDisplayNameAssignment, isComponentName, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "1.24.0",
|
|
3
|
+
"version": "1.24.1-next.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": {
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"./package.json"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
37
|
-
"@typescript-eslint/type-utils": "^8.
|
|
38
|
-
"@typescript-eslint/types": "^8.
|
|
39
|
-
"@typescript-eslint/utils": "^8.
|
|
36
|
+
"@typescript-eslint/scope-manager": "^8.21.0",
|
|
37
|
+
"@typescript-eslint/type-utils": "^8.21.0",
|
|
38
|
+
"@typescript-eslint/types": "^8.21.0",
|
|
39
|
+
"@typescript-eslint/utils": "^8.21.0",
|
|
40
40
|
"birecord": "^0.1.1",
|
|
41
|
-
"ts-pattern": "^5.6.
|
|
42
|
-
"@eslint-react/
|
|
43
|
-
"@eslint-react/
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
41
|
+
"ts-pattern": "^5.6.2",
|
|
42
|
+
"@eslint-react/eff": "1.24.1-next.0",
|
|
43
|
+
"@eslint-react/shared": "1.24.1-next.0",
|
|
44
|
+
"@eslint-react/var": "1.24.1-next.0",
|
|
45
|
+
"@eslint-react/ast": "1.24.1-next.0",
|
|
46
|
+
"@eslint-react/jsx": "1.24.1-next.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"tsup": "^8.3.5",
|