Open sigmaSd opened 9 months ago
I wrote the code for this, check it out here https://github.com/denoland/deno_lint/compare/main...sigmaSd:lintup?expand=1
It seems I hit a fatal flow unfortantnly
this gets linted correctly
function foo() {
Deno.readTextFileSync("");
}"
async function foo2() {
foo()
}
but this doesn't
async function foo2() {
foo()
}
function foo() {
Deno.readTextFileSync("");
}"
because the parsing is done from top to bottom, when we reach foo inside foo2 we don't know its a blocking call yet.
Any ideas ? can I somehow parse twice ?
Ofc I can just traverse the ast twice.
@sigmaSd yes, you can traverse the AST twice in this specific rule
Thanks @bartlomieju I already do that in this pr https://github.com/denoland/deno_lint/pull/1199#issuecomment-1742322101
It seems to work but I'm not really confortable with the code base, would be great if you review it
currently
no-sync-fn-in-async-fn
can't catch this:I thought maybe its possible to catch even this: for example we can consider each function that have inside it a deno Sync api a blocking function, and save it on a list and now each time we see it we also consider the parent blocking and so on, and now if we see one of these in an async context we emit a warning.
Do you think this is a reasonable idea ?