Skip to content

feat(eslint-plugin): [no-floating-promises] add 'allowForKnownSafeCalls' option #9234

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

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Jun 3, 2024

PR Checklist

Overview

Uses the same format and plumbing as the existing allowForKnownSafePromises (#7008 -> #9186). The actual changes are pretty straightforward as a result.

Note that this doesn't yet add node:test support, as that's blocked by #6861. I plan on sending a followup PR after this one goes in to fix that - using Program.sourceFileToPackageName if we really need.

Sending to the v8 branch instead of main because there are some project service fixes in there that this relies on. Example errors from targeting the main branch: https://github.com/typescript-eslint/typescript-eslint/actions/runs/9355798709/job/25751928593?pr=9234#logs. Update: or maybe those are also in v8. More investigation required.

💖

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Jun 3, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit ed8b7d9
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6660ddf11fdc350008020103
😎 Deploy Preview https://deploy-preview-9234--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (🔴 down 2 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 90 (🔴 down 8 from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

nx-cloud bot commented Jun 3, 2024

</TabItem>
<TabItem value="✅ Correct">

```ts option='{"allowForKnownSafePromiseReturns":[{"from":"file","name":"safe","path":"input.ts"}]}' skipValidation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipValidation

This was a fun one to discover:

  • The playground uses input.ts
  • docs.test.ts uses file.ts

I'm stepping out, but separate from this PR we should fix the two to be in sync.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoshuaKGoldberg JoshuaKGoldberg removed the request for review from kirkwaiblinger June 3, 2024 19:15
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft June 3, 2024 19:15
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review June 4, 2024 19:48
@JoshuaKGoldberg JoshuaKGoldberg requested review from kirkwaiblinger and a team June 4, 2024 19:48
Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple questions, no significant concerns.

@JoshuaKGoldberg JoshuaKGoldberg changed the title feat(eslint-plugin): [no-floating-promises] add 'allowForKnownSafePromiseReturns' option feat(eslint-plugin): [no-floating-promises] add 'allowForKnownSafeCalls' option Jun 5, 2024
Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just requesting a second look at https://github.com/typescript-eslint/typescript-eslint/pull/9234/files#r1626760319 before it's good to go 🙂

Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doge

@kirkwaiblinger kirkwaiblinger added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Jun 5, 2024
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.49%. Comparing base (b4fbf6d) to head (ed8b7d9).
Report is 1 commits behind head on v8.

Additional details and impacted files
@@            Coverage Diff             @@
##               v8    #9234      +/-   ##
==========================================
- Coverage   87.52%   87.49%   -0.04%     
==========================================
  Files         387      386       -1     
  Lines       13197    13162      -35     
  Branches     3822     3814       -8     
==========================================
- Hits        11551    11516      -35     
  Misses       1349     1349              
  Partials      297      297              
Flag Coverage Δ
unittest 87.49% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...es/eslint-plugin/src/rules/no-floating-promises.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@JoshuaKGoldberg JoshuaKGoldberg merged commit 8e95924 into typescript-eslint:v8 Jun 8, 2024
65 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2024
@JoshuaKGoldberg JoshuaKGoldberg deleted the no-floating-promises-allow-for-known-safe-promise-returns branch July 5, 2024 22:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: [no-floating-promises] add an 'allowForKnownSafeCalls' option
2 participants