unifiedjs.github.io icon indicating copy to clipboard operation
unifiedjs.github.io copied to clipboard

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

Open CibiAananth opened this issue 1 year ago • 3 comments

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

Initial checklist

  • [x] I read the support docs
  • [x] I read the contributing guide
  • [x] I agree to follow the code of conduct
  • [x] I searched issues and couldn’t find anything (or linked relevant results below)
  • [x] 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.

CibiAananth avatar Mar 28 '24 09:03 CibiAananth

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

wooorm avatar Mar 28 '24 10:03 wooorm

@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

CibiAananth avatar Mar 28 '24 14:03 CibiAananth

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, stdout 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

wooorm avatar Mar 28 '24 15:03 wooorm