Skip to content

Commit 11e1b1f

Browse files
committed
refactor(await-async-query): rename isPromiseResolved to hasChainedThen
1 parent e0a8e42 commit 11e1b1f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/node-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export function isAwaited(node: TSESTree.Node): boolean {
200200
);
201201
}
202202

203-
export function isPromiseResolved(node: TSESTree.Node): boolean {
203+
export function hasChainedThen(node: TSESTree.Node): boolean {
204204
const parent = node.parent;
205205

206206
// wait(...).then(...)
@@ -247,7 +247,7 @@ export function isPromiseHandled(nodeIdentifier: TSESTree.Identifier): boolean {
247247
return true;
248248
}
249249

250-
if (isPromiseResolved(node)) {
250+
if (hasChainedThen(node)) {
251251
return true;
252252
}
253253
}

lib/rules/await-async-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { getDocsUrl, ASYNC_UTILS, LIBRARY_MODULES } from '../utils';
88
import {
99
isAwaited,
10-
isPromiseResolved,
10+
hasChainedThen,
1111
getVariableReferences,
1212
isMemberExpression,
1313
isImportSpecifier,
@@ -121,7 +121,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
121121
references &&
122122
references.length === 0 &&
123123
!isAwaited(node.parent.parent) &&
124-
!isPromiseResolved(node) &&
124+
!hasChainedThen(node) &&
125125
!isInPromiseAll(node)
126126
) {
127127
context.report({
@@ -136,7 +136,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
136136
const referenceNode = reference.identifier;
137137
if (
138138
!isAwaited(referenceNode.parent) &&
139-
!isPromiseResolved(referenceNode)
139+
!hasChainedThen(referenceNode)
140140
) {
141141
context.report({
142142
node,

lib/rules/await-fire-event.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ASTUtils,
55
} from '@typescript-eslint/experimental-utils';
66
import { getDocsUrl } from '../utils';
7-
import { isAwaited, isPromiseResolved } from '../node-utils';
7+
import { isAwaited, hasChainedThen } from '../node-utils';
88

99
export const RULE_NAME = 'await-fire-event';
1010
export type MessageIds = 'awaitFireEvent';
@@ -37,7 +37,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
3737
if (
3838
ASTUtils.isIdentifier(fireEventMethodNode) &&
3939
!isAwaited(node.parent.parent.parent) &&
40-
!isPromiseResolved(fireEventMethodNode.parent)
40+
!hasChainedThen(fireEventMethodNode.parent)
4141
) {
4242
context.report({
4343
node: fireEventMethodNode,

0 commit comments

Comments
 (0)