FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc: add esm examples for assert by jasnell · Pull Request #37607 · nodejs/node · GitHub

/ node Public

doc: add esm examples for assert - #37607

Closed
jasnell wants to merge 2 commits into
nodejs:masterfrom
jasnell:doc-assert-esm-examples
Closed

doc: add esm examples for assert#37607
jasnell wants to merge 2 commits into
nodejs:masterfrom
jasnell:doc-assert-esm-examples

Conversation

jasnell commented Mar 4, 2021

Copy link
Copy Markdown
Member

ESM example variants in preparation for #37162

/cc @aduh95

Signed-off-by: James M Snell jasnell@gmail.com

nodejs-github-bot added assert Issues and PRs related to the assert subsystem. doc Issues and PRs related to the documentations. labels Mar 4, 2021

aduh95 left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I have a preference for keeping the default import for assert (assert.throws, assert.ok, assert.fail, etc.), but not blocking.

Comment thread doc/api/assert.md Outdated

Trott commented Mar 5, 2021

Copy link
Copy Markdown
Member

@nodejs/documentation @nodejs/assert @nodejs/modules

Trott commented Mar 5, 2021

Copy link
Copy Markdown
Member

I hesitate to say this because I know doing this was a lot of work to begin with, but I'm with @aduh95 on the named imports. I'd prefer we do default exports because assert.throws() is a lot more clear than throws() if someone is searching through the documentation. If we want to switch to named imports/destructuring, that could be a separate PR. It would have the benefit of reducing the churn in this too.

(Full disclosure: I happen to think destructuring/named imports are a bit of an anti-pattern. If I have two modules with a get() function, it sure is a lot more clear if I'm using http.get() and https.get() at invocation rather than just get() and having to go to the require/import statement to figure out which one I'm using. So on the one hand, this is just my personal preference. But on the other hand, our example code is going to become other people's production code, so since I happen to believe that one way of doing it is actually generally better, I'd prefer we do the better thing in our example code.)

jasnell commented Mar 5, 2021

Copy link
Copy Markdown
Member Author

What?! Lol... I'm not worried about the work involved, it's really not that much.

aduh95 mentioned this pull request Mar 5, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
jasnell force-pushed the doc-assert-esm-examples branch from 5e11215 to 2306a36 Compare March 5, 2021 16:23

jasnell commented Mar 5, 2021

Copy link
Copy Markdown
Member Author

There, I fixed it for you picky folk 😁🤣

ljharb commented Mar 5, 2021

Copy link
Copy Markdown
Member

altho tbh the AssertionError case is the one where named imports seem clearer to me :-p fine as-is ofc!

jasnell commented Mar 5, 2021

Copy link
Copy Markdown
Member Author

;-)

jasnell added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Mar 5, 2021

jasnell commented Mar 8, 2021

Copy link
Copy Markdown
Member Author

Landed in a8b5cdc

jasnell closed this Mar 8, 2021
jasnell added a commit that referenced this pull request Mar 8, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #37607
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 16, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #37607
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assert Issues and PRs related to the assert subsystem. author ready PRs that have at least one approval, no outstanding review comments, and a CI started. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL