Skip to content

Commit f9442ae

Browse files
committed
refactor: rename 'TSOnlyExpression' to 'TypeExpression'
1 parent 7a3c93d commit f9442ae

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

packages/plugins/eslint-plugin-react-x/src/rules/no-access-state-in-setstate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function isKeyLiteral(
3333
}
3434

3535
function getName(node: TSESTree.Expression | TSESTree.PrivateIdentifier): string | _ {
36-
if (AST.isTsOnlyExpression(node)) {
36+
if (AST.isTypeExpression(node)) {
3737
return getName(node.expression);
3838
}
3939
if (node.type === T.Identifier || node.type === T.PrivateIdentifier) {

packages/plugins/eslint-plugin-react-x/src/rules/no-direct-mutation-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const RULE_FEATURES = [
1717
export type MessageID = CamelCase<typeof RULE_NAME>;
1818

1919
function getName(node: TSESTree.Expression | TSESTree.PrivateIdentifier): string | _ {
20-
if (AST.isTsOnlyExpression(node)) {
20+
if (AST.isTypeExpression(node)) {
2121
return getName(node.expression);
2222
}
2323
if (node.type === T.Identifier || node.type === T.PrivateIdentifier) {

packages/plugins/eslint-plugin-react-x/src/rules/no-unused-class-component-members.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function isKeyLiteral(
5858
// anywhere that a literal may be used as a key (e.g., member expressions,
5959
// method definitions, ObjectExpression property keys).
6060
function getName(node: TSESTree.Expression | TSESTree.PrivateIdentifier): string | _ {
61-
if (AST.isTsOnlyExpression(node)) {
61+
if (AST.isTypeExpression(node)) {
6262
return getName(node.expression);
6363
}
6464
if (node.type === T.Identifier || node.type === T.PrivateIdentifier) {

packages/plugins/eslint-plugin-react-x/src/rules/no-unused-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function isKeyLiteral(
3333
}
3434

3535
function getName(node: TSESTree.Expression | TSESTree.PrivateIdentifier): string | _ {
36-
if (AST.isTsOnlyExpression(node)) {
36+
if (AST.isTypeExpression(node)) {
3737
return getName(node.expression);
3838
}
3939
if (node.type === T.Identifier || node.type === T.PrivateIdentifier) {

packages/utilities/ast/src/get-ecma-expression.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import type { TSESTree } from "@typescript-eslint/types";
22

3-
import { isTsOnlyExpression } from "./is";
4-
import type { TSESTreeTSOnlyExpression } from "./types";
3+
import { isTypeExpression } from "./is";
4+
import type { TSESTreeTypeExpression } from "./types";
55

66
/**
7-
* Recursively get the inner expression until it's not a TSOnlyExpression
7+
* Recursively get the inner expression until it's not a TypeExpression
88
* @param node - The node to get the expression from
99
* @returns The inner expression
1010
*/
1111
export function getEcmaExpression(node: TSESTree.Node): Exclude<
1212
TSESTree.Node,
13-
TSESTreeTSOnlyExpression
13+
TSESTreeTypeExpression
1414
> {
15-
if (isTsOnlyExpression(node)) {
15+
if (isTypeExpression(node)) {
1616
return getEcmaExpression(node.expression);
1717
}
1818
return node;

packages/utilities/ast/src/get-function-identifier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { _ } from "@eslint-react/eff";
1111
import type { TSESTree } from "@typescript-eslint/types";
1212
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
1313

14-
import { isMethodOrProperty, isTsAssertionExpression } from "./is";
14+
import { isMethodOrProperty, isTypeAssertionExpression } from "./is";
1515
import type { TSESTreeFunction } from "./types";
1616

1717
export function getFunctionIdentifier(node: TSESTree.Expression | TSESTreeFunction): TSESTree.Identifier | _ {
@@ -55,7 +55,7 @@ export function getFunctionIdentifier(node: TSESTree.Expression | TSESTreeFuncti
5555
// const MaybeComponent = (() => {})!;
5656
// const MaybeComponent = (() => {}) as FunctionComponent;
5757
// const MaybeComponent = (() => {}) satisfies FunctionComponent;
58-
case isTsAssertionExpression(node.parent):
58+
case isTypeAssertionExpression(node.parent):
5959
return getFunctionIdentifier(node.parent);
6060
}
6161
return _;

packages/utilities/ast/src/is.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ export const isLeftHandSideExpressionType = isOneOf([
154154
T.TSTypeAssertion,
155155
]);
156156

157-
export const isTsOnlyExpression = isOneOf([
157+
export const isTypeExpression = isOneOf([
158158
T.TSAsExpression,
159159
T.TSTypeAssertion,
160160
T.TSNonNullExpression,
161161
T.TSSatisfiesExpression,
162162
T.TSInstantiationExpression,
163163
]);
164164

165-
export const isTsAssertionExpression = isOneOf([
165+
export const isTypeAssertionExpression = isOneOf([
166166
T.TSAsExpression,
167167
T.TSTypeAssertion,
168168
T.TSNonNullExpression,

packages/utilities/ast/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ export type TSESTreeTypeDeclaration =
6565
| TSESTree.TSInterfaceDeclaration
6666
| TSESTree.TSTypeAliasDeclaration;
6767

68-
export type TSESTreeTSOnlyExpression =
68+
export type TSESTreeTypeExpression =
6969
| TSESTree.TSAsExpression
7070
| TSESTree.TSNonNullExpression
7171
| TSESTree.TSSatisfiesExpression
7272
| TSESTree.TSTypeAssertion
7373
| TSESTree.TSInstantiationExpression;
7474

75-
export type TSESTreeTSAssertionExpression =
75+
export type TSESTreeTypeAssertionExpression =
7676
| TSESTree.TSAsExpression
7777
| TSESTree.TSNonNullExpression
7878
| TSESTree.TSSatisfiesExpression

0 commit comments

Comments
 (0)