Skip to content

Commit 187aebd

Browse files
committed
refactor: remove obsolete JSX utility types and functions
1 parent 6fc3cc1 commit 187aebd

File tree

6 files changed

+8
-74
lines changed

6 files changed

+8
-74
lines changed

packages/core/docs/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
- [EffectKind](type-aliases/EffectKind.md)
3232
- [HookKind](type-aliases/HookKind.md)
3333
- [JSXDetectionHint](type-aliases/JSXDetectionHint.md)
34-
- [TSESTreeJSX](type-aliases/TSESTreeJSX.md)
3534

3635
## Variables
3736

@@ -63,7 +62,6 @@
6362
- [isForwardRef](variables/isForwardRef.md)
6463
- [isForwardRefCall](variables/isForwardRefCall.md)
6564
- [isInversePhase](variables/isInversePhase.md)
66-
- [isJSX](variables/isJSX.md)
6765
- [isLazy](variables/isLazy.md)
6866
- [isLazyCall](variables/isLazyCall.md)
6967
- [isMemo](variables/isMemo.md)

packages/core/docs/type-aliases/TSESTreeJSX.md

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

packages/core/docs/variables/isJSX.md

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

packages/core/src/jsx/jsx-detection.ts

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,6 @@ import * as VAR from "@eslint-react/var";
77
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
88
import { DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint } from "./jsx-detection-hint";
99

10-
export type TSESTreeJSX =
11-
| TSESTree.JSXAttribute
12-
| TSESTree.JSXClosingElement
13-
| TSESTree.JSXClosingFragment
14-
| TSESTree.JSXElement
15-
| TSESTree.JSXEmptyExpression
16-
| TSESTree.JSXExpressionContainer
17-
| TSESTree.JSXFragment
18-
| TSESTree.JSXIdentifier
19-
| TSESTree.JSXMemberExpression
20-
| TSESTree.JSXNamespacedName
21-
| TSESTree.JSXOpeningElement
22-
| TSESTree.JSXOpeningFragment
23-
| TSESTree.JSXSpreadAttribute
24-
| TSESTree.JSXSpreadChild
25-
| TSESTree.JSXText;
26-
27-
export const isJSX = AST.isOneOf([
28-
T.JSXAttribute,
29-
T.JSXClosingElement,
30-
T.JSXClosingFragment,
31-
T.JSXElement,
32-
T.JSXEmptyExpression,
33-
T.JSXExpressionContainer,
34-
T.JSXFragment,
35-
T.JSXIdentifier,
36-
T.JSXMemberExpression,
37-
T.JSXNamespacedName,
38-
T.JSXOpeningElement,
39-
T.JSXOpeningFragment,
40-
T.JSXSpreadAttribute,
41-
T.JSXSpreadChild,
42-
T.JSXText,
43-
]);
4410
/**
4511
* Check if a node is a `JSXText` or a `Literal` node
4612
* @param node The AST node to check
@@ -65,7 +31,7 @@ export function isJsxLike(
6531
hint: JSXDetectionHint = DEFAULT_JSX_DETECTION_HINT,
6632
): boolean {
6733
if (node == null) return false;
68-
if (isJSX(node)) return true;
34+
if (AST.isJSX(node)) return true;
6935
switch (node.type) {
7036
case T.Literal: {
7137
switch (typeof node.value) {

packages/plugins/eslint-plugin-react-x/src/rules/no-nested-lazy-component-declarations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
6565

6666
for (const lazy of lazyComponentDeclarations) {
6767
const significantParent = AST.findParentNode(lazy, (n) => {
68-
if (ER.isJSX(n)) return true;
68+
if (AST.isJSX(n)) return true;
6969
if (n.type === T.CallExpression) {
7070
return ER.isReactHookCall(n) || ER.isCreateElementCall(context, n) || ER.isCreateContextCall(context, n);
7171
}

packages/utilities/ast/src/is.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unused-vars */
21
import type { TSESTree } from "@typescript-eslint/utils";
32
import { or } from "@eslint-react/eff";
43
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
@@ -70,9 +69,14 @@ export const isJSXElement = is(T.JSXElement);
7069

7170
export const isJSXFragment = is(T.JSXFragment);
7271

72+
export const isJSXTagNameExpression = isOneOf([
73+
T.JSXIdentifier,
74+
T.JSXMemberExpression,
75+
T.JSXNamespacedName,
76+
]);
77+
7378
export const isJSX = isOneOf([
7479
T.JSXAttribute,
75-
T.JSXSpreadChild,
7680
T.JSXClosingElement,
7781
T.JSXClosingFragment,
7882
T.JSXElement,
@@ -89,12 +93,6 @@ export const isJSX = isOneOf([
8993
T.JSXText,
9094
]);
9195

92-
export const isJSXTagNameExpression = isOneOf([
93-
T.JSXIdentifier,
94-
T.JSXMemberExpression,
95-
T.JSXNamespacedName,
96-
]);
97-
9896
export const isDestructuringPattern = isOneOf([
9997
T.ArrayPattern,
10098
T.AssignmentPattern,

0 commit comments

Comments
 (0)