Hello π, thank you for this great plugin :)
I have a case where I create a Promise
on the top-level and assign it to a variable. Later, in an asynchronous function, I await the promise:
const preparationDone = prepareSomething();
export async function doSomethingThatNeedsPerparation() {
await preparationDone;
// ...
}
The motivation behind this is as follows: I don't want to use top-level await because I don't want to slow down the evaluation of the module scope. The result of the Promise must only be available at the time when the asynchronous function is executed.
Would it therefore be possible not to report cases in which the Promise is assigned to a variable?
run().catch(error => {
console.error(error);
process.exit(1);
});
const resultOfRun = run();
I know that the rule might be "too relaxed" in that case, but I still think that my use case is valid and should not reported as an anti-pattern :)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too