-1

I followed exactly that tutorial (I obviously replaced the vexxhost domain name by localhost:3000 for my tests).

And while calling grunt there is an error ('io' is not defined) but the server start without any other complain.

If I correctly understood the problem, jshint scan the whole project to validate the code and he finds on reference to an undefined variable ! But 'io' is defined when the whole application starts (because the script are loaded). In fact, that error is more a warning than an error

If I am right (and I hope some people here will correct me if I am not), that bring us to my question : How refactor the code or configure jshint to avoid that warning ?

If possible I would prefer to have an explicit reference to 'io'.

By advance thank you to everyone.

EDIT

My results from that tutorial are available here on github. The problematic file is public/modules/core/services/socket.js.

Alexandre SIRKO
  • 816
  • 11
  • 22
  • you would need to give us the code that is throwing the error (or warning). Don't forget to specify which line the error or warning is occurring on. – Kevin B Mar 31 '15 at 21:53
  • My guess would be it's complaining about `public/modules/core/services/socket.js`, and if it is, all you need to do is add a comment that specifies `io` as a global variable. Though, it should also be complaining about angular in that case, unless you've already specified it as a global. – Kevin B Mar 31 '15 at 21:54

1 Answers1

0

There is 2 way to configure JSHint to correct that error :

  • if you are calling the io variable in several place of the code. JSHint is configurable in the .jshintrc file, there is a a global section where it is possible to add "io": true. With that modification, JSHint should consider io as a global variable.

  • Or if you only call the io variable once, you can add the comment /* global io: true */ directly in the file where you are calling it.

Alexandre SIRKO
  • 816
  • 11
  • 22