You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added the nursery rule [`useAwaitThenable`](https://biomejs.dev/linter/rules/use-await-thenable/), which enforces that `await` is only used on Promise values.
6
+
7
+
#### Invalid
8
+
9
+
```js
10
+
await'value';
11
+
12
+
constcreateValue= () =>'value';
13
+
awaitcreateValue();
14
+
```
15
+
16
+
#### Caution
17
+
18
+
This is a first iteration of the rule, and does not yet detect generic ["thenable"](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables) values.
use biome_rule_options::use_await_thenable::UseAwaitThenableOptions;
8
+
9
+
usecrate::services::typed::Typed;
10
+
11
+
declare_lint_rule!{
12
+
/// Enforce that `await` is _only_ used on `Promise` values.
13
+
///
14
+
/// :::caution
15
+
/// At the moment, this rule only checks for instances of the global
16
+
/// `Promise` class. This is a major shortcoming compared to the ESLint
17
+
/// rule if you are using custom `Promise`-like implementations such as
18
+
/// [Bluebird](http://bluebirdjs.com/) or in-house solutions.
"This may happen if you accidentally used `await` on a synchronous value."
82
+
})
83
+
.note(markup!{
84
+
"Please ensure the value is not a custom \"thenable\" implementation before removing the `await`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables"
i This may happen if you accidentally used `await` on a synchronous value.
30
+
31
+
i Please ensure the value is not a custom "thenable" implementation before removing the `await`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables
i This may happen if you accidentally used `await` on a synchronous value.
47
+
48
+
i Please ensure the value is not a custom "thenable" implementation before removing the `await`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables
0 commit comments