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

Update: for-direction detection false positives/negatives #11254

Merged
merged 1 commit into from Feb 1, 2019

Conversation

Projects
None yet
5 participants
@BridgeAR
Copy link
Contributor

BridgeAR commented Jan 8, 2019

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

I updated the for-direction rule to prevent false positives and false negatives.

Is there anything you'd like reviewers to focus on?

No

@eslint eslint bot added the triage label Jan 8, 2019

@platinumazure
Copy link
Member

platinumazure left a comment

Thanks for contributing! Left one inline note.

In addition: Could you please add tests (if not already present) for cases where the for increment direction "could be wrong" but the step size is a variable?

For example:

for(var i = 0; i < MAX; i -= STEP_SIZE);

To me, those examples should be valid because we don't know if STEP_SIZE is positive or negative.

Also, since this change can introduce more warnings, the commit summary tag should say "Update". Would you mind making that change as well? (Simplest way to do that is to push new commits without squashing, then edit the PR title.)

"for(var i = 10; i >= 0; i %= 2){}"
"for(var i = 10; i >= 0; i %= 2){}",
"for(var i = 0; i < MAX; i += STEP_SIZE);",
"for(var i = MAX; i < MIN; i -= STEP_SIZE);"

This comment has been minimized.

@platinumazure

platinumazure Jan 8, 2019

Member

Looks like this should say i > MIN.

This comment has been minimized.

@BridgeAR

BridgeAR Jan 9, 2019

Author Contributor

It was meant as test which you requested and I was to lazy to change the variable names, so it seemed confusing afterwards. I fixed that now and added another one on top.

@platinumazure platinumazure added bug rule accepted and removed triage labels Jan 8, 2019

@BridgeAR BridgeAR changed the title Fix: for-direction detection false positives/negatives Update: for-direction detection false positives/negatives Jan 9, 2019

@BridgeAR BridgeAR force-pushed the BridgeAR:improve-for-direction branch from 184efa5 to 904b9c0 Jan 9, 2019

@not-an-aardvark

This comment has been minimized.

Copy link
Member

not-an-aardvark commented Jan 18, 2019

@platinumazure Friendly ping, have your suggestions been addressed?

@platinumazure
Copy link
Member

platinumazure left a comment

LGTM, thanks! Sorry for not following up sooner.

@btmills

btmills approved these changes Feb 1, 2019

@btmills btmills merged commit b5143bf into eslint:master Feb 1, 2019

5 checks passed

commit-message Commit message follows guidelines
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details

PlayMa256 added a commit to PlayMa256/GrCartuchos that referenced this pull request Feb 1, 2019

