Skip to content
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

fix(eslint-plugin): added safe getTypeOfPropertyOfType wrapper #2567

Conversation

JoshuaKGoldberg
Copy link
Member

Fixes #2143. A quick find-all on getTypeOfPropertyOfType showed that the bug might also be able to pop up in no-unnecessary-condition as well.

@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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@bradzacher
Copy link
Member

We should add a lint rule for this to warn against using the method directly.

Could expand this internal lint rule to cover it:

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts

@bradzacher bradzacher added the bug Something isn't working label Sep 15, 2020
@JoshuaKGoldberg
Copy link
Member Author

TBD whether this original approach works, but it would also be nice to not use an internal TypeScript compiler API... I'd be interested in looking at that too.

@codecov
Copy link

codecov bot commented Sep 15, 2020

Codecov Report

Merging #2567 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2567      +/-   ##
==========================================
- Coverage   92.82%   92.82%   -0.01%     
==========================================
  Files         290      291       +1     
  Lines        9505     9514       +9     
  Branches     2664     2666       +2     
==========================================
+ Hits         8823     8831       +8     
  Misses        323      323              
- Partials      359      360       +1     
Flag Coverage Δ
#unittest 92.82% <ø> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...slint-plugin/src/rules/no-unnecessary-condition.ts 97.14% <ø> (ø)
packages/eslint-plugin/src/util/isTypeReadonly.ts 97.01% <ø> (ø)
packages/eslint-plugin/src/util/propertyTypes.ts 88.88% <ø> (ø)

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review September 15, 2020 19:37
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for fixing this!

@bradzacher bradzacher merged commit 7cba2de into typescript-eslint:master Sep 27, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2020
@JoshuaKGoldberg JoshuaKGoldberg deleted the get-type-of-property-of-type-safe branch November 17, 2021 07:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[prefer-readonly-parameter-types] unique symbols as interface keys causes eslint to crash
2 participants