0

Yesterday I started using Syntastic and JShint. It seems to be working ok, detecting missing semicolons or maybe an missing parenthesis etc. But if I try to call a function that isn't defined or if there is a typo in the function call, I get no errors. Example:

function addElement(e) {
...
}
addElmen(foobar);

This obvious spelling error isn't detected. The same goes for varaibles and arguments.

function fooBar(firstArgument) {
    console.log(fritArgument);
}

I would like this to be flagged as an unused argument and using an undefined variable.

Any ideas on why and how to fix this?

Edvin
  • 1,841
  • 4
  • 16
  • 23
  • 1
    It seems to work fine here, I get the message `'fritArgument' is not defined.` Are you sure you're running `jshint` and not some other checker? – lcd047 Jul 29 '16 at 11:01
  • I only have one checker install that I know off. And I do "let g:syntastic_javascript_checkers = ['jshint']" in my .vimrc file. I can also see this line inside vim. "[:SyntasticCheck jshint (javascript)] [Location List] [-]" – Edvin Jul 29 '16 at 11:13
  • 1
    Then enable debugging and read the logs. Set `g:syntastic_debug` to 3, run the checker, and run `:mes`. – lcd047 Jul 29 '16 at 11:16
  • Sorry, I don't know how to do that. I'm quite new to the whole Linux world. – Edvin Jul 29 '16 at 11:17
  • 1
    Run `:let g:syntastic_debug=3`, then `:SyntasticCheck jshint`, then `:mes`. Read the manual for details. – lcd047 Jul 29 '16 at 11:19
  • Done. Here are the logs. http://pastebin.com/bQGQBDVK Don't really know what I'm looking for. Seems like a bunch of raw data from jshint to syntastic. – Edvin Jul 29 '16 at 11:28
  • The logs show that syntastic is working fine. – lcd047 Jul 29 '16 at 11:29
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/118624/discussion-between-edvin-and-lcd047). – Edvin Jul 29 '16 at 11:30
  • Let's not. Please post an new issue at the [issue tracker](https://github.com/scrooloose/syntastic/issues) if you can't figure it out. – lcd047 Jul 29 '16 at 11:32
  • Okey, I will look around some more and see if I can figure it out before posting and issue. Thanks a lot for all your help! Cheers :) – Edvin Jul 29 '16 at 11:36
  • `addElmen(foobar);` is not an error because both `addElmen()` and `foobar` may be defined in another script or in the "global" scope. – romainl Jul 29 '16 at 11:36
  • I see.. bummer. I'm guessing that's a dead end then? There is no way to check if the function is defined in other scripts or the global scope? And what about the case with argument/varaibles typos? – Edvin Jul 29 '16 at 11:51
  • Check **jshint options reference** (http://jshint.com/docs/options/), you may find something usefull. set this options in **.jshintrc** file per project with *true* and *false* values and controll hinting in the way you want to be. – dNitro Jul 29 '16 at 12:20
  • Found the problem. I was using my .jshintrc file that was located in my home folder. But there was added another .jshintrc file without my knowledge within the project that set 'undef' to false... – Edvin Jul 29 '16 at 12:33

0 Answers0