-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔨 set up eslint rule to error on dangling promises + fix 245 violations #3358
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Mar 16, 2024
Merged
This was referenced Mar 16, 2024
5dedb67
to
9e2a897
Compare
b4aa5dc
to
5a640e2
Compare
43f3e8f
to
f7d9953
Compare
0366771
to
34fca5b
Compare
c5a2b89
to
0ca18ae
Compare
f078be0
to
78bb8aa
Compare
0ca18ae
to
23dccc3
Compare
78bb8aa
to
29b9ac2
Compare
23dccc3
to
713d246
Compare
29b9ac2
to
b8f843c
Compare
Merged
ikesau
approved these changes
Mar 20, 2024
b8f843c
to
849b260
Compare
This was referenced Mar 20, 2024
bf7385a
to
8c6f6ac
Compare
849b260
to
9c83b2b
Compare
8c6f6ac
to
575b97e
Compare
9c83b2b
to
9b21d17
Compare
575b97e
to
86ce847
Compare
9b21d17
to
049b0d1
Compare
86ce847
to
eb9cbd7
Compare
049b0d1
to
f754031
Compare
eb9cbd7
to
3a05c68
Compare
f754031
to
95652fc
Compare
3a05c68
to
5e0e462
Compare
95652fc
to
acbfb58
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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