Update eslint in group default to the latest version 🚀 (#125)
## The devDependency [eslint](https://github.com/eslint/eslint) was updated from `5.12.1` to `5.13.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for v5.13.0</summary>

<ul>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/91c8884971f5e57f5f7490d8daf92c4a9a489836"><code>91c8884</code></a> Chore: use local function to append "s" instead of a package (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="400953921" data-permission-text="Issue title is private" data-url="eslint/eslint#11293" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11293/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11293">#11293</a>) (Timo Tijhof)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/b5143bfc09e53d8da8f63421ade093b7593f4f51"><code>b5143bf</code></a> Update: for-direction detection false positives/negatives (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="397135133" data-permission-text="Issue title is private" data-url="eslint/eslint#11254" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11254/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11254">#11254</a>) (Ruben Bridgewater)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/9005e632d13476880c55f7e3c8a6e450762a5171"><code>9005e63</code></a> Chore: increase camelcase test coverage (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="401174018" data-permission-text="Issue title is private" data-url="eslint/eslint#11299" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11299/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11299">#11299</a>) (Redmond Tran)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/5b14ad1003c7df9a37621dea55c6d6d0484adc05"><code>5b14ad1</code></a> Fix: false positive in no-constant-condition (fixes <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="401916289" data-permission-text="Issue title is private" data-url="eslint/eslint#11306" data-hovercard-type="issue" data-hovercard-url="/eslint/eslint/issues/11306/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/issues/11306">#11306</a>) (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="402047796" data-permission-text="Issue title is private" data-url="eslint/eslint#11308" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11308/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11308">#11308</a>) (Pig Fang)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/6567c4f6665df85c3347388b29d8193cc8208d63"><code>6567c4f</code></a> Fix: only remove arrow before body in object-shorthand (fixes <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="401807378" data-permission-text="Issue title is private" data-url="eslint/eslint#11305" data-hovercard-type="issue" data-hovercard-url="/eslint/eslint/issues/11305/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/issues/11305">#11305</a>) (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="402033639" data-permission-text="Issue title is private" data-url="eslint/eslint#11307" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11307/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11307">#11307</a>) (Pig Fang)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/fa2f370affa4814dbdda278f9859d0172d4b7aa2"><code>fa2f370</code></a> Docs: update rule configuration values in examples (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="404018485" data-permission-text="Issue title is private" data-url="eslint/eslint#11323" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11323/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11323">#11323</a>) (Kai Cataldo)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/0a3c3ff1d91e8f39943efc4a7d2bf6927d68d37e"><code>0a3c3ff</code></a> New: Allow globals to be disabled/configured with strings (fixes <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="294234548" data-permission-text="Issue title is private" data-url="eslint/eslint#9940" data-hovercard-type="issue" data-hovercard-url="/eslint/eslint/issues/9940/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/issues/9940">#9940</a>) (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="405027784" data-permission-text="Issue title is private" data-url="eslint/eslint#11338" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11338/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11338">#11338</a>) (Teddy Katz)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/dccee63cf41234180c71bf0fe01b165c9078fc69"><code>dccee63</code></a> Chore: avoid hard-coding the list of core rules in eslint:recommended (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="404605578" data-permission-text="Issue title is private" data-url="eslint/eslint#11336" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11336/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11336">#11336</a>) (Teddy Katz)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/c1fd6f54d92efe615bcae529006221e122dbe9e6"><code>c1fd6f5</code></a> Chore: remove undocumented <code>Linter#rules</code> property (refs <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="253051999" data-permission-text="Issue title is private" data-url="eslint/eslint#9161" data-hovercard-type="issue" data-hovercard-url="/eslint/eslint/issues/9161/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/issues/9161">#9161</a>) (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="404599049" data-permission-text="Issue title is private" data-url="eslint/eslint#11335" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11335/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11335">#11335</a>) (Teddy Katz)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/36e335681d61cbe3c83b653b7cc5f95730f1d86e"><code>36e3356</code></a> Chore: remove dead code for loading rules (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="404588598" data-permission-text="Issue title is private" data-url="eslint/eslint#11334" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11334/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11334">#11334</a>) (Teddy Katz)</li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/c464e2744ec76e7e9c6c5af0f6162c92187f1ece"><code>c464e27</code></a> Docs: Rename <code>result</code> -&gt; <code>foo</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="394168276" data-permission-text="Issue title is private" data-url="eslint/eslint#11210" data-hovercard-type="pull_request" data-hovercard-url="/eslint/eslint/pull/11210/hovercard" href="https://urls.greenkeeper.io/eslint/eslint/pull/11210">#11210</a>) (Alexis Tyler)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 13 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/4b267a5c8a42477bb2384f33b20083ff17ad578c"><code>4b267a5</code></a> <code>5.13.0</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/720dce11ed89ce17ce3600044fd8e45145d353eb"><code>720dce1</code></a> <code>Build: changelog update for 5.13.0</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/91c8884971f5e57f5f7490d8daf92c4a9a489836"><code>91c8884</code></a> <code>Chore: use local function to append "s" instead of a package (#11293)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/b5143bfc09e53d8da8f63421ade093b7593f4f51"><code>b5143bf</code></a> <code>Update: for-direction detection false positives/negatives (#11254)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/9005e632d13476880c55f7e3c8a6e450762a5171"><code>9005e63</code></a> <code>Chore: increase camelcase test coverage (#11299)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/5b14ad1003c7df9a37621dea55c6d6d0484adc05"><code>5b14ad1</code></a> <code>Fix: false positive in no-constant-condition (fixes #11306) (#11308)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/6567c4f6665df85c3347388b29d8193cc8208d63"><code>6567c4f</code></a> <code>Fix: only remove arrow before body in object-shorthand (fixes #11305) (#11307)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/fa2f370affa4814dbdda278f9859d0172d4b7aa2"><code>fa2f370</code></a> <code>Docs: update rule configuration values in examples (#11323)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/0a3c3ff1d91e8f39943efc4a7d2bf6927d68d37e"><code>0a3c3ff</code></a> <code>New: Allow globals to be disabled/configured with strings (fixes #9940) (#11338)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/dccee63cf41234180c71bf0fe01b165c9078fc69"><code>dccee63</code></a> <code>Chore: avoid hard-coding the list of core rules in eslint:recommended (#11336)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/c1fd6f54d92efe615bcae529006221e122dbe9e6"><code>c1fd6f5</code></a> <code>Chore: remove undocumented <code>Linter#rules</code> property (refs #9161) (#11335)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/36e335681d61cbe3c83b653b7cc5f95730f1d86e"><code>36e3356</code></a> <code>Chore: remove dead code for loading rules (#11334)</code></li>
<li><a href="https://urls.greenkeeper.io/eslint/eslint/commit/c464e2744ec76e7e9c6c5af0f6162c92187f1ece"><code>c464e27</code></a> <code>Docs: Rename <code>result</code> -&gt; <code>foo</code> (#11210)</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/eslint/eslint/compare/faf3c4eda0d27323630d0bc103a99dd0ecffe842...4b267a5c8a42477bb2384f33b20083ff17ad578c">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.