When set to true, these options will make JSHint produce more warnings about your code.
This option prohibits the use of bitwise operators such as
This option allows you to force all variable names to use either camelCase style or UPPER_CASE with underscores.
However, in some circumstances, it can lead to bugs (you'd think that
This option is a short hand for the most strict JSHint configuration. It enables all enforcing options and disables all relaxing options.
This options prohibits the use of
This option enables syntax first defined in the ECMAScript 5.1 specification. This includes allowing reserved keywords as object properties.
This option requires all
For more in-depth understanding of
This options prohibits overwriting prototypes of native objects such as
This option can be used to specify a white list of global variables that
are not formally defined in the source code. This is most useful when
combined with the
Setting an entry to
This option suppresses warnings about the use of global strict mode. Global strict mode can break third-party widgets so it is not recommended.
For more info about strict mode see the
This option prohibits the use of immediate function invocations without wrapping them in parentheses. Wrapping parentheses assists readers of your code in understanding that the expression is the result of a function, and not the function itself.
This option sets a specific tab width for your code.
This option suppresses warnings about the
Setting this option to "nofunc" will allow function declarations to be ignored.
This option lets you control cyclomatic complexity throughout your code. Cyclomatic complexity measures the number of linearly independent paths through a program's source code. Read more about cyclomatic complexity on Wikipedia.
This option lets you control how nested do you want your blocks to be:
This options allows you to set the maximum amount of warnings JSHint will produce before giving up. Default is 50.
This option lets you set the maximum length of a line.
This option lets you set the max number of formal parameters allowed per function:
This option lets you set the max number of statements allowed per function:
This option requires you to capitalize names of constructor functions.
Capitalizing functions that are intended to be used with
Not doing so won't break your code in any browsers or environments but
it will be a bit harder to figure out—by reading the code—if the
function was supposed to be used with or without new. And this is
important because when the function that was intended to be used with
This option prohibits the use of
This option prohibits the use of the comma operator. When misused, the comma operator can obscure the value of a statement and promote incorrect code.
This option warns about "non-breaking whitespace" characters. These characters can be entered with option-space on Mac computers and have a potential of breaking non-UTF8 web pages.
This option prohibits the use of constructor functions for side-effects. Some people like to call constructor functions without assigning its result to any variable:
There is no advantage in this approach over simply calling
This option suppresses warnings about invalid
Do not use this option unless you're absolutely sure you don't want these checks.
This option enforces the consistency of quotation marks used throughout
your code. It accepts three values:
This option suppresses warnings about variable shadowing i.e. declaring a variable that had been already declared somewhere in the outer scope.
This option prohibits the use of the grouping operator when it is not strictly required. Such usage commonly reflects a misunderstanding of unary operators, for example:
This option prohibits the use of explicitly undeclared variables. This option is very useful for spotting leaking and mistyped variables.
If your variable is defined in another file, you can use the
This option warns when you define and never use your variables. It is very
useful for general code cleanup, especially when used in addition to
In addition to that, this option will warn you about unused global
variables declared via the
This can be set to
When set to true, these options will make JSHint produce fewer warnings about your code.
This option suppresses warnings about the use of assignments in cases
where comparisons are expected. More often than not, code like
You can silence this error on a per-use basis by surrounding the assignment with parenthesis, such as:
This option suppresses warnings about the
This option tells JSHint that your code uses ES3 array elision elements,
or empty elements (for example,
This option suppresses warnings about
This option tells JSHint that your code uses ECMAScript 6 specific syntax. Note that these features are not finalized yet and not all browsers implement them.
This option suppresses warnings about the use of
This option suppresses warnings about the use of expressions where normally you would expect to see assignments or function calls. Most of the time, such code is a typo. However, it is not forbidden by the spec and that's why this warning is optional.
This option suppresses warnings about missing semicolons, but only when the semicolon is omitted for the last statement in a one-line block:
This option suppresses most of the warnings about possibly unsafe line
breakings in your code. It doesn't suppress warnings about comma-first
coding style. To suppress those you have to use
This option suppresses warnings about comma-first coding style:
This option suppresses warnings about functions inside of loops. Defining functions inside of loops can lead to bugs such as this one:
To fix the code above you need to copy the value of
This option suppresses warnings about multi-line strings. Multi-line
you accidentally put a whitespace in between the escape character (
Note that even though this option allows correct multi-line strings, it still warns about multi-line strings without escape characters or with anything in between the escape character and a whitespace.
This option suppresses warnings about generator functions with no
This option prohibits the use of unary increment and decrement
operators. Some people think that
This option suppresses warnings about the
This option suppresses warnings about the use of script-targeted
Note: This option enables strict mode for function scope only. It prohibits the global scoped strict mode because it might break third-party widgets on your page. If you really want to use global strict mode, see the globalstrict option.
This option suppresses warnings about using
This option suppresses warnings about "weird" constructions like
This option suppresses warnings about possible strict violations when
the code is running in strict mode and you use
Note: This option can be used only inside of a function scope. JSHint will fail with an error if you will try to set this option globally.
This option suppresses warnings about the use of the
These options let JSHint know about some pre-defined global variables.
This option defines globals exposed by modern browsers: all the way from
Note: This option doesn't expose variables like
This option defines globals available when using the Browserify tool to build a project.
This option defines globals that are usually used for logging poor-man's
This option defines globals exposed by the Dojo Toolkit.
This option defines globals exposed by the Jasmine unit testing framework.
This option defines globals exposed by the "BDD" and "TDD" UIs of the Mocha unit testing framework.
This option defines globals available when your code is running inside
of the Node runtime environment. Node.js is a
event-driven model. This option also skips some warnings that make sense
in the browser environments but don't make sense in Node such as
This option defines non-standard but widely adopted globals such as
This option defines globals exposed by the QUnit unit testing framework.
This option defines globals exposed by the ShellJS library.
This option defines globals for typed array constructors.
This option defines globals available when your code is running inside of a Web Worker. Web Workers provide a simple means for web content to run scripts in background threads.
This option defines globals available when your code is running as a script for the Windows Script Host.