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.
detector.tsisolate · reads files, writes none · no network · 100 ms · 32 MBEdit
import { onPrompt, onRead, onWrite, type TextFinding } from "@wellactually/sdk/v3";
/**
* The diagnostic itself is enough context: in a prompt, or in a file the
* agent writes or reads, such as saved analyzer output. Not tied to a Dart
* project, because the name can only mean this Dart lint.
*/
onPrompt({
*detect(event) {
yield* namesDiagnostic(event.text);
},
});
onWrite({
*detect(event) {
yield* namesDiagnostic(event.text);
},
});
onRead({
*detect(event) {
yield* namesDiagnostic(event.text);
},
});
function* namesDiagnostic(text: string): Generator<TextFinding> {
const match = /(?<![\w$])async_return_with_no_await(?![\w$])/.exec(text);
if (match) {
yield { match: match[0], depth: "pointer" };
}
}
package.jsonEdit
{
"name": "prefer-await-over-removing-async",
"private": true
}