Skip to content

Commit 7d09973

Browse files
committed
fix(linter): false positive with withResolvers in prefer-await-to-then (#10896)
fixes #10895
1 parent 3cf867c commit 7d09973

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/oxc_linter/src/rules/promise/prefer_await_to_then.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Rule for PreferAwaitToThen {
7878
return;
7979
};
8080

81-
if is_promise(call_expr).is_none() {
81+
if is_promise(call_expr).is_none_or(|v| v == "withResolvers") {
8282
return;
8383
}
8484

@@ -137,6 +137,7 @@ fn test() {
137137
"async function hi() { await thing().then() }",
138138
Some(serde_json::json!({ "strict": false })),
139139
),
140+
("const { promise, resolve } = Promise.withResolvers()", None),
140141
];
141142

142143
let fail = vec![

0 commit comments

Comments
 (0)