Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ impl Rule for PreferAwaitToThen {
}
}

ctx.diagnostic(prefer_wait_to_then_diagnostic(call_expr.span));
let span = call_expr
.callee
.as_member_expression()
.and_then(oxc_ast::ast::MemberExpression::static_property_info)
.map_or(call_expr.span, |(span, _)| span);
ctx.diagnostic(prefer_wait_to_then_diagnostic(span));
}
}

Expand Down
52 changes: 26 additions & 26 deletions crates/oxc_linter/src/snapshots/promise_prefer_await_to_then.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,79 @@
source: crates/oxc_linter/src/tester.rs
---
⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:22]
1 │ function foo() { hey.then(x => {}) }
· ─────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:43]
1 │ function foo() { hey.then(function() { }).then() }
· ───────────────────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:22]
1 │ function foo() { hey.then(function() { }).then() }
· ────────────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:51]
1 │ function foo() { hey.then(function() { }).then(x).catch() }
· ────────────────────────────────────────
· ─────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:43]
1 │ function foo() { hey.then(function() { }).then(x).catch() }
· ────────────────────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:22]
1 │ function foo() { hey.then(function() { }).then(x).catch() }
· ────────────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:22]
╭─[prefer_await_to_then.tsx:1:47]
1 │ async function a() { hey.then(function() { }).then(function() { }) }
· ─────────────────────────────────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:22]
╭─[prefer_await_to_then.tsx:1:26]
1 │ async function a() { hey.then(function() { }).then(function() { }) }
· ────────────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:22]
1 │ function foo() { hey.catch(x => {}) }
· ──────────────────
· ─────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:18]
╭─[prefer_await_to_then.tsx:1:22]
1 │ function foo() { hey.finally(x => {}) }
· ────────────────────
· ───────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:1]
╭─[prefer_await_to_then.tsx:1:13]
1 │ something().then(async () => await somethingElse())
· ───────────────────────────────────────────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:30]
╭─[prefer_await_to_then.tsx:1:38]
1 │ async function foo() { await thing().then() }
· ──────────────
· ────
╰────

⚠ eslint-plugin-promise(prefer-await-to-then): Prefer await to then()/catch()/finally()
╭─[prefer_await_to_then.tsx:1:24]
╭─[prefer_await_to_then.tsx:1:32]
1 │ async function foo() { thing().then() }
· ──────────────
· ────
╰────
Loading