| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Probably most useful to look at the second and third commits:
|
Sorry, something went wrong.
|
Rubberstamp LGTM on the first two commits, actual LGTM on the third. For what it's worth, we could achieve almost the same behavior by configuring the no-restricted-properties rule: rules:
no-restricted-properties:
- error
- object: assert
property: equal
message: use assert.strictEqual() rather than assert.equal()
- object: assert
property: notEqual
message: use assert.notStrictEqual() rather than assert.notEqual()The only difference is that this custom rule would not warn for something like foo(assert.equal), whereas no-restricted-properties would warn that. I'm not sure whether having a warning would be desirable in that case. |
Sorry, something went wrong.
There was a problem hiding this comment.
largely rubber-stamp LGTM
Sorry, something went wrong.
|
wow, awesome!!! |
Sorry, something went wrong.
There was a problem hiding this comment.
I like it LGTM
Sorry, something went wrong.
|
Updated the eslint rule as per @not-an-aardvark's suggestion, if you (or @Trott @targos or @silverwind) could confirm that the changes to .eslintrc are okay that'd be great, especially the changes to __defineGetter__ and __defineSetter__. Also moved the existing eslint-ignore rule up a bit as otherwise the linter complains about the definitions of assert.equal and assert.notEqual in lib/assert.js. This should be good to go now |
Sorry, something went wrong.
|
CI 2: https://ci.nodejs.org/job/node-test-commit/7137/ EDIT: CI is green |
Sorry, something went wrong.
There was a problem hiding this comment.
what are the original types?
Sorry, something went wrong.
There was a problem hiding this comment.
This is run several times, and at various times getPid can be a number or a string (expectPid is always a number). I could also do:
assert.strictEqual(Number.parseInt(getPid), expectPid)if you think that's better.
Sorry, something went wrong.
There was a problem hiding this comment.
s/noEqual/notEqual/
Sorry, something went wrong.
There was a problem hiding this comment.
Done
Sorry, something went wrong.
There was a problem hiding this comment.
Nit add a period at the end and same for the next 2 objects for consistency with the last two (or remove the period for the last two).
Sorry, something went wrong.
There was a problem hiding this comment.
Done
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with a nit
Sorry, something went wrong.
There was a problem hiding this comment.
Nit: Maybe // eslint-disable-next-line no-restricted-properties would be better here so that the rule isn't disabled for the rest of the file. (I'm assuming it's intended to only be disabled for this line, rather than for the rest of the file.)
Sorry, something went wrong.
There was a problem hiding this comment.
This line was already in use for deepEqual and notDeepEqual below, it's now being used for 4 functions (it's re-enabled below in L136). I think we'd need 8 eslint-disable-next-line lines if we did it individually.
So I left it as it was, let me know if you disagree.
Sorry, something went wrong.
There was a problem hiding this comment.
I'd slightly prefer 8 eslint-disable-next-line calls. The more targeted and explicit the disabling, the better. But I don't oppose doing it the way you did it either.
Sorry, something went wrong.
|
looks like this needs a rebase |
Sorry, something went wrong.
|
Rebased (twice). If you want to review the equal->strictEqual changes I recommend looking at the squash commit with ?w=1 at the end of the line to ignore whitespace changes. I mostly fixed issues by adding toString() to things that weren't strings. In some places (e.g. here) it might make more sense to convert things to numbers using Number.parseInt(). I just thought that Number.parseInt() might fail if it gets the wrong input, whereas the toString() should always work (and then you'll get the failure in the assert.strictEqual()). Feedback/disagreement welcome! |
Sorry, something went wrong.
|
Thank you! LGTM |
Sorry, something went wrong.
|
I'll land this tomorrow if there are no objections (rebasing is painful). @targos let me know if anything else needs changing. |
Sorry, something went wrong.
|
@italoacasas Are you saying that this doesn't land cleanly (and thus needs a backport PR) on v7.x? I don't like the idea of adding the dont-land-on labels before the backport PR has been raised, otherwise things will get forgotten. EDIT: I tried raising a backport PR, but it looks like the var->const/let changes from #10685 aren't in v7.x-staging yet. Let me know when they are and I'll backport. |
Sorry, something went wrong.
Extend no-restricted-properties to catch use of assert.equal() and assert.notEqual() and require assert.strictEqual() or assert.notStrictEqual() instead. Also update the eslint-ignore in lib/assert.js to avoid assert.equal/notEqual linter errors in their definitions. PR-URL: nodejs#10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: #10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Extend no-restricted-properties to catch use of assert.equal() and assert.notEqual() and require assert.strictEqual() or assert.notStrictEqual() instead. Also update the eslint-ignore in lib/assert.js to avoid assert.equal/notEqual linter errors in their definitions. PR-URL: #10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: nodejs#10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Extend no-restricted-properties to catch use of assert.equal() and assert.notEqual() and require assert.strictEqual() or assert.notStrictEqual() instead. Also update the eslint-ignore in lib/assert.js to avoid assert.equal/notEqual linter errors in their definitions. PR-URL: nodejs#10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: nodejs#10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Extend no-restricted-properties to catch use of assert.equal() and assert.notEqual() and require assert.strictEqual() or assert.notStrictEqual() instead. Also update the eslint-ignore in lib/assert.js to avoid assert.equal/notEqual linter errors in their definitions. PR-URL: nodejs#10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
|
This will need backport PRs in order to land on v6 or v4 |
Sorry, something went wrong.
|
This is likely preventing a lot of pull requests from back-porting cleanly so I think it should be back-ported with some urgency. Likewise for #10685. |
Sorry, something went wrong.
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. Backport-PR-URL: #11795 PR-URL: #10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Extend no-restricted-properties to catch use of assert.equal() and assert.notEqual() and require assert.strictEqual() or assert.notStrictEqual() instead. Also update the eslint-ignore in lib/assert.js to avoid assert.equal/notEqual linter errors in their definitions. Backport-PR-URL: #11795 PR-URL: #10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. Backport-PR-URL: #11795 PR-URL: #10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Extend no-restricted-properties to catch use of assert.equal() and assert.notEqual() and require assert.strictEqual() or assert.notStrictEqual() instead. Also update the eslint-ignore in lib/assert.js to avoid assert.equal/notEqual linter errors in their definitions. Backport-PR-URL: #11795 PR-URL: #10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. Backport-PR-URL: nodejs/node#11795 PR-URL: nodejs/node#10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Extend no-restricted-properties to catch use of assert.equal() and assert.notEqual() and require assert.strictEqual() or assert.notStrictEqual() instead. Also update the eslint-ignore in lib/assert.js to avoid assert.equal/notEqual linter errors in their definitions. Backport-PR-URL: nodejs/node#11795 PR-URL: nodejs/node#10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
| Back | FazBrowse Home | New Git URL |
Convert assert.equal() to assert.strictEqual() in test/ (no instances found elsewhere by eslint). Also adds a rule to enforce strict equal/notEqual.
Checklist
Affected core subsystem(s)
test, eslint