Skip to content

Commit 7c96955

Browse files
authored
refactor: remove JSX package and move functionality to Core (#1060)
1 parent 663f15e commit 7c96955

File tree

93 files changed

+781
-344
lines changed

Some content is hidden

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

93 files changed

+781
-344
lines changed

apps/website/content/docs/contributing.mdx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ flowchart TB
2929
subgraph "Utilities Modules"
3030
AST["AST Module"]:::utilities
3131
Eff["Eff Module"]:::utilities
32-
JSX["JSX Module"]:::utilities
3332
Kit["Kit Module"]:::utilities
3433
Var["Var Module"]:::utilities
3534
end
@@ -69,13 +68,11 @@ flowchart TB
6968
%% Utilities used by Core and Plugins
7069
AST ---|"provides"| Core
7170
Eff ---|"provides"| Core
72-
JSX ---|"provides"| Core
7371
Kit ---|"provides"| Core
7472
Var ---|"provides"| Core
7573
7674
AST ---|"provides"| ReactX
7775
Eff ---|"provides"| ReactX
78-
JSX ---|"provides"| ReactX
7976
Kit ---|"provides"| ReactX
8077
Var ---|"provides"| ReactX
8178
@@ -95,7 +92,6 @@ flowchart TB
9592
Scripts -->|"CI/CD"| Shared
9693
Scripts -->|"CI/CD"| AST
9794
Scripts -->|"CI/CD"| Eff
98-
Scripts -->|"CI/CD"| JSX
9995
Scripts -->|"CI/CD"| Kit
10096
Scripts -->|"CI/CD"| Var
10197
Scripts -->|"CI/CD"| ReactX
@@ -113,7 +109,6 @@ flowchart TB
113109
click Shared "https://github.com/rel1cx/eslint-react/tree/main/packages/shared"
114110
click AST "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/ast"
115111
click Eff "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/eff"
116-
click JSX "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/jsx"
117112
click Kit "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/kit"
118113
click Var "https://github.com/rel1cx/eslint-react/tree/main/packages/utilities/var"
119114
click ReactX "https://github.com/rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x"
@@ -148,7 +143,6 @@ This section provides a summary of the packages in the monorepo.
148143
- `packages/utilities/eff`: JavaScript and TypeScript utilities (previously some re-exports of the `effect` library)
149144
- `packages/utilities/ast`: TSESTree AST utility module for static analysis
150145
- `packages/utilities/var`: TSESTree AST utility module for static analysis of variables
151-
- `packages/utilities/jsx`: TSESTree AST utility module for static analysis of JSX
152146
- `packages/utilities/kit`: ESLint React's plugin kit for building plugins and rules
153147
- **Core & Shared**
154148
- `packages/core`: Utility module for static analysis of React core APIs and patterns

apps/website/content/docs/faq.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Currently, it includes the following:
3030
- `@eslint-react/eff`: JavaScript and TypeScript utilities (previously some re-exports of the `effect` library).
3131
- `@eslint-react/ast`: TSESTree AST utility module.
3232
- `@eslint-react/var`: TSESTree AST utility module for static analysis of variables.
33-
- `@eslint-react/jsx`: TSESTree AST utility module for static analysis of JSX.
3433
- `@eslint-react/kit`: ESLint React's plugin kit for building plugins and rules.
3534
- **Core & Shared Modules**
3635
- `@eslint-react/core`: Utility module for static analysis of React core APIs and patterns.

packages/core/docs/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@
3030
- [ComponentStateKind](type-aliases/ComponentStateKind.md)
3131
- [EffectKind](type-aliases/EffectKind.md)
3232
- [HookKind](type-aliases/HookKind.md)
33+
- [JSXDetectionHint](type-aliases/JSXDetectionHint.md)
34+
- [TSESTreeJSX](type-aliases/TSESTreeJSX.md)
3335

3436
## Variables
3537

3638
- [ComponentDetectionHint](variables/ComponentDetectionHint.md)
3739
- [ComponentFlag](variables/ComponentFlag.md)
3840
- [ComponentPhaseRelevance](variables/ComponentPhaseRelevance.md)
3941
- [DEFAULT\_COMPONENT\_DETECTION\_HINT](variables/DEFAULT_COMPONENT_DETECTION_HINT.md)
42+
- [DEFAULT\_JSX\_DETECTION\_HINT](variables/DEFAULT_JSX_DETECTION_HINT.md)
4043
- [isCaptureOwnerStack](variables/isCaptureOwnerStack.md)
4144
- [isCaptureOwnerStackCall](variables/isCaptureOwnerStackCall.md)
4245
- [isChildrenCount](variables/isChildrenCount.md)
@@ -60,6 +63,7 @@
6063
- [isForwardRef](variables/isForwardRef.md)
6164
- [isForwardRefCall](variables/isForwardRefCall.md)
6265
- [isInversePhase](variables/isInversePhase.md)
66+
- [isJSX](variables/isJSX.md)
6367
- [isLazy](variables/isLazy.md)
6468
- [isLazyCall](variables/isLazyCall.md)
6569
- [isMemo](variables/isMemo.md)
@@ -83,12 +87,21 @@
8387
- [isUseStateCall](variables/isUseStateCall.md)
8488
- [isUseSyncExternalStoreCall](variables/isUseSyncExternalStoreCall.md)
8589
- [isUseTransitionCall](variables/isUseTransitionCall.md)
90+
- [JSXDetectionHint](variables/JSXDetectionHint.md)
8691

8792
## Functions
8893

94+
- [findParentAttribute](functions/findParentAttribute.md)
95+
- [getAttribute](functions/getAttribute.md)
96+
- [getAttributeName](functions/getAttributeName.md)
97+
- [getAttributeValue](functions/getAttributeValue.md)
8998
- [getComponentFlagFromInitPath](functions/getComponentFlagFromInitPath.md)
9099
- [getComponentNameFromId](functions/getComponentNameFromId.md)
100+
- [getElementType](functions/getElementType.md)
91101
- [getFunctionComponentId](functions/getFunctionComponentId.md)
102+
- [hasAnyAttribute](functions/hasAnyAttribute.md)
103+
- [hasAttribute](functions/hasAttribute.md)
104+
- [hasEveryAttribute](functions/hasEveryAttribute.md)
92105
- [hasNoneOrLooseComponentName](functions/hasNoneOrLooseComponentName.md)
93106
- [isAssignmentToThisState](functions/isAssignmentToThisState.md)
94107
- [isChildrenOfCreateElement](functions/isChildrenOfCreateElement.md)
@@ -105,6 +118,7 @@
105118
- [isComponentWrapperCall](functions/isComponentWrapperCall.md)
106119
- [isComponentWrapperCallLoose](functions/isComponentWrapperCallLoose.md)
107120
- [isDeclaredInRenderPropLoose](functions/isDeclaredInRenderPropLoose.md)
121+
- [isFragmentElement](functions/isFragmentElement.md)
108122
- [isFunctionOfComponentDidMount](functions/isFunctionOfComponentDidMount.md)
109123
- [isFunctionOfComponentWillUnmount](functions/isFunctionOfComponentWillUnmount.md)
110124
- [isFunctionOfRender](functions/isFunctionOfRender.md)
@@ -117,8 +131,12 @@
117131
- [isGetDerivedStateFromProps](functions/isGetDerivedStateFromProps.md)
118132
- [isGetInitialState](functions/isGetInitialState.md)
119133
- [isGetSnapshotBeforeUpdate](functions/isGetSnapshotBeforeUpdate.md)
134+
- [isHostElement](functions/isHostElement.md)
120135
- [isInitializedFromReact](functions/isInitializedFromReact.md)
121136
- [isInsideRenderMethod](functions/isInsideRenderMethod.md)
137+
- [isJsxLike](functions/isJsxLike.md)
138+
- [isJsxText](functions/isJsxText.md)
139+
- [isKeyedElement](functions/isKeyedElement.md)
122140
- [isPureComponent](functions/isPureComponent.md)
123141
- [isReactAPI](functions/isReactAPI.md)
124142
- [isReactAPICall](functions/isReactAPICall.md)
@@ -139,6 +157,7 @@
139157
- [isUnsafeComponentWillUpdate](functions/isUnsafeComponentWillUpdate.md)
140158
- [isUseEffectCallLoose](functions/isUseEffectCallLoose.md)
141159
- [isValidComponentDefinition](functions/isValidComponentDefinition.md)
160+
- [stringifyJsx](functions/stringifyJsx.md)
142161
- [useComponentCollector](functions/useComponentCollector.md)
143162
- [useComponentCollectorLegacy](functions/useComponentCollectorLegacy.md)
144163
- [useHookCollector](functions/useHookCollector.md)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / findParentAttribute
6+
7+
# Function: findParentAttribute()
8+
9+
> **findParentAttribute**(`node`, `test`): `undefined` \| `JSXAttribute`
10+
11+
Find the parent JSX attribute node of a node
12+
13+
## Parameters
14+
15+
### node
16+
17+
`Node`
18+
19+
The node to find the parent attribute of
20+
21+
### test
22+
23+
(`node`) => `boolean`
24+
25+
The test to apply to the parent attribute
26+
27+
## Returns
28+
29+
`undefined` \| `JSXAttribute`
30+
31+
The parent attribute node or undefined
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / getAttribute
6+
7+
# Function: getAttribute()
8+
9+
> **getAttribute**(`context`, `name`, `attributes`, `initialScope?`): `undefined` \| `JSXAttribute` \| `JSXSpreadAttribute`
10+
11+
Get the JSX attribute node with the given name
12+
13+
## Parameters
14+
15+
### context
16+
17+
`RuleContext`
18+
19+
The ESLint rule context
20+
21+
### name
22+
23+
`string`
24+
25+
The name of the attribute
26+
27+
### attributes
28+
29+
(`JSXAttribute` \| `JSXSpreadAttribute`)[]
30+
31+
The attributes to search
32+
33+
### initialScope?
34+
35+
`Scope`
36+
37+
The initial scope to use for variable resolution
38+
39+
## Returns
40+
41+
`undefined` \| `JSXAttribute` \| `JSXSpreadAttribute`
42+
43+
The JSX attribute node or undefined
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / getAttributeName
6+
7+
# Function: getAttributeName()
8+
9+
> **getAttributeName**(`context`, `node`): `string`
10+
11+
Get the stringified name of a JSX attribute
12+
13+
## Parameters
14+
15+
### context
16+
17+
`RuleContext`
18+
19+
The ESLint rule context
20+
21+
### node
22+
23+
`JSXAttribute`
24+
25+
The JSX attribute node
26+
27+
## Returns
28+
29+
`string`
30+
31+
The name of the attribute
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / getAttributeValue
6+
7+
# Function: getAttributeValue()
8+
9+
> **getAttributeValue**(`context`, `node`, `name`): \{ `initialScope`: `undefined` \| `Scope`; `kind`: `"none"`; `node`: `Node`; \} \| \{ `initialScope`: `undefined` \| `Scope`; `kind`: `"some"`; `node`: `Node`; `value`: `unknown`; \}
10+
11+
Get a StaticValue of the attribute value
12+
13+
## Parameters
14+
15+
### context
16+
17+
`RuleContext`
18+
19+
The rule context
20+
21+
### node
22+
23+
The JSX attribute node
24+
25+
`JSXAttribute` | `JSXSpreadAttribute`
26+
27+
### name
28+
29+
`string`
30+
31+
The name of the attribute
32+
33+
## Returns
34+
35+
\{ `initialScope`: `undefined` \| `Scope`; `kind`: `"none"`; `node`: `Node`; \} \| \{ `initialScope`: `undefined` \| `Scope`; `kind`: `"some"`; `node`: `Node`; `value`: `unknown`; \}
36+
37+
The StaticValue of the attribute value
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / getElementType
6+
7+
# Function: getElementType()
8+
9+
> **getElementType**(`context`, `node`): `string`
10+
11+
Get the stringified type of a JSX element
12+
13+
## Parameters
14+
15+
### context
16+
17+
`RuleContext`
18+
19+
The ESLint rule context
20+
21+
### node
22+
23+
The JSX element node
24+
25+
`JSXElement` | `JSXFragment`
26+
27+
## Returns
28+
29+
`string`
30+
31+
The type of the element
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / hasAnyAttribute
6+
7+
# Function: hasAnyAttribute()
8+
9+
> **hasAnyAttribute**(`context`, `names`, `attributes`, `initialScope?`): `boolean`
10+
11+
## Parameters
12+
13+
### context
14+
15+
`RuleContext`
16+
17+
### names
18+
19+
`string`[]
20+
21+
### attributes
22+
23+
(`JSXAttribute` \| `JSXSpreadAttribute`)[]
24+
25+
### initialScope?
26+
27+
`Scope`
28+
29+
## Returns
30+
31+
`boolean`
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / hasAttribute
6+
7+
# Function: hasAttribute()
8+
9+
> **hasAttribute**(`context`, `name`, `attributes`, `initialScope?`): `boolean`
10+
11+
## Parameters
12+
13+
### context
14+
15+
`RuleContext`
16+
17+
### name
18+
19+
`string`
20+
21+
### attributes
22+
23+
(`JSXAttribute` \| `JSXSpreadAttribute`)[]
24+
25+
### initialScope?
26+
27+
`Scope`
28+
29+
## Returns
30+
31+
`boolean`

0 commit comments

Comments
 (0)