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

Unhelpful error when .jsbeautifyrc has invalid json #728

Closed
michaeljones opened this issue Jul 1, 2015 · 1 comment
Closed

Unhelpful error when .jsbeautifyrc has invalid json #728

michaeljones opened this issue Jul 1, 2015 · 1 comment

Comments

@michaeljones
Copy link

Steps to reproduce:

  1. mkdir tmp; cd tmp
  2. echo "{" > .jsbeautifyrc
  3. js-beautify

Expected result:

Nice error message about poorly formed .jsbeautifyrc content.

Actual result:

$ js-beautify
undefined:0


SyntaxError: Unexpected end of input
    at Object.parse (native)
    at exports.parse (/home/mike/.nave/installed/0.12.5/lib/node_modules/js-beautify/node_modules/config-chain/index.js:54:19)
    at exports.json (/home/mike/.nave/installed/0.12.5/lib/node_modules/js-beautify/node_modules/config-chain/index.js:70:10)
    at module.exports (/home/mike/.nave/installed/0.12.5/lib/node_modules/js-beautify/node_modules/config-chain/index.js:17:15)
    at Object.exports.interpret (/home/mike/.nave/installed/0.12.5/lib/node_modules/js-beautify/js/lib/cli.js:173:15)
    at Object.<anonymous> (/home/mike/.nave/installed/0.12.5/lib/node_modules/js-beautify/js/bin/js-beautify.js:4:5)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

Environment

  • js-beautify: 1.5.10
  • os: Ubuntu
  • node: v0.12.5

Notes

I think the project is great! Thanks for writing it! But this confused me somewhat. I was running js-beautify on an actual file and though that the SyntaxError was in the file instead of my config. Took a while to click!

Kind regards,
Michael

@bitwiseman
Copy link
Member

Thanks for the good issue description. Will fix in the next version.

@bitwiseman bitwiseman added this to the v1.6.0 milestone Jul 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants