passsy / prefer-await-over-removing-asyncr2
Add missing await rather than removing async
PublicFix async_return_with_no_await by adding the missing await and keeping async, because the next change will likely need another await anyway.
tests, run by the registry9 passed · slowest 0.9 ms
✓fires0.9 ms
fires on the exact diagnostic in a prompt, outside a Dart project
promptfired: "async_return_with_no_await"
Please fix async_return_with_no_await.✓fires0.8 ms
fires on the diagnostic in a file the agent writes
write lint-output.txtfired: "async_return_with_no_await"
info - lib/a.dart:2:3 - async_return_with_no_await✓fires0.8 ms
fires on the diagnostic in a file the agent reads
read analyze.logfired: "async_return_with_no_await"
info - lib/a.dart:2:3 - async_return_with_no_await✓quiet0.7 ms
stays quiet on async
promptstayed quiet
async✓quiet0.8 ms
stays quiet on await
promptstayed quiet
await✓quiet0.8 ms
stays quiet on unnecessary_async
promptstayed quiet
unnecessary_async✓quiet0.8 ms
stays quiet on async_return_with_no_await_extra
promptstayed quiet
async_return_with_no_await_extra✓quiet0.7 ms
stays quiet on not_async_return_with_no_await
promptstayed quiet
not_async_return_with_no_await✓skips0.0 ms
is not listening to commands
commandno handler of the detector wants this event
echo async_return_with_no_awaitdetector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { command, detect, prompt, read, write } from "@wellactually/sdk/v3/test";
const expected = [{ match: "async_return_with_no_await", depth: "pointer" }];
test("fires on the exact diagnostic in a prompt, outside a Dart project", () => {
expect(detect(prompt("Please fix async_return_with_no_await."))).toEqual(expected);
});
test("fires on the diagnostic in a file the agent writes", () => {
expect(detect(write("lint-output.txt", "info - lib/a.dart:2:3 - async_return_with_no_await"))).toEqual(expected);
});
test("fires on the diagnostic in a file the agent reads", () => {
expect(detect(read("analyze.log", "info - lib/a.dart:2:3 - async_return_with_no_await"))).toEqual(expected);
});
test.each(["async", "await", "unnecessary_async", "async_return_with_no_await_extra", "not_async_return_with_no_await"])("stays quiet on %s", (text) => {
expect(detect(prompt(text))).toEqual([]);
});
test("is not listening to commands", () => {
expect(detect(command("echo async_return_with_no_await"))).toEqual([]);
});