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-unnec-cond] support nullish coalescing #1148

Merged

Conversation

Retsam
Copy link
Contributor

@Retsam Retsam commented Oct 27, 2019

Adds support for the ?? operator to the no-unnecessary-condition rule - it will check that the left-hand side of that operator is potentially nullish (as well as potentially non-nullish).

(Related, #1052)

@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 the enhancement New feature or request label Oct 27, 2019
The rule will now check that the left-hand side of the ?? operator is potentialy nullish, not potentially falsy.
Adds an error for the case where the left-hand side of `??` is always null or undefined
@Retsam Retsam force-pushed the support-unnecessary-nullish branch from a2bcfae to a04eba3 Compare November 13, 2019 18:28
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 doing this

@codecov
Copy link

codecov bot commented Nov 30, 2019

Codecov Report

Merging #1148 into master will increase coverage by 0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1148      +/-   ##
==========================================
+ Coverage   93.99%   94.01%   +0.01%     
==========================================
  Files         131      131              
  Lines        5778     5797      +19     
  Branches     1631     1638       +7     
==========================================
+ Hits         5431     5450      +19     
  Misses        186      186              
  Partials      161      161
Impacted Files Coverage Δ
...slint-plugin/src/rules/no-unnecessary-condition.ts 100% <100%> (ø) ⬆️

@bradzacher bradzacher changed the title feat(eslint-plugin): [no-unnecessary-condition] add support for nullish coalescing feat(eslint-plugin): [no-unnec-cond] support nullish coalescing Dec 1, 2019
@bradzacher bradzacher merged commit 96ef1e7 into typescript-eslint:master Dec 1, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants