Here is the contents of a JS file:
/*global greeting */
greeting += ' hi!';
I run JSHint and get this error:
$ jshint --verbose ugly.js
ugly.js: line 2, col 1, Read only. (W020)
1 error
Why is JSHint assuming I want the globally imported greeting
variable to be read only? This is without any options or .jshintrc
+1
You need to use /*global greeting:true */
to tell JSHint that your global variable is writeable.
Thanks @valueof! That's what that's for!
Most helpful comment
You need to use
/*global greeting:true */
to tell JSHint that your global variable is writeable.