Grunt/Jshint error W117: "is not defined"

In _main.js I use a variable helloWorld not defined in the js file but in the head.php :

<script type="text/javascript">var helloWorld = 'Hello World!';</script>

Grunt gets:

W117: 'helloWorld' is not defined

Before Grunt it always worked.

Putting this

/* jshint -W117 */

at the top of _main.js, Grunt gives:

Linting assets/js/_main.js... ERROR
>> 'helloWorld' is not defined.
Linting assets/js/_main.js... ERROR
>> 'helloWorld' is not defined.

If you have to use variables in the global scope then you need to tell JSHint to ignore them in .jshintrc.

On this line:

setTimeout('$(".done").fadeOut("slow")',7000);

Grunt gets errors:

W066: Implied eval. consider passing a function instead of a string
W033: Missing semicolon

If I edit to:

setTimeout($(".done").fadeOut("slow"),7000);

I get no error but the delay (setTimeout function) is not applied.

This isn’t Roots related. In future please try to read up on the error codes or ask on stack overflow or one of its equivalents.

Using an anonymous function will prevent the implied eval:

setTimeout(function(){$(".done").fadeOut("slow");},7000);