Skip to content

Commit a1d31f1

Browse files
committed
Unify JSX function naming conventions and improve code consistency
I've unified the naming conventions by adding `Jsx` prefix to JSX-related functions and types, and improved consistency across the codebase. Key changes: - Renamed `getAttribute` -> `getJsxAttribute` - Renamed `hasAttribute` -> `hasJsxAttribute` - Renamed `isHostElement` -> `isJsxHostElement` - Renamed `isFragmentElement` -> `isJsxFragmentElement` - Renamed `getElementType` -> `getJsxElementType` - Renamed `getAttributeName` -> `getJsxAttributeName` - Renamed `AttributeValue` -> `JsxAttributeValue` - Renamed `JSXDetectionHint` -> `JsxDetectionHint`
1 parent 7efddc7 commit a1d31f1

File tree

84 files changed

+409
-423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+409
-423
lines changed

packages/core/docs/README.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
## Type Aliases
2525

26-
- [AttributeValue](type-aliases/AttributeValue.md)
2726
- [Component](type-aliases/Component.md)
2827
- [ComponentDetectionHint](type-aliases/ComponentDetectionHint.md)
2928
- [ComponentEffectPhaseKind](type-aliases/ComponentEffectPhaseKind.md)
@@ -33,7 +32,8 @@
3332
- [ComponentPhaseKind](type-aliases/ComponentPhaseKind.md)
3433
- [ComponentStateKind](type-aliases/ComponentStateKind.md)
3534
- [EffectKind](type-aliases/EffectKind.md)
36-
- [JSXDetectionHint](type-aliases/JSXDetectionHint.md)
35+
- [JsxAttributeValue](type-aliases/JsxAttributeValue.md)
36+
- [JsxDetectionHint](type-aliases/JsxDetectionHint.md)
3737

3838
## Variables
3939

@@ -106,25 +106,23 @@
106106
- [isUseStateCall](variables/isUseStateCall.md)
107107
- [isUseSyncExternalStoreCall](variables/isUseSyncExternalStoreCall.md)
108108
- [isUseTransitionCall](variables/isUseTransitionCall.md)
109-
- [JSXDetectionHint](variables/JSXDetectionHint.md)
109+
- [JsxDetectionHint](variables/JsxDetectionHint.md)
110110
- [JsxEmit](variables/JsxEmit.md)
111111
- [REACT\_BUILTIN\_HOOK\_NAMES](variables/REACT_BUILTIN_HOOK_NAMES.md)
112112

113113
## Functions
114114

115-
- [findParentAttribute](functions/findParentAttribute.md)
116-
- [getAttribute](functions/getAttribute.md)
117-
- [getAttributeName](functions/getAttributeName.md)
115+
- [findParentJsxAttribute](functions/findParentJsxAttribute.md)
118116
- [getComponentFlagFromInitPath](functions/getComponentFlagFromInitPath.md)
119117
- [getComponentNameFromId](functions/getComponentNameFromId.md)
120-
- [getElementType](functions/getElementType.md)
121118
- [getFunctionComponentId](functions/getFunctionComponentId.md)
119+
- [getJsxAttribute](functions/getJsxAttribute.md)
120+
- [getJsxAttributeName](functions/getJsxAttributeName.md)
122121
- [getJsxConfigFromAnnotation](functions/getJsxConfigFromAnnotation.md)
123122
- [getJsxConfigFromContext](functions/getJsxConfigFromContext.md)
123+
- [getJsxElementType](functions/getJsxElementType.md)
124124
- [getPhaseKindOfFunction](functions/getPhaseKindOfFunction.md)
125-
- [hasAnyAttribute](functions/hasAnyAttribute.md)
126-
- [hasAttribute](functions/hasAttribute.md)
127-
- [hasEveryAttribute](functions/hasEveryAttribute.md)
125+
- [hasJsxAttribute](functions/hasJsxAttribute.md)
128126
- [hasNoneOrLooseComponentName](functions/hasNoneOrLooseComponentName.md)
129127
- [isAssignmentToThisState](functions/isAssignmentToThisState.md)
130128
- [isChildrenOfCreateElement](functions/isChildrenOfCreateElement.md)
@@ -135,13 +133,13 @@
135133
- [isComponentWrapperCall](functions/isComponentWrapperCall.md)
136134
- [isComponentWrapperCallLoose](functions/isComponentWrapperCallLoose.md)
137135
- [isDeclaredInRenderPropLoose](functions/isDeclaredInRenderPropLoose.md)
138-
- [isFragmentElement](functions/isFragmentElement.md)
139136
- [isFunctionOfComponentDidMount](functions/isFunctionOfComponentDidMount.md)
140137
- [isFunctionOfComponentWillUnmount](functions/isFunctionOfComponentWillUnmount.md)
141138
- [isFunctionOfRenderMethod](functions/isFunctionOfRenderMethod.md)
142139
- [isFunctionOfUseEffectCleanup](functions/isFunctionOfUseEffectCleanup.md)
143140
- [isFunctionOfUseEffectSetup](functions/isFunctionOfUseEffectSetup.md)
144-
- [isHostElement](functions/isHostElement.md)
141+
- [isJsxFragmentElement](functions/isJsxFragmentElement.md)
142+
- [isJsxHostElement](functions/isJsxHostElement.md)
145143
- [isJsxLike](functions/isJsxLike.md)
146144
- [isJsxText](functions/isJsxText.md)
147145
- [isPureComponent](functions/isPureComponent.md)
@@ -158,7 +156,7 @@
158156
- [isRenderPropLoose](functions/isRenderPropLoose.md)
159157
- [isThisSetState](functions/isThisSetState.md)
160158
- [isUseEffectLikeCall](functions/isUseEffectLikeCall.md)
161-
- [resolveAttributeValue](functions/resolveAttributeValue.md)
159+
- [resolveJsxAttributeValue](functions/resolveJsxAttributeValue.md)
162160
- [stringifyJsx](functions/stringifyJsx.md)
163161
- [useComponentCollector](functions/useComponentCollector.md)
164162
- [useComponentCollectorLegacy](functions/useComponentCollectorLegacy.md)

