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): always ignore assignments in no-unnecessary-type-assertion #3235

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Mar 29, 2021

Fixes #3187.

Since TypeScript is smart about inferring types for variable assignments, I think it's reasonable to always exclude the right-hand-side of assignment expressions.

@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.

@codecov
Copy link

codecov bot commented Mar 29, 2021

Codecov Report

Merging #3235 (db0e026) into master (5414bf2) will decrease coverage by 0.13%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3235      +/-   ##
==========================================
- Coverage   92.93%   92.80%   -0.14%     
==========================================
  Files         316      318       +2     
  Lines       10851    10974     +123     
  Branches     3067     3102      +35     
==========================================
+ Hits        10084    10184     +100     
- Misses        342      350       +8     
- Partials      425      440      +15     
Flag Coverage Δ
unittest 92.80% <100.00%> (-0.14%) ⬇️

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

Impacted Files Coverage Δ
...-plugin/src/rules/no-unnecessary-type-assertion.ts 93.58% <100.00%> (-1.08%) ⬇️
packages/eslint-plugin/src/rules/no-unsafe-call.ts 95.23% <0.00%> (-4.77%) ⬇️
...eslint-plugin/src/rules/no-unsafe-member-access.ts 97.82% <0.00%> (-2.18%) ⬇️
...ckages/eslint-plugin/src/rules/no-unsafe-return.ts 98.24% <0.00%> (-1.76%) ⬇️
packages/eslint-plugin/src/util/types.ts 81.86% <0.00%> (-1.65%) ⬇️
...es/eslint-plugin/src/rules/no-unsafe-assignment.ts 92.96% <0.00%> (-0.26%) ⬇️
packages/eslint-plugin/src/rules/no-type-alias.ts 100.00% <0.00%> (ø)
...ages/eslint-plugin/src/rules/no-unsafe-argument.ts 81.15% <0.00%> (ø)
...ckages/eslint-plugin/src/util/getThisExpression.ts 84.61% <0.00%> (ø)

@bradzacher bradzacher added the bug Something isn't working label Mar 29, 2021
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.

Yeah the change didn't consider all of the cases and was ultimately a bad one.

Thanks! One comment

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Apr 2, 2021
Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
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.

THANKS!

@bradzacher bradzacher merged commit 0221476 into typescript-eslint:master Apr 5, 2021
@JoshuaKGoldberg JoshuaKGoldberg deleted the no-unnecessary-type-assertion-ignore-assignments branch April 5, 2021 12:56
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting response Issues waiting for a reply from the OP or another party bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[no-unnecessary-type-assertion] too restrictive with intended temporary narrowing
2 participants