With the following setting the jsHint doesn't complain about console.log
statements while it still reports debugger
statements:
jshint: {
files: [
'Gruntfile.js',
'js/**/*.js',
'tests/*.js',
],
options: {
curly: true,
immed: true,
noarg: true,
expr: true,
quotmark: 'single',
maxdepth: 3,
browser: true,
eqnull: true
}
},
As far as I can tell, JSHint has never warned about references to console
. There is no code in there to specifically handle such references.
console
is simply treated as an identifier that should be defined and accessible from whatever context it is referred to from (which is correct, since that is really all it is).
Therefore, you can get JSHint to warn about usage of console
by getting it to warn about all undefined variables. Just set the undef
option to true
.
Then, if you want to allow the usage of console
, you can add it to your globals
directive or set the devel
option to true
(which implicitly adds it to your globals
directive).
I also had this problem.
I had "undef"
set to true
and still it didn't work.
I tried "devel"
to no avail.
Finally - I simply use the "globals"
variable like so:
"globals" : {
"console": true
}
and that did the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With