Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat(eslint-plugin): [no-floating-promises] disable checkThenables by default for v8 #9559

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions 4 packages/eslint-plugin/docs/rules/no-floating-promises.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ await createMyThenable();
</TabItem>
</Tabs>

:::info
This option is enabled by default in v7 but will be turned off by default in v8.
:::

### `ignoreVoid`

This option, which is `true` by default, allows you to stop the rule reporting promises consumed with void operator.
Expand Down
2 changes: 1 addition & 1 deletion 2 packages/eslint-plugin/src/rules/no-floating-promises.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default createRule<Options, MessageId>({
{
allowForKnownSafeCalls: readonlynessOptionsDefaults.allow,
allowForKnownSafePromises: readonlynessOptionsDefaults.allow,
checkThenables: true,
checkThenables: false,
ignoreIIFE: false,
ignoreVoid: true,
},
Expand Down
24 changes: 9 additions & 15 deletions 24 packages/eslint-plugin/tests/rules/no-floating-promises.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,25 +770,19 @@ createSafePromise();
},
],
},
{
code: `
declare const createPromise: () => PromiseLike<number>;
createPromise();
`,
options: [{ checkThenables: false }],
},
{
code: `
`
declare const createPromiseLike: () => PromiseLike<number>;
createPromiseLike();
`,
`
interface MyThenable {
then(onFulfilled: () => void, onRejected: () => void): MyThenable;
}

declare function createMyThenable(): MyThenable;

createMyThenable();
`,
options: [{ checkThenables: false }],
},
`,
],

invalid: [
Expand Down Expand Up @@ -2104,6 +2098,7 @@ async function test() {
],
},
],
options: [{ checkThenables: true }],
},
{
code: `
Expand Down Expand Up @@ -3586,6 +3581,7 @@ promise;
options: [
{
allowForKnownSafePromises: [{ from: 'file', name: 'SafeThenable' }],
checkThenables: true,
},
],
errors: [
Expand Down Expand Up @@ -3962,7 +3958,6 @@ void createPromise();
],
},
],
options: [{ checkThenables: false }],
},
{
code: `
Expand All @@ -3986,7 +3981,6 @@ void createMyPromise();
],
},
],
options: [{ checkThenables: false }],
},
{
code: `
Expand Down Expand Up @@ -4014,7 +4008,7 @@ void createMyPromise();
],
},
],
options: [{ checkThenables: false }],
options: [{ checkThenables: true }],
},
],
});
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.