Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
used es6 conventions for variables and anonymous functions declaration#9669
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
ruggertech commented Nov 17, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
mscdex commented Nov 17, 2016
Trott commented Nov 18, 2016
If we're going to refactor the test for mostly stylistic reasons, I'd ask that we also change the three instances of |
cjihrig commented Nov 18, 2016
I agree with @Trott. I think the |
ruggertech commented Nov 18, 2016
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use common.mustCall() to make sure those assertions a run, as @cjihrig suggested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you use an () => here, and leave function() on line 11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because I saw that in line 11 the previous developer used a named function expression, contrary to other places where he used an anonymous function in the old form.
Named function expressions can be handy when errors are thrown and I believe that was the reason for using a named function on line 11.
I didn't want to break this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your thinking, but think its too subtle, function names don't matter, particularly not in tests. Better change them all.
sam-github commented Nov 18, 2016
const arguably does something useful, es6 functions don't (unless you are trying to access the enclosing |
ruggertech commented Nov 18, 2016
I changed all the functions in the code except for the function declaration on line 11 which was originally set as a named function, for the sake of easier debugging, by the original developer. I changed all of the anonymous functions to their respective es6 arrow function form, but did not want to affect code stability or ease of debugging by changing line 11. Should line 11 also be changed? |
sam-github commented Nov 18, 2016
I think none should be changed, but if we are going to go all es6y, lets go all the way, not half way. I'm a bit worried that the wave of "name functions for readability of stack traces" is going to crash against the wave of "use the new es6 function syntax", and leave confusion, but for now, all es6 in this test is fine. |
ruggertech commented Nov 18, 2016
I see your point. Removed the named function to maintain consistency across this file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruggertech Do you agree with @targos 's suggestion here?
ruggertechNov 24, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do, will take it off
ruggertech commented Nov 20, 2016
do we need anything else for this to be merged ? |
Fishrock123Nov 20, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better not not invoke common.fail directly but rather wrap it in a function and pass it a message string.
ruggertechNov 20, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like that:
stream.on('data', () =>{
stream.on('data', () => common.fail('no more "data" events should follow'));
});
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
sam-github commented Nov 21, 2016
commit message doesn't follow guidelines, it's too long and doesn't start with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be either () => common.fail() or just common.fail.
cjihrig commented Nov 27, 2016
ruggertech commented Nov 30, 2016
Can someone merge please :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arguments now refers to the outer function's arguments. It doesn't change the outcome of the test but I think it's better not to change this one to an arrow function.
implemented arrow functions and changed var to const where appropriate.
targos commented Dec 3, 2016
Thanks. LGTM. Final CI: https://ci.nodejs.org/job/node-test-pull-request/5155/ |
implemented arrow functions and changed var to const where appropriate. PR-URL: #9669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
jasnell commented Dec 5, 2016
Landed in ef74e03. |
implemented arrow functions and changed var to const where appropriate. PR-URL: #9669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
implemented arrow functions and changed var to const where appropriate. PR-URL: nodejs#9669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
implemented arrow functions and changed var to const where appropriate. PR-URL: nodejs#9669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
implemented arrow functions and changed var to const where appropriate. PR-URL: #9669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
implemented arrow functions and changed var to const where appropriate. PR-URL: #9669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
implemented arrow functions and changed var to const where appropriate. PR-URL: #9669 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesDescription of change
changed es5 "var" to "const" and anonymous functions to arrow function syntax