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

Fixed a reporter crash #11

Merged
merged 1 commit into from Apr 7, 2011
Merged

Fixed a reporter crash #11

merged 1 commit into from Apr 7, 2011

Conversation

vsviridov
Copy link

~Switched reporter to require() instead of eval()
~Fixed a crash when evidence was undefined

Switched to require() because it was hard to find bugs in reporter if it was eval'd. Stack trace would be lost at eval().

Also, even though @antonkovalyov mentioned that it should take shebang fine - it seems to stop processing as soon as it gets there :)

Do I have to enable additional option for that?

@ipmb
Copy link

ipmb commented Apr 5, 2011

This patch fixes the issues I was seeing with sporadic errors running jshint in node.js with the jslint-reporter. The errors seem to go away if I stop using jslint-reporter.

node.js:178
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
TypeError: Cannot call method 'replace' of undefined
    at encode (eval at  (/opt/node/lib/node/.npm/jshint/0.1.9/package/lib/cli.js:53:26))
    at reporter (eval at  (/opt/node/lib/node/.npm/jshint/0.1.9/package/lib/cli.js:53:26))
    at Object.hint (/opt/node/lib/node/.npm/jshint/0.1.9/package/lib/hint.js:68:9)
    at Object.interpret (/opt/node/lib/node/.npm/jshint/0.1.9/package/lib/cli.js:61:27)
    at Object. (/opt/node/lib/node/.npm/jshint/0.1.9/package/bin/jshint:2:25)
    at Module._compile (module.js:404:26)
    at Object..js (module.js:410:10)
    at Module.load (module.js:336:31)
    at Function._load (module.js:297:12)
    at Array. (module.js:423:10)

FWIW, I'm running it against 46 files and without the jslint-reporter, my config produces about 450 errors. Unfortunately, I'm unable to upload the source javascript files.

@vsviridov
Copy link
Author

The reporter crashes when JSHint says "Can't parse no more, stopping" in case there are too many errors. In this case there's no line number and the broken code substring. If you max out "max errors" option for jshint reporter - it will never happen :) Hopefully @brentlintlner will accept this pull request soon.

@brentlintner brentlintner merged commit 4bd4bd5 into jshint:master Apr 7, 2011
@brentlintner
Copy link
Contributor

Merged this in, and pushed v0.2.0 to npm. :-)

As for the shebang you are correct! I tried then updating JSHint to latest, and it seems to be now fixed. :-D I included that with the release.

Cheers,

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