-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: add callback function signatures in fs.md #13424
doc: add callback function signatures in fs.md #13424
Conversation
I'm all for clearly documenting this but I'm not sure this is the best way to communicate the signature and/or possible values. For example, the error parameter may contain a false-y value and not an actual |
I have to agree with @mscdex. I love that you're taking the time to document these... it is definitely needed. But we should find a way of representing them that is easier to follow. Perhaps:
Or something similar |
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.
👍
IMHO not perfect but better than nothing. |
I prefer to leave callback arguments on separate lines. This seems clearer to me:
than this:
|
Yes, when no error occurred. |
I see.
|
I am sorry for the lack of feedback from our side.
IMO it is not better, I think it is more confusing than without those additions. I am fine with What do you think @mscdex ? |
I agree that the currently proposed layout isn't ideal either. Also, the |
I think the proposal itself is better then the current situation and therefore I am +1 for this. I think it makes sense to make clear that the error can be null (or undefined in some APIs, but I guess that is rare?) but I also agree that adding
Or we mark the other arguments as "optional" because they will only be returned in case
|
@matejkrajcovic this needs a rebase. |
6f2a0ab
to
e758078
Compare
@BridgeAR rebased. |
@mscdex are you fine with landing this as is? I think it is better than our current situation and we can still try to figure out how to improve this further at another point? |
doc/api/fs.md
Outdated
@@ -2471,6 +2518,8 @@ changes: | |||
* `persistent` {boolean} **Default:** `true` | |||
* `interval` {integer} **Default:** `5007` | |||
* `listener` {Function} | |||
* `current` {fs.Stat} |
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.
Both of these should be plural.
@matejkrajcovic seems like we are almost there and only one comment has to be addressed. |
@BridgeAR it's fixed. |
Landed in a636b72 |
PR-URL: nodejs#13424 Refs: nodejs#11135 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs/node#13424 Refs: nodejs/node#11135 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This does not land cleanly in LTS. Please feel free to manually backport by following the guide. Please also feel free to replace do-not-land if it is being backported |
PR-URL: nodejs#13424 Refs: nodejs#11135 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs#18310 Fixes: nodejs#18305 Refs: nodejs#13424 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This is related to #11135.
Adds descriptions of callback parameters to function signatures as in child_process docs.
Checklist
Affected core subsystem(s)
doc, fs