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

doc: improve fs code example quality by jakecastelli · Pull Request #46948 · nodejs/node · GitHub

/ node Public

doc: improve fs code example quality - #46948

Closed
jakecastelli wants to merge 3 commits into
nodejs:mainfrom
jakecastelli:doc-fs-minor-improvement
Closed

doc: improve fs code example quality#46948
jakecastelli wants to merge 3 commits into
nodejs:mainfrom
jakecastelli:doc-fs-minor-improvement

Conversation

jakecastelli commented Mar 4, 2023
edited
Loading

Copy link
Copy Markdown
Member
  • Fixed code examples that are missing import.
  • Added missing optional chaining operator (otherwise the code example would crash)
  • Renamed variable name to avoid confusing highlight.js reserved keywords from.

nodejs-github-bot added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Mar 4, 2023
jakecastelli marked this pull request as ready for review March 4, 2023 12:09
jakecastelli force-pushed the doc-fs-minor-improvement branch from 347d2b3 to 7ba5500 Compare March 4, 2023 12:11
Comment thread doc/api/fs.md Outdated
Comment on lines +7567 to +7568
const fromDir = '/tmp/hello';
const toDir = '/tmp/world';

Copy link
Copy Markdown
Member

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

Does this imply that /tmp/hello and /tmp/world are directories? I think, something like

Suggested change
const fromDir = '/tmp/hello';
const toDir = '/tmp/world';
const fromPath = '/tmp/hello';
const toPath = '/tmp/world';

or

Suggested change
const fromDir = '/tmp/hello';
const toDir = '/tmp/world';
const oldPath = '/tmp/hello';
const newPath = '/tmp/world';

would be less confusing.

Copy link
Copy Markdown
Member Author

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 agree 👍 thanks!

jakecastelli force-pushed the doc-fs-minor-improvement branch from a46a1f6 to 67da4a3 Compare March 5, 2023 10:42
LiviaMedeiros added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Mar 5, 2023
Comment thread doc/api/fs.md
operation might complete before the `fs.rename()` operation:

```js
const fs = require('node:fs');

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

We would typically need to have two examples here, one ESM and one CJS. (doesn't have to block this PR from landing, but it'd need to happen at some point)

Copy link
Copy Markdown
Member Author

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

No problems, once this PR lands I can work on another PR to make sure all of the fs code examples have js flavor 👌 (at the moment there are many of the examples in fs missing them)

nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Mar 6, 2023

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/46948
FetchError: Invalid response body while trying to fetch https://api.github.com/graphql: Premature close
    at consumeBody (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/node_modules/node-fetch/src/body.js:234:60)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Response.text (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/node_modules/node-fetch/src/body.js:158:18)
    at async Request.json (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:51:18)
    at async Request.query (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:109:20)
    at async Request.queryAll (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:136:20)
    at async Request.gql (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:66:22)
    at async PRData.getComments (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/pr_data.js:97:21)
    at async Promise.all (index 2)
    at async Promise.all (index 1) {
  type: 'system',
  errno: 'ERR_STREAM_PREMATURE_CLOSE',
  code: 'ERR_STREAM_PREMATURE_CLOSE',
  erroredSysCall: undefined
}
https://github.com/nodejs/node/actions/runs/4343149312

LiviaMedeiros pushed a commit that referenced this pull request Mar 6, 2023
PR-URL: #46948
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.com>

Copy link
Copy Markdown
Member

Landed in 070e773

targos pushed a commit that referenced this pull request Mar 13, 2023
PR-URL: #46948
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.com>
targos pushed a commit that referenced this pull request Mar 14, 2023
PR-URL: #46948
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.com>
danielleadams pushed a commit that referenced this pull request Apr 11, 2023
PR-URL: #46948
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.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

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. commit-queue-failed An error occurred while landing this pull request using GitHub Actions. doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL