| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
cc/ @nodejs/testing cc/ @silverwind @Trott @not-an-aardvark Is there an easy way to make rules only apply to test/? Also should @not-an-aardvark be on the tools/eslint cc list in onboarding-extras? |
Sorry, something went wrong.
Add the rule to test/.eslintrc. |
Sorry, something went wrong.
Thanks, done |
Sorry, something went wrong.
There was a problem hiding this comment.
Rubber stamp LGTM if the CI passes.
Sorry, something went wrong.
|
CI: https://ci.nodejs.org/job/node-test-commit/7103/ EDIT: CI passed |
Sorry, something went wrong.
|
It's probably worth checking the second and third commits: |
Sorry, something went wrong.
There was a problem hiding this comment.
Rubber-stamp LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
Should these be:
no-var: 2 prefer-const: 2
? I'm not sure what the 2 represents here.
Sorry, something went wrong.
There was a problem hiding this comment.
2 means error
Sorry, something went wrong.
There was a problem hiding this comment.
Changed error to 2 for consistency.
Sorry, something went wrong.
|
CI 2: https://ci.nodejs.org/job/node-test-commit/7112/ EDIT: Still green |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
I think you can const this one.
Sorry, something went wrong.
There was a problem hiding this comment.
➜ node git:(var2const) tools/test.py test/parallel/test-http-get-pipeline-problem.js
=== release test-http-get-pipeline-problem ===
Path: parallel/test-http-get-pipeline-problem
image.length = 45658
/Users/gib/wrk/com/node/test/parallel/test-http-get-pipeline-problem.js:38
for (const i = 0; i < total; i++) {
^
TypeError: Assignment to constant variable.If this is what you meant, I don't think so. I can do for (let i = 0; though.
Sorry, something went wrong.
There was a problem hiding this comment.
Weird, I could swear const loop variables once worked, but I see it's failing now. Your let suggestion sounds good.
Sorry, something went wrong.
There was a problem hiding this comment.
unneccesary wrapping?
Sorry, something went wrong.
There was a problem hiding this comment.
The semicolon puts it over 80 chars 😭
Sorry, something went wrong.
There was a problem hiding this comment.
unneccesary wrapping?
Sorry, something went wrong.
There was a problem hiding this comment.
81 chars again
Sorry, something went wrong.
There was a problem hiding this comment.
Move the string to a variable so it doesn't look so hideous? :)
Sorry, something went wrong.
There was a problem hiding this comment.
unneccesary wrapping?
Sorry, something went wrong.
There was a problem hiding this comment.
➜ node git:(var2const) ✗ make lint
./node tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules \
benchmark lib test tools
/Users/gib/wrk/com/node/test/parallel/test-net-local-address-port.js
16:1 error Line 16 exceeds the maximum line length of 80 max-len
Sorry, something went wrong.
There was a problem hiding this comment.
unneccesary wrapping?
Sorry, something went wrong.
There was a problem hiding this comment.
as above
Sorry, something went wrong.
There was a problem hiding this comment.
unneccesary wrapping?
Sorry, something went wrong.
There was a problem hiding this comment.
as above
Sorry, something went wrong.
There was a problem hiding this comment.
Same here, can probably use const.
Sorry, something went wrong.
There was a problem hiding this comment.
Changed to let as above (const didn't work)
Sorry, something went wrong.
There was a problem hiding this comment.
const again.
Sorry, something went wrong.
There was a problem hiding this comment.
const here too.
Sorry, something went wrong.
There was a problem hiding this comment.
const doesn't work (the pending++ would be modifying it)
Sorry, something went wrong.
There was a problem hiding this comment.
Actually, as is the test failed (it's not run in CI), to fix I had to move the let to the previous line.
Sorry, something went wrong.
There was a problem hiding this comment.
Maybe alphabetically sort the rules?
Sorry, something went wrong.
There was a problem hiding this comment.
Will do
Sorry, something went wrong.
|
Actually, I just realised that the eslint rule isn't showing up all the vars for some reason, I'll investigate later. |
Sorry, something went wrong.
Manually fix issues that eslint --fix couldn't do automatically. PR-URL: #10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Manually fix issues that eslint --fix couldn't do automatically. PR-URL: nodejs#10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: nodejs#10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Manually fix issues that eslint --fix couldn't do automatically. PR-URL: nodejs#10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: nodejs#10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
|
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 #10698. |
Sorry, something went wrong.
|
@gibfahn did can you do a v6.x backport too? |
Sorry, something went wrong.
|
@MylesBorins I'll do it once I get the v4.x backport working. There's more pig-wrestling than I'd expected. |
Sorry, something went wrong.
Backport-PR-URL: nodejs/node#11775 PR-URL: nodejs/node#10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Manually fix issues that eslint --fix couldn't do automatically. Backport-PR-URL: nodejs/node#11775 PR-URL: nodejs/node#10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
| Back | FazBrowse Home | New Git URL |
Overview
Use eslint to convert all var to const/let in test/, manually fix anything that eslint messed up.
If we're going to go ES6 in test/, we might as well go all the way.
To fix rules with eslint
Apply this:
Run this:
eslint --fix --rulesdir=tools/eslint-rules "test/**/*.js"Checklist
Affected core subsystem(s)
test