Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(type-utils): check for type parameters on isBuiltinSymbolLikeRecurser() #10026

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

ronami
Copy link
Member

@ronami ronami commented Sep 20, 2024

PR Checklist

Overview

This PR addresses #9882 along with a similar issue for @typescript-eslint/prefer-promise-reject-errors:

// @typescript-eslint/only-throw-error
function fun1<T extends Error>(t: T): void {
  throw t;
}

// @typescript-eslint/prefer-promise-reject-errors
function fun2<T extends Error>(t: T): void {
  Promise.reject(t);
}

Since this changes a function that's being used in a lot of other places (isBuiltinSymbolLikeRecurser()), this can affect other rules (for better or worse).

Please let me know if you think this isn't the correct way to approach this.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @ronami!

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 Sep 20, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 3406cb7
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/66f116d9088d77000868211b
😎 Deploy Preview https://deploy-preview-10026--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: 99 (🟢 up 4 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 90 (no change 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.

@ronami ronami changed the title Check for type parameters on isBuiltinSymbolLikeRecurser() fix(type-utils): Check for type parameters on isBuiltinSymbolLikeRecurser() Sep 20, 2024
@ronami ronami changed the title fix(type-utils): Check for type parameters on isBuiltinSymbolLikeRecurser() fix(type-utils): check for type parameters on isBuiltinSymbolLikeRecurser() Sep 20, 2024
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 88.67%. Comparing base (c5dc755) to head (3406cb7).
Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
packages/type-utils/src/builtinSymbolLikes.ts 16.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10026      +/-   ##
==========================================
- Coverage   88.70%   88.67%   -0.03%     
==========================================
  Files         426      426              
  Lines       14835    14841       +6     
  Branches     4312     4314       +2     
==========================================
+ Hits        13159    13160       +1     
- Misses       1533     1538       +5     
  Partials      143      143              
Flag Coverage Δ
unittest 88.67% <16.66%> (-0.03%) ⬇️

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

Files with missing lines Coverage Δ
packages/type-utils/src/builtinSymbolLikes.ts 4.91% <16.66%> (+1.28%) ⬆️

@ronami ronami marked this pull request as ready for review September 20, 2024 15:47
@kirkwaiblinger
Copy link
Member

kirkwaiblinger commented Sep 20, 2024

note - this might impact #10010

@kirkwaiblinger kirkwaiblinger requested a review from a team September 20, 2024 17:48
Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@auvred auvred added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Sep 21, 2024
@ronami ronami force-pushed the check-type-parameter-is-builtin-symbol-like-recurser branch from 78a70db to 3406cb7 Compare September 23, 2024 07:20
@ronami
Copy link
Member Author

ronami commented Sep 23, 2024

I haven't looked into it yet but I don't think the codecov failure is related to my changes.

@kirkwaiblinger
Copy link
Member

I haven't looked into it yet but I don't think the codecov failure is related to my changes.

Yeah, don't worry about it 👍 This is due to #8358

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

yay!

@JoshuaKGoldberg JoshuaKGoldberg merged commit 94c5484 into typescript-eslint:main Sep 27, 2024
61 of 62 checks passed
@ronami ronami deleted the check-type-parameter-is-builtin-symbol-like-recurser branch September 27, 2024 18:56
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2024
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.

Bug: @typescript-eslint/only-throw-error False positive when throwing Error subclass
4 participants