uipoet / sublime-jshint

JSHint any JavaScript file in Sublime Text 2
390 stars 63 forks source link

TypeError: Cannot read property 'file' of undefined #44

Closed sentience closed 11 years ago

sentience commented 11 years ago

I get this error when invoking JSHint on a JSON file in Sublime Text 2:

/Users/kyank/Library/Application Support/Sublime Text 2/Packages/JSHint/reporter.js:10
      file = results[0].file,
                       ^
TypeError: Cannot read property 'file' of undefined
    at module.exports.reporter (/Users/kyank/Library/Application Support/Sublime Text 2/Packages/JSHint/reporter.js:10:24)
    at Object.module.exports.hint (/usr/local/share/npm/lib/node_modules/jshint/lib/hint.js:121:32)
    at Object.module.exports.interpret (/usr/local/share/npm/lib/node_modules/jshint/lib/cli.js:157:21)
    at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/jshint/bin/hint:2:25)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[Finished in 0.1s with exit code 1]
sentience commented 11 years ago

Running JSHint on the same file from the command prompt produces no output.

uipoet commented 11 years ago

Please help me recreate the error by indicating which operating system you are running and the method you used to install the package?

sentience commented 11 years ago

OS X 10.8.2.

Installed with Package Control.

Kevin Yank http://kevinyank.com/ @sentience

On 22/02/2013, at 8:08 AM, Jamie Hoover ⚔ notifications@github.com wrote:

Please help me recreate the error by indicating which operating system you are running and the method you used to install the package?

— Reply to this email directly or view it on GitHub.

uipoet commented 11 years ago

JSHint does not validate JSON files. I missed this detail earlier. Make sure that you have enabled auto detect for which type of build to use on files. If you run JSHint command on a JSON file, there is no logic to message you about using the wrong kind of file such as HTML or JSON. I will look into having such logic during the Sublime Text 3 refactor.