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

update using-unified.md to fix an error in the doc #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CibiAananth
Copy link

@CibiAananth CibiAananth commented Mar 28, 2024

update the console.error to console.log in the using-unified.md

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

Fix an error in the https://unifiedjs.com/learn/guide/using-unified/#reporting section of the doc, where I believe the intention is to console.log the reporter results but it is wrongly added as console.error.

update the `console.error` to `console.log` in the doc
@wooorm
Copy link
Member

wooorm commented Mar 28, 2024

Hi Cibi! Why do you think console.error is wrong?

@CibiAananth
Copy link
Author

CibiAananth commented Mar 28, 2024

@wooorm when the file is read successfully why do we need to console it as error if there are none from the reporter?
Maybe I'm missing something here? I just looked at https://unifiedjs.com/explore/package/vfile-reporter/#use and everywhere it is console.error.

https://codesandbox.io/p/sandbox/fervent-brook-3vt3zr?file=/src/index.mjs:8,1 - here if you see the vfiles are valid but at the console it prints an error even though there are none

@wooorm
Copy link
Member

wooorm commented Mar 28, 2024

Ah! console.error does not mean that something is an error, and console.log does not mean something is good!
Particularly in Node and similar systems, console.error redirects to stderr, and console.log redirects to stdout. Two different pipes. Many shell tools will use this difference, stderr for the actual output file, and stderr for the diagnostics!

You can use your search engine to find more. One example result is: https://stackoverflow.com/questions/3385201/confused-about-stdin-stdout-and-stderr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants