GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — doc: modernize and fix code examples in modules.md by vsemozhetbyt · Pull Request #12224 · nodejs/node Conversation
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: not sure about other docs examples but this is inconsistent with core style where () is also used for a single argument.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@lpinca There is a nuance here. I mean somethin like this advice: when we have implicite return and the function body is not in braces, omit parentheses around one argument. I've searched the https://nodejs.org/api/all.html and have found only 2 such cases, and they are better be rewritten with braces, because they do not use returned value and have side effects:
Then I've searched the core libs and have found only one fragment with omitted parentheses and dozens with them. So I shall revert this cange to conform with core.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: no strong opinions here but I think the original is easier to grok.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@lpinca I shall revert this too.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ((module, exports) => { | ||
| // Your module code here. In this example, define a function. | ||
| function some_func() {}; | ||
| function some_func() {} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good opportunity to convert this identifier to camelCase.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@aqrln Sure)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would be also nice to backport it to LTS branches taking into account which features are supported by those Node versions (e.g., exponentiation operator change would need to be reverted).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in 166a156 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Replace `var` by `const`. * Fix semicolons. * Add missing code marks. * Unify quotes. * Comment out ellipsis. * Use object destructuring. * Use exponentiation operator. * Replace snake_case by camelCase. PR-URL: #12224 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
* Replace `var` by `const`. * Fix semicolons. * Add missing code marks. * Unify quotes. * Comment out ellipsis. * Use object destructuring. * Use exponentiation operator. * Replace snake_case by camelCase. PR-URL: nodejs#12224 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
|
@vsemozhetbyt would you be willing to make a backport PR to v6.x? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@MylesBorins I shall try. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
If I get it right, I had only to remove the 'use exponentiation operator' part. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Replace `var` by `const`. * Fix semicolons. * Add missing code marks. * Unify quotes. * Comment out ellipsis. * Use object destructuring. * Replace snake_case by camelCase. Backport-PR-URL: #12500 PR-URL: #12224 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
* Replace `var` by `const`. * Fix semicolons. * Add missing code marks. * Unify quotes. * Comment out ellipsis. * Use object destructuring. * Replace snake_case by camelCase. Backport-PR-URL: #12500 PR-URL: #12224 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
* Replace `var` by `const`. * Fix semicolons. * Add missing code marks. * Unify quotes. * Comment out ellipsis. * Use object destructuring. * Replace snake_case by camelCase. Backport-PR-URL: #12500 PR-URL: #12224 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
* Replace `var` by `const`. * Fix semicolons. * Add missing code marks. * Unify quotes. * Comment out ellipsis. * Use object destructuring. * Replace snake_case by camelCase. Backport-PR-URL: nodejs/node#12500 PR-URL: nodejs/node#12224 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.