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
17 changes: 17 additions & 0 deletions crates/oxc_linter/src/rules/oxc/no_async_await.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ fn test() {
async test() {}
};
",
// FIXME: diagnostics on method `foo` have incorrect spans
"
class Foo {
async foo() {}
}
",
"
class Foo {
public async foo() {}
}
",
// this one is fine
"
const obj = {
async foo() {}
}
",
];

Tester::new(NoAsyncAwait::NAME, pass, fail).test_and_snapshot();
Expand Down
27 changes: 27 additions & 0 deletions crates/oxc_linter/src/snapshots/no_async_await.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,30 @@ source: crates/oxc_linter/src/tester.rs
4 │ };
╰────
help: Async/await is not allowed

⚠ oxc(no-async-await): Unexpected async/await
╭─[no_async_await.tsx:3:22]
2 │ class Foo {
3 │ async foo() {}
· ─────
4 │ }
╰────
help: Async/await is not allowed

⚠ oxc(no-async-await): Unexpected async/await
╭─[no_async_await.tsx:3:29]
2 │ class Foo {
3 │ public async foo() {}
· ─────
4 │ }
╰────
help: Async/await is not allowed

⚠ oxc(no-async-await): Unexpected async/await
╭─[no_async_await.tsx:3:13]
2 │ const obj = {
3 │ async foo() {}
· ─────
4 │ }
╰────
help: Async/await is not allowed