src/content/docs/linter/rules/use-await-thenable.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: :::note This rule belongs to the types domain. This means that its activation will activate the Biome Scanner to scan the files of your project, and enable the type inference engine. Read more about it in the [documentation page](/linter/domains#types) ::: ## Summary - Rule available since: `v2.3.9` - Diagnostic Category: [`lint/nursery/useAwaitThenable`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - This rule belongs to the following domains: - [`types`](/linter/domains#types) - Sources: - Inspired from [`@typescript-eslint/use-await-thenable`](https://typescript-eslint.io/rules/use-await-thenable){
"linter": {
"rules": {
"nursery": {
"useAwaitThenable": "error"
}
}
}
}
Enforce that await is only used on Promise values.
:::caution
At the moment, this rule only checks for instances of the global
Promise class. This is a major shortcoming compared to the ESLint
rule if you are using custom Promise-like implementations such as
Bluebird or in-house solutions.
:::
await 'value';
const createValue = () => 'value';
await createValue();
await Promise.resolve('value');
const createValue = async () => 'value';
await createValue();