|
| 1 | +import type { RuleConfig } from '../rule-config'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Option. |
| 5 | + */ |
| 6 | +export type NoFloatingPromisesOption = { |
| 7 | + /** |
| 8 | + * This allows you to stop the rule reporting promises consumed with void operator. This can be a good way to explicitly mark a promise as intentionally not awaited. |
| 9 | + * |
| 10 | + * @default true |
| 11 | + * |
| 12 | + * @see [ignoreVoid](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md#ignorevoid) |
| 13 | + */ |
| 14 | + ignoreVoid?: boolean; |
| 15 | + /** |
| 16 | + * This allows you to skip checking of async iife. |
| 17 | + * |
| 18 | + * @default false |
| 19 | + * |
| 20 | + * @see [ignoreIIFE](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md#ignoreiife) |
| 21 | + */ |
| 22 | + ignoreIIFE?: boolean; |
| 23 | +}; |
| 24 | + |
| 25 | +/** |
| 26 | + * Options. |
| 27 | + */ |
| 28 | +export type NoFloatingPromisesOptions = [NoFloatingPromisesOption?]; |
| 29 | + |
| 30 | +/** |
| 31 | + * Requires Promise-like values to be handled appropriately. |
| 32 | + * |
| 33 | + * This rule forbids usage of Promise-like values in statements without handling their errors appropriately. |
| 34 | + * Unhandled promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections and more. |
| 35 | + * Valid ways of handling a Promise-valued statement include awaiting, returning, and either calling `.then()` with two arguments or `.catch()` with one argument. |
| 36 | + * |
| 37 | + * @see [no-floating-promises](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md) |
| 38 | + */ |
| 39 | +export type NoFloatingPromisesRuleConfig = RuleConfig<NoFloatingPromisesOptions>; |
| 40 | + |
| 41 | +/** |
| 42 | + * Requires Promise-like values to be handled appropriately. |
| 43 | + * |
| 44 | + * This rule forbids usage of Promise-like values in statements without handling their errors appropriately. |
| 45 | + * Unhandled promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections and more. |
| 46 | + * Valid ways of handling a Promise-valued statement include awaiting, returning, and either calling `.then()` with two arguments or `.catch()` with one argument. |
| 47 | + * |
| 48 | + * @see [no-floating-promises](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md) |
| 49 | + */ |
| 50 | +export interface NoFloatingPromisesRule { |
| 51 | + /** |
| 52 | + * Requires Promise-like values to be handled appropriately. |
| 53 | + * |
| 54 | + * This rule forbids usage of Promise-like values in statements without handling their errors appropriately. |
| 55 | + * Unhandled promises can cause several issues, such as improperly sequenced operations, ignored Promise rejections and more. |
| 56 | + * Valid ways of handling a Promise-valued statement include awaiting, returning, and either calling `.then()` with two arguments or `.catch()` with one argument. |
| 57 | + * |
| 58 | + * @see [no-floating-promises](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md) |
| 59 | + */ |
| 60 | + '@typescript-eslint/no-floating-promises': NoFloatingPromisesRuleConfig; |
| 61 | +} |
0 commit comments