Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit fa0d0ce

Browse files
committed
Add rule @typescript-eslint/await-thenable
1 parent 32dd4e6 commit fa0d0ce

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Disallows awaiting a value that is not a Thenable.
5+
*
6+
* @see [await-thenable](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md)
7+
*/
8+
export type AwaitThenableRuleConfig = RuleConfig<[]>;
9+
10+
/**
11+
* Disallows awaiting a value that is not a Thenable.
12+
*
13+
* @see [await-thenable](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md)
14+
*/
15+
export interface AwaitThenableRule {
16+
/**
17+
* Disallows awaiting a value that is not a Thenable.
18+
*
19+
* @see [await-thenable](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md)
20+
*/
21+
'@typescript-eslint/await-thenable': AwaitThenableRuleConfig;
22+
}

src/rules/typescript-eslint/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { AdjacentOverloadSignaturesRule } from './adjacent-overload-signatures';
22
import type { ArrayTypeRule } from './array-type';
3+
import type { AwaitThenableRule } from './await-thenable';
34
import type { BanTsCommentRule } from './ban-ts-comment';
45
import type { ExplicitFunctionReturnTypeRule } from './explicit-function-return-type';
56
import type { InterfaceNamePrefixRule } from './interface-name-prefix';
@@ -20,6 +21,7 @@ import type { TypedefRule } from './typedef';
2021
*/
2122
export type TypeScriptEslintRules = AdjacentOverloadSignaturesRule &
2223
ArrayTypeRule &
24+
AwaitThenableRule &
2325
BanTsCommentRule &
2426
ExplicitFunctionReturnTypeRule &
2527
InterfaceNamePrefixRule &

0 commit comments

Comments
 (0)