@eslint-react/core 1.22.2-next.8 → 1.22.2-next.9
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 +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +3 -7
- package/dist/index.mjs +4 -7
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -177,7 +177,6 @@ declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleCon
|
|
|
177
177
|
declare function isFragmentElement(node: TSESTree.JSXElement, context: RuleContext): boolean;
|
|
178
178
|
|
|
179
179
|
declare function isInsideReactHook(node: TSESTree.Node): boolean;
|
|
180
|
-
declare function isInsideReactHookCall(node: TSESTree.Node): boolean;
|
|
181
180
|
|
|
182
181
|
interface ERHook extends ERSemanticNode {
|
|
183
182
|
id: O.Some<TSESTree.Identifier>;
|
|
@@ -209,7 +208,7 @@ declare function isReactHook(node: AST.TSESTreeFunction): boolean;
|
|
|
209
208
|
* @param node The node to check.
|
|
210
209
|
* @returns `true` if the node is a React Hook call, `false` otherwise.
|
|
211
210
|
*/
|
|
212
|
-
declare function isReactHookCall(node: TSESTree.
|
|
211
|
+
declare function isReactHookCall(node: TSESTree.Node): boolean;
|
|
213
212
|
declare function isReactHookCallWithName(node: TSESTree.CallExpression, context: RuleContext): (name: string) => boolean;
|
|
214
213
|
declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression): (name: string) => boolean;
|
|
215
214
|
declare function isReactHookCallWithNameAlias(name: string, context: RuleContext, alias: string[]): (node: TSESTree.CallExpression) => boolean;
|
|
@@ -2374,4 +2373,4 @@ declare const isCreateRefCall: (node: CallExpression, context: _eslint_react_typ
|
|
|
2374
2373
|
declare const isForwardRefCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2375
2374
|
declare const isMemoCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2376
2375
|
|
|
2377
|
-
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementRepresentName, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook,
|
|
2376
|
+
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementRepresentName, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderPropLoose, isSetupFunction, 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
|
@@ -177,7 +177,6 @@ declare function isChildrenOfCreateElement(node: TSESTree.Node, context: RuleCon
|
|
|
177
177
|
declare function isFragmentElement(node: TSESTree.JSXElement, context: RuleContext): boolean;
|
|
178
178
|
|
|
179
179
|
declare function isInsideReactHook(node: TSESTree.Node): boolean;
|
|
180
|
-
declare function isInsideReactHookCall(node: TSESTree.Node): boolean;
|
|
181
180
|
|
|
182
181
|
interface ERHook extends ERSemanticNode {
|
|
183
182
|
id: O.Some<TSESTree.Identifier>;
|
|
@@ -209,7 +208,7 @@ declare function isReactHook(node: AST.TSESTreeFunction): boolean;
|
|
|
209
208
|
* @param node The node to check.
|
|
210
209
|
* @returns `true` if the node is a React Hook call, `false` otherwise.
|
|
211
210
|
*/
|
|
212
|
-
declare function isReactHookCall(node: TSESTree.
|
|
211
|
+
declare function isReactHookCall(node: TSESTree.Node): boolean;
|
|
213
212
|
declare function isReactHookCallWithName(node: TSESTree.CallExpression, context: RuleContext): (name: string) => boolean;
|
|
214
213
|
declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression): (name: string) => boolean;
|
|
215
214
|
declare function isReactHookCallWithNameAlias(name: string, context: RuleContext, alias: string[]): (node: TSESTree.CallExpression) => boolean;
|
|
@@ -2374,4 +2373,4 @@ declare const isCreateRefCall: (node: CallExpression, context: _eslint_react_typ
|
|
|
2374
2373
|
declare const isForwardRefCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2375
2374
|
declare const isMemoCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2376
2375
|
|
|
2377
|
-
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementRepresentName, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook,
|
|
2376
|
+
export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementRepresentName, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderPropLoose, isSetupFunction, 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
|
@@ -170,6 +170,7 @@ function isReactHook(node) {
|
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
function isReactHookCall(node) {
|
|
173
|
+
if (node.type !== types.AST_NODE_TYPES.CallExpression) return false;
|
|
173
174
|
if (node.callee.type === types.AST_NODE_TYPES.Identifier) return isReactHookName(node.callee.name);
|
|
174
175
|
if (node.callee.type === types.AST_NODE_TYPES.MemberExpression) {
|
|
175
176
|
return node.callee.property.type === types.AST_NODE_TYPES.Identifier && isReactHookName(node.callee.property.name);
|
|
@@ -247,9 +248,6 @@ var isUseTransitionCall = eff.F.flip(isReactHookCallWithName)("useTransition");
|
|
|
247
248
|
function isInsideReactHook(node) {
|
|
248
249
|
return eff.O.exists(AST9__namespace.traverseUpGuard(node, AST9__namespace.isFunction), isReactHook);
|
|
249
250
|
}
|
|
250
|
-
function isInsideReactHookCall(node) {
|
|
251
|
-
return eff.O.isSome(AST9__namespace.traverseUp(node, (n) => AST9__namespace.is(types.AST_NODE_TYPES.CallExpression)(n) && isReactHookCall(n)));
|
|
252
|
-
}
|
|
253
251
|
var uid = new ShortUniqueId__default.default({ length: 10 });
|
|
254
252
|
function useHookCollector() {
|
|
255
253
|
const hooks = /* @__PURE__ */ new Map();
|
|
@@ -466,10 +464,9 @@ function isFunctionOfRenderMethod(node) {
|
|
|
466
464
|
return isClassComponent(node.parent.parent.parent);
|
|
467
465
|
}
|
|
468
466
|
function isInsideRenderMethod(node) {
|
|
469
|
-
|
|
467
|
+
return eff.O.isSome(AST9__namespace.traverseUp(node, (node2) => {
|
|
470
468
|
return isRenderMethodLike(node2) && isClassComponent(node2.parent.parent);
|
|
471
|
-
};
|
|
472
|
-
return eff.O.isSome(AST9__namespace.traverseUp(node, predicate));
|
|
469
|
+
}));
|
|
473
470
|
}
|
|
474
471
|
function hasNoneOrValidComponentName(node, context) {
|
|
475
472
|
return eff.O.match(
|
|
@@ -742,7 +739,6 @@ exports.isFunctionOfRenderMethod = isFunctionOfRenderMethod;
|
|
|
742
739
|
exports.isInitializedFromReact = isInitializedFromReact;
|
|
743
740
|
exports.isInsideCreateElementProps = isInsideCreateElementProps;
|
|
744
741
|
exports.isInsideReactHook = isInsideReactHook;
|
|
745
|
-
exports.isInsideReactHookCall = isInsideReactHookCall;
|
|
746
742
|
exports.isInsideRenderMethod = isInsideRenderMethod;
|
|
747
743
|
exports.isInversePhase = isInversePhase;
|
|
748
744
|
exports.isMemo = isMemo;
|
package/dist/index.mjs
CHANGED
|
@@ -143,6 +143,7 @@ function isReactHook(node) {
|
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
function isReactHookCall(node) {
|
|
146
|
+
if (node.type !== AST_NODE_TYPES.CallExpression) return false;
|
|
146
147
|
if (node.callee.type === AST_NODE_TYPES.Identifier) return isReactHookName(node.callee.name);
|
|
147
148
|
if (node.callee.type === AST_NODE_TYPES.MemberExpression) {
|
|
148
149
|
return node.callee.property.type === AST_NODE_TYPES.Identifier && isReactHookName(node.callee.property.name);
|
|
@@ -220,9 +221,6 @@ var isUseTransitionCall = F.flip(isReactHookCallWithName)("useTransition");
|
|
|
220
221
|
function isInsideReactHook(node) {
|
|
221
222
|
return O.exists(AST9.traverseUpGuard(node, AST9.isFunction), isReactHook);
|
|
222
223
|
}
|
|
223
|
-
function isInsideReactHookCall(node) {
|
|
224
|
-
return O.isSome(AST9.traverseUp(node, (n) => AST9.is(AST_NODE_TYPES.CallExpression)(n) && isReactHookCall(n)));
|
|
225
|
-
}
|
|
226
224
|
var uid = new ShortUniqueId({ length: 10 });
|
|
227
225
|
function useHookCollector() {
|
|
228
226
|
const hooks = /* @__PURE__ */ new Map();
|
|
@@ -439,10 +437,9 @@ function isFunctionOfRenderMethod(node) {
|
|
|
439
437
|
return isClassComponent(node.parent.parent.parent);
|
|
440
438
|
}
|
|
441
439
|
function isInsideRenderMethod(node) {
|
|
442
|
-
|
|
440
|
+
return O.isSome(AST9.traverseUp(node, (node2) => {
|
|
443
441
|
return isRenderMethodLike(node2) && isClassComponent(node2.parent.parent);
|
|
444
|
-
};
|
|
445
|
-
return O.isSome(AST9.traverseUp(node, predicate));
|
|
442
|
+
}));
|
|
446
443
|
}
|
|
447
444
|
function hasNoneOrValidComponentName(node, context) {
|
|
448
445
|
return O.match(
|
|
@@ -665,4 +662,4 @@ function isThisSetState(node) {
|
|
|
665
662
|
return callee.type === AST_NODE_TYPES.MemberExpression && AST9.isThisExpression(callee.object) && callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "setState";
|
|
666
663
|
}
|
|
667
664
|
|
|
668
|
-
export { DEFAULT_COMPONENT_HINT, ERClassComponentFlag, ERComponentHint, ERFunctionComponentFlag, ERPhaseRelevance, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementRepresentName, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook,
|
|
665
|
+
export { DEFAULT_COMPONENT_HINT, ERClassComponentFlag, ERComponentHint, ERFunctionComponentFlag, ERPhaseRelevance, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementRepresentName, getFunctionComponentIdentifier, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderPropLoose, isSetupFunction, 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.22.2-next.
|
|
3
|
+
"version": "1.22.2-next.9",
|
|
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": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@typescript-eslint/utils": "^8.18.2",
|
|
40
40
|
"short-unique-id": "^5.2.0",
|
|
41
41
|
"ts-pattern": "^5.6.0",
|
|
42
|
-
"@eslint-react/
|
|
43
|
-
"@eslint-react/jsx": "1.22.2-next.
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/var": "1.22.2-next.
|
|
47
|
-
"@eslint-react/
|
|
42
|
+
"@eslint-react/ast": "1.22.2-next.9",
|
|
43
|
+
"@eslint-react/jsx": "1.22.2-next.9",
|
|
44
|
+
"@eslint-react/eff": "1.22.2-next.9",
|
|
45
|
+
"@eslint-react/types": "1.22.2-next.9",
|
|
46
|
+
"@eslint-react/var": "1.22.2-next.9",
|
|
47
|
+
"@eslint-react/shared": "1.22.2-next.9"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup": "^8.3.5",
|