add typescript-eslint to eslint-config-next to catch floating promises#28181
Closed
kyliau wants to merge 3 commits into
Closed
add typescript-eslint to eslint-config-next to catch floating promises#28181kyliau wants to merge 3 commits into
kyliau wants to merge 3 commits into
Conversation
This commit (partially) tackles item 3 in vercel#27051: > Forgetting to await an async function inside an API route, works fine > locally but does out of band work which will cause issues if there’s > multiple requests. The work here is focused on TypeScript for now because `typescript-eslint` already provides `no-floating-promises` rule that precisely targets this scenario. This requires adding a new dependency (`@typescript-eslint/eslint-plugin`) to `eslint-config-next`. Although it is a superfluous dependency for JavaScript projects, it's not a big deal since `eslint-config-next` already has a dependency on `@typescript-eslint/parser`.
20c91cf to
e738406
Compare
Author
|
I realize our ESLint config does not setup the TS parser to use typechecker, so this won't work out of the box. |
This comment has been minimized.
This comment has been minimized.
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This commit (partially) tackles item 3 in #27051:
The work here is focused on TypeScript for now because
typescript-eslintalready provides
no-floating-promisesrule that precisely targets thisscenario.
This requires adding a new dependency (
@typescript-eslint/eslint-plugin)to
eslint-config-next. Although it is a superfluous dependency forJavaScript projects, it's not a big deal since
eslint-config-nextalreadyhas a dependency on
@typescript-eslint/parser.Bug
fixes #numbercontributing.mdFeature
fixes #numbercontributing.mdDocumentation / Examples