packages/core/docs/functions/findParentAttribute.md renamed to packages/core/docs/functions/findParentJsxAttribute.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
***
44

5-
[@eslint-react/core](../README.md) / findParentAttribute
5+
[@eslint-react/core](../README.md) / findParentJsxAttribute
66

7-
# Function: findParentAttribute()
7+
# Function: findParentJsxAttribute()
88

9-
> **findParentAttribute**(`node`, `test`): `undefined` \| `JSXAttribute`
9+
> **findParentJsxAttribute**(`node`, `test`): `undefined` \| `JSXAttribute`
1010
1111
Traverses up the AST to find a parent JSX attribute node that matches a given test
1212

packages/core/docs/functions/getAttribute.md renamed to packages/core/docs/functions/getJsxAttribute.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
***
44

5-
[@eslint-react/core](../README.md) / getAttribute
5+
[@eslint-react/core](../README.md) / getJsxAttribute
66

7-
# Function: getAttribute()
7+
# Function: getJsxAttribute()
88

9-
> **getAttribute**(`context`, `attributes`, `initialScope?`): (`name`) => `undefined` \| `TSESTreeJSXAttributeLike`
9+
> **getJsxAttribute**(`context`, `attributes`, `initialScope?`): (`name`) => `undefined` \| `TSESTreeJSXAttributeLike`
1010
1111
## Parameters
1212

packages/core/docs/functions/getAttributeName.md renamed to packages/core/docs/functions/getJsxAttributeName.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
***
44

5-
[@eslint-react/core](../README.md) / getAttributeName
5+
[@eslint-react/core](../README.md) / getJsxAttributeName
66

7-
# Function: getAttributeName()
7+
# Function: getJsxAttributeName()
88

9-
> **getAttributeName**(`context`, `node`): `string`
9+
> **getJsxAttributeName**(`context`, `node`): `string`
1010
1111
Get the stringified name of a JSX attribute
1212

packages/core/docs/functions/getElementType.md renamed to packages/core/docs/functions/getJsxElementType.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
***
44

5-
[@eslint-react/core](../README.md) / getElementType
5+
[@eslint-react/core](../README.md) / getJsxElementType
66

7-
# Function: getElementType()
7+
# Function: getJsxElementType()
88

9-
> **getElementType**(`context`, `node`): `string`
9+
> **getJsxElementType**(`context`, `node`): `string`
1010
1111
Extracts the element type name from a JSX element or fragment
1212
For JSX elements, returns the stringified name (e.g., "div", "Button", "React.Fragment")

packages/core/docs/functions/hasAnyAttribute.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

packages/core/docs/functions/hasEveryAttribute.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

packages/core/docs/functions/hasAttribute.md renamed to packages/core/docs/functions/hasJsxAttribute.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
***
44

5-
[@eslint-react/core](../README.md) / hasAttribute
5+
[@eslint-react/core](../README.md) / hasJsxAttribute
66

7-
# Function: hasAttribute()
7+
# Function: hasJsxAttribute()
88

9-
> **hasAttribute**(`context`, `name`, `attributes`, `initialScope?`): `boolean`
9+
> **hasJsxAttribute**(`context`, `name`, `attributes`, `initialScope?`): `boolean`
1010
1111
Checks if a JSX element has a specific attribute
1212

packages/core/docs/functions/isFragmentElement.md renamed to packages/core/docs/functions/isJsxFragmentElement.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
***
44

5-
[@eslint-react/core](../README.md) / isFragmentElement
5+
[@eslint-react/core](../README.md) / isJsxFragmentElement
66

7-
# Function: isFragmentElement()
7+
# Function: isJsxFragmentElement()
88

9-
> **isFragmentElement**(`context`, `node`): `node is JSXElement`
9+
> **isJsxFragmentElement**(`context`, `node`): `node is JSXElement`
1010
1111
Determines if a JSX element is a React Fragment
1212
Fragments can be imported from React and used like <Fragment> or <React.Fragment>

packages/core/docs/functions/isHostElement.md renamed to packages/core/docs/functions/isJsxHostElement.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
***
44

5-
[@eslint-react/core](../README.md) / isHostElement
5+
[@eslint-react/core](../README.md) / isJsxHostElement
66

7-
# Function: isHostElement()
7+
# Function: isJsxHostElement()
88

9-
> **isHostElement**(`context`, `node`): `boolean`
9+
> **isJsxHostElement**(`context`, `node`): `boolean`
1010
1111
Determines if a JSX element is a host element
1212
Host elements in React start with lowercase letters (e.g., div, span)

0 commit comments

Comments
 (0)