-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
doc: refactor function expressions to arrow functions #4832
Conversation
Should have a |
Yes, didn't tidy this up yet one bit (commit message isn't exactly great either :P) - I just wanted to know that these are welcome first. |
LGTM, +1 for doc consistency. |
One notice, though: are you sure that this was the only place? |
@ChALkeR it was the only place in that file. I have not gone through all the docs, I'm not sure what's the preferred scope of PRs (I asked about this in the issue message here). Would it be better to create multiple PRs for different files or 1 PR for going through all the docs and fixing these? |
@benjamingr I think it's better to fix those in one commit over all the docs than a lot of smaller commits. |
Ok, thanks! |
|
I still think that one commit that would fix all the (probably not so many) places that got missed when updating the docs would be better that a lot of smaller commits. But it would better to wait until someone else confirms that. |
I'm cool with either way, I'm just not sure what's the preferred way. Thanks for the help there is no rush whatsoever in merging this. |
@benjamingr Ah, that PR was not |
There's quite a few other cases, found through |
@silverwind yes, just not in |
I'd definitely would prefer all of them in a single PR, won't matter if it's multiple commits. |
I've updated all the docs files - put each fix in a different commit. |
@@ -44,7 +44,7 @@ be used as a starting-point for your own Addon. | |||
This "Hello world" example is a simple Addon, written in C++, that is the | |||
equivalent of the following JavaScript code: | |||
|
|||
module.exports.hello = function() { return 'world'; }; | |||
module.exports.hello = () => 'world'; |
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.
Huh, I thought we unintended all code blocks in the docs recently, but i looks like we missed some.
Want to give it another pass, @eljefedelrodeodeljefe?
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.
@silverwind if you'd like I can just fix that in the PR, I didn't want to make any opinionated changes though.
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.
There ought to be more cases, let's do it in another PR, for all of doc
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.
Ok, cool. I'll fix all the other spacing issues later today.
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.
@silverwind must have slipped. sorry.
Should I squash these to a single commit before merging or should it be multiple commits in a single PR? If multiple commits - should I align the commit message of the last commit to the standard or should all commits be given special attention and detail? Also, if multiple commits - should I add a commit for fixing issues raised in the review or should I edit the commit itself? |
I'd prefer landing a single commit here. Less work for me if you squash them now, but I can do when landing. |
This commit replaces multiple usages of `function(){}` with ES2015 arrow functions in places it was forgotten earlier. The goal is to make the docs more consistent since other functions were already replaced with ES2015 arrows. In addition, it fixes invalid syntax in modules.markdown to valid syntax as well as remove `var self = this` pattern usages in the code where they are now possible to avoid through arrow functions. PR-URL: #4832 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: James M Snell <[email protected]>
This commit replaces multiple usages of `function(){}` with ES2015 arrow functions in places it was forgotten earlier. The goal is to make the docs more consistent since other functions were already replaced with ES2015 arrows. In addition, it fixes invalid syntax in modules.markdown to valid syntax as well as remove `var self = this` pattern usages in the code where they are now possible to avoid through arrow functions. PR-URL: #4832 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: James M Snell <[email protected]>
This commit replaces multiple usages of `function(){}` with ES2015 arrow functions in places it was forgotten earlier. The goal is to make the docs more consistent since other functions were already replaced with ES2015 arrows. In addition, it fixes invalid syntax in modules.markdown to valid syntax as well as remove `var self = this` pattern usages in the code where they are now possible to avoid through arrow functions. PR-URL: nodejs#4832 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: James M Snell <[email protected]>
All the docs use arrow functions - looks like one was missed here in the fs docs.
(This is a tiny PR, I figured it's a good idea to break PRs down to a size where they're trivial to review - if bigger PRs are preferred I can do that instead)