I have a (single) case in my app were eval
is used, and I would like to suppress JSHint warning only for this case.
Is there a way to achieve that? Configuration, magic comment, ...?
Yes, there is a way. Two in fact. In October 2013 jshint added a way to ignore blocks of code like this:
// Code here will be linted with JSHint.
/* jshint ignore:start */
// Code here will be ignored by JSHint.
/* jshint ignore:end */
// Code here will be linted with JSHint.
You can also ignore a single line with a trailing comment like this:
ignoreThis(); // jshint ignore:line