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): [non-nullable-type-assertion-style] false-positive with non-nullish as assertions and types #3940

Merged

Conversation

FloEdelmann
Copy link
Contributor

@FloEdelmann FloEdelmann commented Oct 1, 2021

Fixes #3938.

As suggested there, a simple array length assertion did the trick. I added two regression test cases for this check.

@typescript-eslint
Copy link
Contributor

@typescript-eslint typescript-eslint bot commented Oct 1, 2021

Thanks for the PR, @FloEdelmann!

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 codecov bot commented Oct 1, 2021

Codecov Report

Merging #3940 (7d39d1d) into master (02c6ff3) will increase coverage by 0.81%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3940      +/-   ##
==========================================
+ Coverage   92.70%   93.51%   +0.81%     
==========================================
  Files         331      151     -180     
  Lines       11637     8145    -3492     
  Branches     3290     2583     -707     
==========================================
- Hits        10788     7617    -3171     
+ Misses        371      167     -204     
+ Partials      478      361     -117     
Flag Coverage Δ
unittest 93.51% <100.00%> (+0.81%) ⬆️

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

Impacted Files Coverage Δ
...gin/src/rules/non-nullable-type-assertion-style.ts 100.00% <100.00%> (ø)
...ackages/scope-manager/src/referencer/Referencer.ts
...ils/src/ast-utils/eslint-utils/ReferenceTracker.ts
packages/experimental-utils/src/ts-eslint/index.ts
...ackages/experimental-utils/src/ts-eslint/ESLint.ts
packages/scope-manager/src/definition/index.ts
...ges/scope-manager/src/definition/TypeDefinition.ts
packages/scope-manager/src/lib/es2021.promise.ts
...e-manager/src/definition/FunctionNameDefinition.ts
packages/scope-manager/src/lib/es2017.ts
... and 171 more

@bradzacher bradzacher added the bug label Oct 3, 2021
@bradzacher bradzacher changed the title fix(eslint-plugin): false-positive in non-nullable-type-assertion-style fix(eslint-plugin): [non-nullable-type-assertion-style] false-positive with non-nullish as assertions and types Oct 3, 2021
Copy link
Member

@bradzacher bradzacher left a comment

awesome! thanks for being a champion and fixing this!

@bradzacher bradzacher merged commit 40760f9 into typescript-eslint:master Oct 3, 2021
11 checks passed
@FloEdelmann FloEdelmann deleted the fix-type-assertion-style branch Oct 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants