Update grunt-contrib-jshint to 0.10.0
JSHint ignore line failing with the message "Bad option: 'ignore'"
-
01-07-2023 - |
题
Some of the code I am working on dictates the the syntax of various variables and since I want to have JSHint check for camel case in the rest of the file, I'm ignoring it for a single line as follows:
grant_type: 'password' // jshint ignore:line
However, using this approach which came from another StackOverflow question fails both in IntelliJ IDEA (13.1.1) and when performing a grunt jshint
with errors similar to the following:
[L128:C0] W106: Identifier 'grant_type' is not in camel case.
? grant_type: 'password' // jshint ignore:line
[L128:C45] E001: Bad option: 'ignore'.
grant_type: 'password' // jshint ignore:line
What should be done to correct this issue in both of the environments?
解决方案
其他提示
While not a prefect solution as we still haven't figured out why the ignore:line
syntax isn't work, we have instead replaced the code with the following directive which disables the CamelCase check and re-enables it once the relevant block of code has been passed,
/* jshint camelcase:false */
grant_type: 'password'
/* jshint camelcase:true */
不隶属于 StackOverflow