-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 16, 2024 13:46
5dedb67
to
9e2a897
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
2 times, most recently
from
March 16, 2024 14:00
b4aa5dc
to
5a640e2
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 16, 2024 17:18
43f3e8f
to
f7d9953
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
2 times, most recently
from
March 16, 2024 17:31
0366771
to
34fca5b
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 18, 2024 18:59
c5a2b89
to
0ca18ae
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 18, 2024 18:59
f078be0
to
78bb8aa
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 19, 2024 16:02
0ca18ae
to
23dccc3
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 19, 2024 16:02
78bb8aa
to
29b9ac2
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 20, 2024 10:05
23dccc3
to
713d246
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 20, 2024 10:05
29b9ac2
to
b8f843c
Compare
Merged
ikesau
approved these changes
Mar 20, 2024
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 20, 2024 20:31
b8f843c
to
849b260
Compare
This was referenced Mar 20, 2024
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 21, 2024 22:22
bf7385a
to
8c6f6ac
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 21, 2024 22:22
849b260
to
9c83b2b
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 23, 2024 15:34
8c6f6ac
to
575b97e
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 23, 2024 15:34
9c83b2b
to
9b21d17
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 25, 2024 11:26
575b97e
to
86ce847
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 25, 2024 11:26
9b21d17
to
049b0d1
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 26, 2024 11:44
86ce847
to
eb9cbd7
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 26, 2024 11:44
049b0d1
to
f754031
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 26, 2024 13:08
eb9cbd7
to
3a05c68
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 26, 2024 13:08
f754031
to
95652fc
Compare
danyx23
force-pushed
the
db-migrate-gdocs
branch
from
March 26, 2024 14:16
3a05c68
to
5e0e462
Compare
danyx23
force-pushed
the
eslint-no-floating-promises
branch
from
March 26, 2024 14:19
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