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

Option to print error stack #1345

Closed
75lb opened this issue Apr 2, 2017 · 2 comments
Closed

Option to print error stack #1345

75lb opened this issue Apr 2, 2017 · 2 comments

Comments

@75lb
Copy link

75lb commented Apr 2, 2017

hi! Say my code has a syntax error:

/**
 * Documenting some broken code
 */
function badJavascriptSyntax () {
  const a = { one: 1, two: 2 }
  const b = { ..a } // should be three fullstops
}

Running jsdoc highlights the error but not the line number where i can find the issue..

$ jsdoc broken-javascript.js
ERROR: Unable to parse /Users/lloydb/broken-javascript.js: Unexpected token .

Is there a way to print the full parse error stack?

@iPherian
Copy link

iPherian commented Jun 5, 2017

+1

As a workaround, you can use a quick little node.js script I made. It uses espree which I believe is the linter jsdoc uses.

espree-check.txt

To install espree:

npm i espree --save

Then call it like:

node.exe espree-check.txt --file some.js

It should print the same error jsdoc gives, but at the bottom of the (long) trace you will see "lineNumber: x, column: y".

Saved me a lot of time.

@hegemonic
Copy link
Contributor

On master, JSDoc now prints the line number and column when there's a syntax error, which should make it easier to track down the problem. Printing the stack trace wouldn't be helpful in most cases.

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

No branches or pull requests

3 participants