Skip to content

Clean else #318

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

Closed
wants to merge 1 commit into from
Closed

Clean else #318

wants to merge 1 commit into from

Conversation

carusogabriel
Copy link

I've removed the else when we have already returned something 🚮

@adamwathan
Copy link
Member

Normally I would agree with this, but I'm going to keep it the way it is for two reasons:

  1. It's not a guard clause; both outcomes are equally likely, so to me an actual if/else communicates that better.

  2. The Jest documentation uses this structure too, so I'd rather stick to that convention than deviate unnecessarily: https://facebook.github.io/jest/docs/en/expect.html#expectextendmatchers

Thanks though!

@adamwathan adamwathan closed this Jan 15, 2018
@carusogabriel carusogabriel deleted the clean-else branch January 15, 2018 23:18
adamwathan pushed a commit that referenced this pull request Oct 30, 2024
Here is everything you need to know about this update. Please take a
good look at what changed and the test results before merging this pull
request.

### What changed?




#### ✳️ jiti (2.1.0 → 2.3.3) · [Repo](https://github.com/unjs/jiti) ·
[Changelog](https://github.com/unjs/jiti/blob/main/CHANGELOG.md)



<details>
<summary>Release Notes</summary>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.3">2.3.3</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.3.2...v2.3.3">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>
<strong>eval:</strong> Return fallback value (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/326">#326</a>)</li>
</ul>
<h3 dir="auto">💅 Refactors</h3>
<ul dir="auto">
<li>Remove some unused exports with <a href="https://knip.dev/">Knip</a>
(<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/327">#327</a>)</li>
</ul>
<h3 dir="auto">❤️ Contributors</h3>
<ul dir="auto">
<li>Lars Kappert (<a
href="https://bounce.depfu.com/github.com/webpro">@webpro</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.2">2.3.2</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.3.1...v2.3.2">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>
<strong>eval:</strong> Fallback in async mode (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/325">#325</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.1">2.3.1</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.3.0...v2.3.1">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>Conditional access to <code class="notranslate">mod.default</code>
(<a
href="https://bounce.depfu.com/github.com/unjs/jiti/commit/8c30a94">8c30a94</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.3.0">2.3.0</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.2.1...v2.3.0">compare
changes</a></p>
<div class="markdown-alert markdown-alert-important" dir="auto">
<p class="markdown-alert-title" dir="auto"><svg class="octicon
octicon-report mr-2" viewbox="0 0 16 16" version="1.1" width="16"
height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75
0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573
2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0
11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0
1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0
.25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5
0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2
0Z"></path></svg>Important</p>
<p dir="auto">To enhance compatibility, jiti <code
class="notranslate">&gt;=2.1</code> enabled <a
href="https://bounce.depfu.com/github.com/unjs/jiti#interopdefault"><code
class="notranslate">interopdefault</code></a> using a new Proxy method.
If you migrated to <code class="notranslate">2.0.0</code> earlier, this
might have caused behavior changes. In case of any issues during the
upgrade, please <a
href="https://bounce.depfu.com/github.com/unjs/jiti/issues">report</a>
so we can investigate to solve them. 🙏🏼</p>
</div>
<h3 dir="auto">🚀 Enhancements</h3>
<ul dir="auto">
<li>Support <code class="notranslate">jiti.import(id, {default:
true})</code> (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/323">#323</a>)</li>
</ul>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>
<strong>interopDefault:</strong> Avoid <code
class="notranslate">in</code> operator for primitive inputs (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/321">#321</a>)</li>
<li>
<strong>interopDefault:</strong> Simplify logic for default export
checks (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/322">#322</a>)</li>
</ul>
<h3 dir="auto">❤️ Contributors</h3>
<ul dir="auto">
<li>Pooya Parsa (<a
href="https://bounce.depfu.com/github.com/pi0">@pi0</a>)</li>
<li>
<a href="https://bounce.depfu.com/github.com/beer">@beer</a> (<a
href="https://bounce.depfu.com/github.com/iiio2">@iiio2</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.2.1">2.2.1</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.2.0...v2.2.1">compare
changes</a></p>
<h3 dir="auto">🩹 Fixes</h3>
<ul dir="auto">
<li>Bump cache version (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/commit/3acd097">3acd097</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.1.2">2.1.2</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.1.1...v2.1.2">compare
changes</a></p>
<h3 dir="auto">🌊 Types</h3>
<ul dir="auto">
<li>Use local <code class="notranslate">NodeModule</code> type (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/commit/718bea2">718bea2</a>)</li>
</ul></blockquote>
<h4><a
href="https://github.com/unjs/jiti/releases/tag/v2.1.1">2.1.1</a></h4>

<blockquote><p dir="auto"><a
href="https://bounce.depfu.com/github.com/unjs/jiti/compare/v2.1.0...v2.1.1">compare
changes</a></p>
<ul dir="auto">
<li>
<strong>types:</strong> Add standalone types for node require (<a
href="https://bounce.depfu.com/github.com/unjs/jiti/pull/316">#316</a>)</li>
<li>Update babel to 7.25.7</li>
</ul></blockquote>
<p><em>Does any of this look wrong? <a
href="https://depfu.com/packages/npm/jiti/feedback">Please let us
know.</a></em></p>
</details>

<details>
<summary>Commits</summary>
<p><a
href="https://github.com/unjs/jiti/compare/f99a1d7df0064e201df760e17470cc34bb330618...544247421cce0349d58dc94d58e862a7bc12176a">See
the full diff on Github</a>. The new version differs by 31 commits:</p>
<ul>
<li><a
href="https://github.com/unjs/jiti/commit/544247421cce0349d58dc94d58e862a7bc12176a"><code>chore(release):
v2.3.3</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/9ceae39f2680ec358b4647db5bd72766fa6cc47d"><code>refactor:
remove some unused exports (#327)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/dccce59504d0f8350b9154f908246ce554183c39"><code>fix(eval):
return fallback value (#326)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/c1a24e0d9f4bc077c70e1ec72f9424b6b4e3b195"><code>chore(release):
v2.3.2</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/3627a56e50a1992bc229f7f85a5899b1d870d7b6"><code>chore:
update lockfile</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/650cc6c69f485f575f0f08844575946280f10592"><code>fix(eval):
fallback in async mode (#325)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/c4697486207fcbcb390d172da619b7c1a7bac6a2"><code>chore(release):
v2.3.1</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/8c30a94171c5aa052fc69b6434ccf6980077db93"><code>fix:
conditional access to `mod.default`</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/f67ed60ee59c313500659ae23747cafb6a442ab2"><code>chore:
update note</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/a39bd7eb1687059b57c169c3f5001f9d921f4a18"><code>chore(release):
v2.3.0</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/c1325e9f2ef1bca43b1dbe9fba301cc655971b37"><code>chore:
update lockfile</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/daede71dd4e54b0a6ab66e945677766b5117d829"><code>feat:
support `jiti.import(id, {default: true})` (#323)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/537fa3998f49855681d77c4e5f88a987fb82170e"><code>docs:
add note about interop default</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/61891a0c863d261c151cc9dd50f9bace5d089c68"><code>docs:
update interopDefault description and reference</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/fd5d7eac13c0bb2bcccce0ca6b6c71ee3503f580"><code>refactor(interopDefault):
simplify logic for default export checks (#322)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/4be8bff84ef5ae16d31cca79ac9118be88e62b64"><code>fix(interopDefault):
avoid `in` operator for primitive inputs (#321)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/a86751ee15b016828fd93d665d27efe549c967ec"><code>docs:
fix format (#320)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/94b172b9794bbf16ea774b8d82b8016384bb327a"><code>chore(release):
v2.2.1</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/3acd09751f1471b8f6293ba8f073679836163fe3"><code>fix:
bump cache version</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/50ac5d9874f3c6d6198becb1e9ba00d422e5004f"><code>chore(release):
v2.2.0</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/138401060f8ea087623b1989ea90930fa52078bf"><code>ci:
correct condition</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/4f9d67d639bf8a7cca09c0ca5748bb09f3d9145d"><code>ci:
run nightly release once</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/da70d244b012a366cdf1405b04c2983ff754dd64"><code>feat:
use smarter proxy for `interopDefault` (#318)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/88260477e96a3e9e2790ac26f7c9524b7c7f2410"><code>refactor:
inline interopDefault from mlly</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/103d165092f7d13e9243977a3f8edf9ec6e66b41"><code>chore(release):
v2.1.2</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/718bea26084d464a1969e457f4b3fd409176af08"><code>types:
use local `NodeModule` type</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/420787447bc3aa1c4da0d590ed82323cf1e49bed"><code>chore(release):
v2.1.1</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/5998e3c88062aceffb035b89e45ad85ccb58381c"><code>chore:
updarte deps</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/b3a4ccb6abfdb7112a6f976c8761c0bb11762ce7"><code>fix(types):
add standalone types for node require (#316)</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/e7ffe04fceba3ab725d77be091e0c0432dfcf02f"><code>test:
ignore deps for node native register</code></a></li>
<li><a
href="https://github.com/unjs/jiti/commit/1d86ca3a68cb5af1563cc27d328c72ec0e5c22b5"><code>test:
add dependency tests</code></a></li>
</ul>
</details>












---
![Depfu
Status](https://depfu.com/badges/edd6acd35d74c8d41cbb540c30442adf/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR
conflict-free, as long as you don't add any commits to this branch
yourself. You can also trigger a rebase manually by commenting with
`@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and
redoes this update</dd>
<dt>@​depfu recreate</dt><dd>Recreates this PR, overwriting any edits
that you've made to it</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and
conflicts are resolved</dd>
<dt>@​depfu cancel merge</dt><dd>Cancels automatic merging of this
PR</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if
it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency
and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major
updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will
create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants