8000 refactor(eslint-plugin): use direct ts type guards instead of tsutils… · omril1/typescript-eslint@9ed3c50 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ed3c50

Browse files
authored
refactor(eslint-plugin): use direct ts type guards instead of tsutils (typescript-eslint#3193)
1 parent 7b6f2ab commit 9ed3c50

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

packages/eslint-plugin/src/rules/no-floating-promises.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function isFunctionParam(
227227

228228
function isPromiseCatchCallWithHandler(expression: ts.CallExpression): boolean {
229229
return (
230-
tsutils.isPropertyAccessExpression(expression.expression) &&
230+
ts.isPropertyAccessExpression(expression.expression) &&
231231
expression.expression.name.text === 'catch' &&
232232
expression.arguments.length >= 1
233233
);
@@ -237,7 +237,7 @@ function isPromiseThenCallWithRejectionHandler(
237237
expression: ts.CallExpression,
238238
): boolean {
239239
return (
240-
tsutils.isPropertyAccessExpression(expression.expression) &&
240+
ts.isPropertyAccessExpression(expression.expression) &&
241241
expression.expression.name.text === 'then' &&
242242
expression.arguments.length >= 2
243243
);
@@ -247,7 +247,7 @@ function isPromiseFinallyCallWithHandler(
247247
expression: ts.CallExpression,
248248
): boolean {
249249
return (
250-
tsutils.isPropertyAccessExpression(expression.expression) &&
250+
ts.isPropertyAccessExpression(expression.expression) &&
251251
expression.expression.name.text === 'finally' &&
252252
expression.arguments.length >= 1
253253
);

packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function getTypeParametersFromType(
118118
}
119119

120120
return findFirstResult(declarations, decl =>
121-
tsutils.isClassLikeDeclaration(decl) ||
121+
ts.isClassLike(decl) ||
122122
ts.isTypeAliasDeclaration(decl) ||
123123
ts.isInterfaceDeclaration(decl)
124124
? decl.typeParameters

packages/eslint-plugin/src/rules/return-await.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default util.createRule({
6161
let ancestor = node.parent;
6262

6363
while (ancestor && !ts.isFunctionLike(ancestor)) {
64-
if (tsutils.isTryStatement(ancestor)) {
64+
if (ts.isTryStatement(ancestor)) {
6565
return true;
6666
}
6767

@@ -75,7 +75,7 @@ export default util.createRule({
7575
let ancestor = node.parent;
7676

7777
while (ancestor && !ts.isFunctionLike(ancestor)) {
78-
if (tsutils.isCatchClause(ancestor)) {
78+
if (ts.isCatchClause(ancestor)) {
7979
return true;
8080
}
8181

@@ -90,8 +90,8 @@ export default util.createRule({
9090

9191
while (ancestor && !ts.isFunctionLike(ancestor)) {
9292
if (
93-
tsutils.isTryStatement(ancestor.parent) &&
94-
tsutils.isBlock(ancestor) &&
93+
ts.isTryStatement(ancestor.parent) &&
94+
ts.isBlock(ancestor) &&
9595
ancestor.parent.end === ancestor.end
9696
) {
9797
return true;
@@ -106,7 +106,7 @@ export default util.createRule({
106106
let ancestor = node.parent;
107107

108108
while (ancestor && !ts.isFunctionLike(ancestor)) {
109-
if (tsutils.isTryStatement(ancestor)) {
109+
if (ts.isTryStatement(ancestor)) {
110110
return !!ancestor.finallyBlock;
111111
}
112112
ancestor = ancestor.parent;
@@ -154,7 +154,7 @@ export default util.createRule({
154154
function test(node: TSESTree.Expression, expression: ts.Node): void {
155155
let child: ts.Node;
156156

157-
const isAwait = tsutils.isAwaitExpression(expression);
157+
const isAwait = ts.isAwaitExpression(expression);
158158

159159
if (isAwait) {
160160
child = expression.getChildAt(1);

0 commit comments

Comments
 (0)
0