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

feat(eslint-plugin): [no-unnecessary-condition] report when non-nullish is compared to null/undefined #1659

Merged

Conversation

Retsam
Copy link
Contributor

@Retsam Retsam commented Mar 2, 2020

BREAKING CHANGE:

Fixes #1591 .

This is a pretty minimal "handles exactly the case raised in the issue" fix. While looking into this on the issue tracker, I also found Typescript#32627 which is another case that TS won't catch. Might be worth trying to "beef up" this logic to handle this more generally.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Retsam!

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 bradzacher added breaking change This change will require a new major version to be released enhancement New feature or request labels Mar 2, 2020
@bradzacher bradzacher added this to the 3.0.0 milestone Mar 2, 2020
@bradzacher bradzacher changed the base branch from master to v3 May 10, 2020 04:11
@bradzacher bradzacher force-pushed the workaround-null-equality-checks branch from 4a24c42 to ccd6777 Compare May 10, 2020 21:59
@codecov
Copy link

codecov bot commented May 10, 2020

Codecov Report

Merging #1659 into v3 will decrease coverage by 0.02%.
The diff coverage is 81.25%.

@@            Coverage Diff             @@
##               v3    #1659      +/-   ##
==========================================
- Coverage   93.66%   93.63%   -0.03%     
==========================================
  Files         169      169              
  Lines        7653     7667      +14     
  Branches     2187     2190       +3     
==========================================
+ Hits         7168     7179      +11     
- Misses        228      229       +1     
- Partials      257      259       +2     
Flag Coverage Δ
#unittest 93.63% <81.25%> (-0.03%) ⬇️
Impacted Files Coverage Δ
...slint-plugin/src/rules/no-unnecessary-condition.ts 96.96% <81.25%> (-2.19%) ⬇️

@bradzacher bradzacher changed the title feat(eslint-plugin): [no-unnecessary-condition] add workaround for === undefined feat(eslint-plugin): [no-unnecessary-condition] report when non-nullish is compared to null/undefined May 11, 2020
@bradzacher bradzacher merged commit e27b740 into typescript-eslint:v3 May 11, 2020
bradzacher pushed a commit that referenced this pull request May 11, 2020
bradzacher pushed a commit that referenced this pull request May 14, 2020
bradzacher pushed a commit that referenced this pull request May 17, 2020
bradzacher pushed a commit that referenced this pull request May 21, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change This change will require a new major version to be released enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[no-unnecessary-condition] Missing string compared to undefined as unnecessary
2 participants