jshint: I can't set linting options
I have a config.json file
{
"eqeqeq": false
}
I typed
jshint --config "/path/to/my/config.json"
and still I get errors/warnings regarding “==” and “===”
What is wrong?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (8 by maintainers)
The
eqeqeq
option is an “enforcing option,” meaning that it should only produce warnings when set totrue
. You have identified an inconsistency in JSHint’s enforcement of this particular linting rule.The option’s description states, “This options prohibits the use of == and != in favor of
===
and!==
.” Enabling it will cause JSHint to issue warning W118 for offending code. However, JSHint will issue a separate warning (W041) if either side of the comparison is a “falsey” literal value, regardless of the value of theeqeqeq
option.The long-term resolution for the project, removing W041 altogether. It’s a shame because it makes JSHint less strict by default, but the current behavior is inconsistent and confusing. And while the warning message for W041 is far more descriptive (and therefore a better choice to keep around), we can’t change W118 in-place outside of a major version release. This should be relatively straightforward, so I’ve marked this issue as a “good first bug.”
The short-term resolution for users is to disable W041 in your project configuration, either with an in-line directive:
Or within a JSHint configuration file: