-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
chore: let @typescript-eslint/require-await
ESLint rule pass
#7123
base: dev
Are you sure you want to change the base?
chore: let @typescript-eslint/require-await
ESLint rule pass
#7123
Conversation
|
Err, I can't tell if the CI failures on Firefox are a result of the changes in this PR. #7133 shows similar failures. Marking as ready for review on a hunch that they're unrelated. |
d8c0e5c
to
f705613
Compare
This seems ok to me but I'm going to defer to @pcattori for an approval because it touches a lot of stuff in the dev server |
Hey @JoshuaKGoldberg , thanks for your work on this! This PR went up right when we started focusing on shipping v2, so hasn't yet gotten the attention it deserves. But hoping to change that now! One thing that I don't like about this new lint rule is that it feels like the function signature/interface is now coupled to its implementation. So let's say we find a way to make an I think there are also times where I want to model something as potentially being async, knowing that my implementation of it may change day-to-day. But it is on plugin:@typescript-eslint/recommended-type-checked and I probably haven't thought through this as deeply as those folks. tl;dr: If you want to rebase this PR on latest |
1e75f10
to
f705613
Compare
Sibling PR to @ngbrown's excellent #6325 -> #6331. I noticed
@typescript-eslint/require-await
wasn't in the list, and it's in the newplugin:@typescript-eslint/recommended-type-checked
preset.@typescript-eslint/require-await
disallows async functions which have no await expression. This is nice becauseasync
adds an extra bit of work to the function (returns aPromise
instead of a direct value).Separately, I've also noticed a trend in the React ecosystem of APIs requiring functions return a
Promise
even when they wouldn't always want to. That's in direct conflict with this rule. Enabling the rule in frameworks helps ensure frameworks aren't in conflict: by either making necessary changes to the rule and/or blocking conflict-y things in the frameworks.