🔨 set up eslint rule to error on dangling promises + fix 245 violations
With the introduction of a more rigorous use of transactions, dangling promises have become more problematic. It used to the be the case that if a promise was not awaited in an api route handler, node would just wait for it to complete. But since we now open transaction scopes in the route handlers, it can happen that a the router handler finishes and closes a transaction and then the dangling promise continues and tries to access the db via that transaction which then leads to an error and crashes the admin.
This PR enables an ESLint rule that makes unhandled promises an error. You can either await the result, or, for cases where you genuinely do not need to await the promise, mark the promise as intentionally not awaited by prefixing it with the JS void operator.
This PR then fixes all the ~250 places that this eslint rule complained about
-
#3396
-
#3391
-
#3385
-
#3360
-
#3359
-
#3358
👈 -
#3299
: 1 other dependent PR (#3372
) -
#3298
-
#3293
-
#3292
-
#3271
-
#3259
-
#3258
-
master
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @danyx23 and the rest of your teammates on
Graphite