-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
meta(eslint-config): Don't allow voiding Promises #9814
Conversation
@lforst Can you share an example? |
size-limit report 📦
|
}); | ||
// This should never reject | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
this._worker.postMessage('clear'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sadly, this can reject 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty, does this work? 06d041a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea.
Not sure msyelf but wdyt about allowing void
ing in tests?
@Lms24 I had the same thought but for some reason I couldn't get the eslint filtering rules to properly apply so I just said "screw it im ignoring all of these"... Let me try again. |
Ok I don't think this is is easily doable because eslintrcs look from the root and in "test packages" like e2e tests there are no test folders that we can match. Test folders and test files are already excluded from this rule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I don't think this is is easily doable because eslintrcs look from the root and in "test packages" like e2e tests there are no test folders that we can match. Test folders and test files are already excluded from this rule.
makes sense, thx for trying!
@@ -21,4 +21,5 @@ async function run(): Promise<void> { | |||
} | |||
} | |||
|
|||
void run(); | |||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | |||
run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wdyt?
run(); | |
(async () => { await run() })(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will still create a floating promise
We should be a bit more strict about floating promises in the SDK. Right now we're just slapping
void
on all of them which is a bit likets-ignore
. Ideally, we are a bit more explicit about handling rejected promises or ignoring the lint rule with a description.This pr turns off the "void" option of the lint rule so that we become more explicit.