Skip to content
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

Documentation for __dirname is incorrect #13953

Closed
ghost opened this issue Jun 28, 2017 · 5 comments
Closed

Documentation for __dirname is incorrect #13953

ghost opened this issue Jun 28, 2017 · 5 comments
Assignees
Labels
doc Issues and PRs related to the documentations.

Comments

@ghost
Copy link

ghost commented Jun 28, 2017

  • Version: 8.1.2
  • Platform: Linux 4.8.0 (Ubuntu 16.04)
  • Subsystem: Documentation

In the documentation about Global Objects __dirname is listed as a global object.
In reality it is not.

I would suggest correcting the documentation to represent this.

@mscdex mscdex added the doc Issues and PRs related to the documentations. label Jun 28, 2017
@dnalborczyk
Copy link
Contributor

agreed, though the docs try to clarify:

__dirname is not actually a global but rather local to each module.

https://nodejs.org/api/globals.html#globals_dirname

so maybe the category "Globals" might be somewhat wrong.

@starkwang
Copy link
Contributor

I think __dirname, __filename, exports, module and require should be removed into the Modules doc.
"Globals" is only for the values like console, setTimeout, process, etc.

@tniessen tniessen self-assigned this Jun 28, 2017
@cjihrig
Copy link
Contributor

cjihrig commented Jun 28, 2017

I think it makes sense to move the documentation for those things to https://nodejs.org/api/modules.html#modules_the_module_wrapper, but I'd add a small section in the Globals documentation about these module specific variables, and link to the real docs.

@tniessen
Copy link
Member

tniessen commented Jun 28, 2017

@cjihrig I fear that might not be noticeable enough. To me, that section sounds like it is more of a technical explanation of how node executes modules. What do you think about adding a section ("The module scope") between "The module wrapper" and "The module object"? Or, maybe, rename "The module wrapper" to "The module scope" and move the variables there.

I could PR this later.

@cjihrig
Copy link
Contributor

cjihrig commented Jun 28, 2017

I don't have strong feelings. As long as each entry has it's own linkable subsection and a link at the top of the page, the discoverability is going to be the same.

tniessen added a commit to tniessen/node that referenced this issue Jun 28, 2017
addaleax pushed a commit to addaleax/node that referenced this issue Jul 3, 2017
PR-URL: nodejs#13962
Fixes: nodejs#13953
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
addaleax pushed a commit that referenced this issue Jul 11, 2017
PR-URL: #13962
Fixes: #13953
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
addaleax pushed a commit that referenced this issue Jul 18, 2017
PR-URL: #13962
Fixes: #13953
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants