@eslint-react/core 1.17.4-next.9 → 1.18.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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -158,7 +158,7 @@ type EREffectKind = "effect" | "insertionEffect" | "layoutEffect";
|
|
|
158
158
|
declare function isSetupFunction(node: TSESTree.Node): boolean;
|
|
159
159
|
declare function isCleanupFunction(node: TSESTree.Node): boolean;
|
|
160
160
|
|
|
161
|
-
declare function
|
|
161
|
+
declare function getElementRepresentName(node: TSESTree.JSXOpeningElement, context: RuleContext): string;
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Determines whether inside createElement's props.
|
|
@@ -2375,4 +2375,4 @@ declare const isCreateRefCall: (node: CallExpression, context: _eslint_react_typ
|
|
|
2375
2375
|
declare const isForwardRefCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2376
2376
|
declare const isMemoCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2377
2377
|
|
|
2378
|
-
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,
|
|
2378
|
+
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, isInsideReactHookCall, 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
|
@@ -158,7 +158,7 @@ type EREffectKind = "effect" | "insertionEffect" | "layoutEffect";
|
|
|
158
158
|
declare function isSetupFunction(node: TSESTree.Node): boolean;
|
|
159
159
|
declare function isCleanupFunction(node: TSESTree.Node): boolean;
|
|
160
160
|
|
|
161
|
-
declare function
|
|
161
|
+
declare function getElementRepresentName(node: TSESTree.JSXOpeningElement, context: RuleContext): string;
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Determines whether inside createElement's props.
|
|
@@ -2375,4 +2375,4 @@ declare const isCreateRefCall: (node: CallExpression, context: _eslint_react_typ
|
|
|
2375
2375
|
declare const isForwardRefCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2376
2376
|
declare const isMemoCall: (node: CallExpression, context: _eslint_react_types.RuleContext) => boolean;
|
|
2377
2377
|
|
|
2378
|
-
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,
|
|
2378
|
+
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, isInsideReactHookCall, 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
|
@@ -37,18 +37,18 @@ var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
|
|
|
37
37
|
var birecord__default = /*#__PURE__*/_interopDefault(birecord);
|
|
38
38
|
|
|
39
39
|
// src/component/component-collector.ts
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
40
|
+
function getElementRepresentName(node, context) {
|
|
41
|
+
const rawElementName = JSX4__namespace.getElementName(node);
|
|
42
|
+
if (rawElementName === rawElementName.toLowerCase()) return rawElementName;
|
|
43
43
|
const { components, polymorphicPropName } = shared.normalizeSettings(shared.decodeSettings(context.settings));
|
|
44
|
-
const asElementName = components.get(
|
|
44
|
+
const asElementName = components.get(rawElementName);
|
|
45
45
|
if (tools.isString(asElementName)) return asElementName;
|
|
46
46
|
return tools.F.pipe(
|
|
47
47
|
tools.O.fromNullable(polymorphicPropName),
|
|
48
48
|
tools.O.flatMap(JSX4__namespace.findPropInAttributes(node.attributes, context.sourceCode.getScope(node))),
|
|
49
49
|
tools.O.flatMap((attr) => JSX4__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
|
|
50
50
|
tools.O.filter(tools.isString),
|
|
51
|
-
tools.O.getOrElse(() =>
|
|
51
|
+
tools.O.getOrElse(() => rawElementName)
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
function isInitializedFromReact(name, initialScope, settings) {
|
|
@@ -701,7 +701,7 @@ exports.ERPhaseRelevance = ERPhaseRelevance;
|
|
|
701
701
|
exports.RE_COMPONENT_NAME = RE_COMPONENT_NAME;
|
|
702
702
|
exports.RE_HOOK_NAME = RE_HOOK_NAME;
|
|
703
703
|
exports.getComponentNameFromIdentifier = getComponentNameFromIdentifier;
|
|
704
|
-
exports.
|
|
704
|
+
exports.getElementRepresentName = getElementRepresentName;
|
|
705
705
|
exports.getFunctionComponentIdentifier = getFunctionComponentIdentifier;
|
|
706
706
|
exports.hasNoneOrValidComponentName = hasNoneOrValidComponentName;
|
|
707
707
|
exports.isCallFromReact = isCallFromReact;
|
package/dist/index.mjs
CHANGED
|
@@ -9,18 +9,18 @@ import * as VAR from '@eslint-react/var';
|
|
|
9
9
|
import birecord from 'birecord';
|
|
10
10
|
|
|
11
11
|
// src/component/component-collector.ts
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
12
|
+
function getElementRepresentName(node, context) {
|
|
13
|
+
const rawElementName = JSX4.getElementName(node);
|
|
14
|
+
if (rawElementName === rawElementName.toLowerCase()) return rawElementName;
|
|
15
15
|
const { components, polymorphicPropName } = normalizeSettings(decodeSettings(context.settings));
|
|
16
|
-
const asElementName = components.get(
|
|
16
|
+
const asElementName = components.get(rawElementName);
|
|
17
17
|
if (isString(asElementName)) return asElementName;
|
|
18
18
|
return F.pipe(
|
|
19
19
|
O.fromNullable(polymorphicPropName),
|
|
20
20
|
O.flatMap(JSX4.findPropInAttributes(node.attributes, context.sourceCode.getScope(node))),
|
|
21
21
|
O.flatMap((attr) => JSX4.getPropValue(attr, context.sourceCode.getScope(attr))),
|
|
22
22
|
O.filter(isString),
|
|
23
|
-
O.getOrElse(() =>
|
|
23
|
+
O.getOrElse(() => rawElementName)
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
function isInitializedFromReact(name, initialScope, settings) {
|
|
@@ -665,4 +665,4 @@ function isThisSetState(node) {
|
|
|
665
665
|
return callee.type === AST_NODE_TYPES.MemberExpression && AST9.isThisExpression(callee.object) && callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "setState";
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
-
export { DEFAULT_COMPONENT_HINT, ERClassComponentFlag, ERComponentHint, ERFunctionComponentFlag, ERPhaseRelevance, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier,
|
|
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, isInsideReactHookCall, 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.
|
|
3
|
+
"version": "1.18.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": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"birecord": "^0.1.1",
|
|
43
43
|
"short-unique-id": "^5.2.0",
|
|
44
44
|
"ts-pattern": "^5.5.0",
|
|
45
|
-
"@eslint-react/ast": "1.
|
|
46
|
-
"@eslint-react/jsx": "1.
|
|
47
|
-
"@eslint-react/shared": "1.
|
|
48
|
-
"@eslint-react/tools": "1.
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
45
|
+
"@eslint-react/ast": "1.18.1-next.0",
|
|
46
|
+
"@eslint-react/jsx": "1.18.1-next.0",
|
|
47
|
+
"@eslint-react/shared": "1.18.1-next.0",
|
|
48
|
+
"@eslint-react/tools": "1.18.1-next.0",
|
|
49
|
+
"@eslint-react/types": "1.18.1-next.0",
|
|
50
|
+
"@eslint-react/var": "1.18.1-next.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"tsup": "^8.3.5"
|