-
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: standardize function param/object prop style #13769
Conversation
doc/STYLE_GUIDE.md
Outdated
@@ -65,6 +65,9 @@ | |||
* Make the "Note:" label italic, i.e. `*Note*:`. | |||
* Use a capital letter after the "Note:" label. | |||
* Preferably, make the note a new paragraph for better visual distinction. | |||
* Function arguments or object properties should use the following format: | |||
* <code>* `name` {type|type2} Optional description. **Default:** `defaultValue`</code> |
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 this be rendered or should we escape the special symbols to make them visible? Currently, this is rendered.
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.
Maybe we could escape this and not escape the example, WDYT (see update)?
897b8d1
to
e033f38
Compare
Should we add something about type links to MDN? |
d8d7a84
to
9f828c0
Compare
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.
LGTM with a few comments.
doc/api/async_hooks.md
Outdated
* `type` {string} The type of the async resource. | ||
* `triggerAsyncId` {number} The unique ID of the async resource in whose | ||
execution context this async resource was created. | ||
* `resource` {Object} Reference to the resource representing the async operation,` |
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.
Is the backtick at the end of the line intentional?
doc/api/async_hooks.md
Outdated
* arguments | ||
* `type` {string} the type of ascyc event | ||
* `triggerAsyncId` {number} the ID of the execution context that created this async | ||
* `type` {string} The type of ascyc event. |
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.
Not related to this PR, but ascyc is spelled wrong.
doc/api/buffer.md
Outdated
* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` | ||
* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` | ||
* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` | ||
* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`. |
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'm not sure if it should be addressed in this PR, but there are lines longer than 80 characters.
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.
Sounds like something for #12756
doc/api/buffer.md
Outdated
@@ -1819,8 +1819,8 @@ console.log(buf.readUInt32LE(1).toString(16)); | |||
added: v0.11.15 | |||
--> | |||
|
|||
* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` | |||
* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` | |||
* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`. |
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.
Also not related to this PR, but "where to start reading" and "how many bytes to read" could probably be rewritten to sound less like questions.
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 did
Where to start reading
-> Number of bytes in at which to start reading.
and
How many bytes
-> Number of bytes
Let me know if you'd prefer something else.
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'd go with Position to begin reading
and Number of bytes to read
Thanks for the comments @cjihrig. If this seems reasonable I might as well fix up the rest of the docs then. |
218e9ae
to
bd7efb5
Compare
Refs: nodejs#13769 New style is introduced in PR nodejs#13769.
Comment from @jasnell in #13767 (comment)
|
PR-URL: nodejs#13767 Refs: nodejs#11135 Refs: nodejs#13769 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Looks like this fell through the cracks, rebased. I'll land this tomorrow unless there are any objections. |
Landed in 1175c9d |
PR-URL: #13769 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This is not landing cleanly on 8.x, could it be backported? |
PR-URL: nodejs#13769 Backport-PR-URL: nodejs#15687 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs/node#13769 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> 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#13769 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins backported in #16560. |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
doc
Probably should have a lint rule once #12756 lands.