We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ef93ea commit d47e3b0Copy full SHA for d47e3b0
crates/oxc_linter/src/rules/promise/prefer_await_to_then.rs
@@ -82,7 +82,11 @@ impl Rule for PreferAwaitToThen {
82
return;
83
};
84
85
- if is_promise_with_context(call_expr, ctx).is_none_or(|v| v == "withResolvers") {
+ let Some(method_name) = is_promise_with_context(call_expr, ctx) else {
86
+ return;
87
+ };
88
+
89
+ if !matches!(method_name.as_str(), "then" | "catch" | "finally") {
90
91
}
92
@@ -114,6 +118,12 @@ fn test() {
114
118
("async function hi() { await thing() }", None),
115
119
("async function hi() { await thing().then() }", None),
116
120
("async function hi() { await thing().catch() }", None),
121
+ ("const x = Promise.resolve(42)", None),
122
+ ("const x = Promise.reject(error)", None),
123
+ ("const x = Promise.all(values)", None),
124
+ ("const x = Promise.allSettled(values)", None),
125
+ ("const x = Promise.any(values)", None),
126
+ ("const x = Promise.race(values)", None),
117
127
("a = async () => (await something())", None),
128
(
129
"a = async () => {
0 commit comments