Expand Minimize

JSHint

Runs JSHint analysis tool which checks for issues in JavaScript files.

Index

Rule Description Type Severity
JSH318901: Remove debugger statements This option suppresses warnings about the debugger statements in your code. (JSHint option 'debug') JavaScriptFile Warning
JSH318902: Do not use bitwise operators This rule prohibits the use of bitwise operators such as ^ (XOR), | (OR) and others. Bitwise operators are very rare programs and quite often & is simply a mistyped &&. (JSHint option 'bitwise') JavaScriptFile Warning
JSH318903: Use correct comparison This option suppresses warnings about the use of assignments in cases where comparisons are expected. More often than not, code like if (a = 10) {} is a typo. (JSHint option 'boss') JavaScriptFile Warning
JSH318904: Use camelCase in variables This option allows you to force all variable names to use either camelCase style or UPPER_CASE with underscores. (JSHint option 'camelcase') JavaScriptFile Warning
JSH318905: Use curly braces around blocks This option requires you to always put curly braces around blocks in loops and conditionals. JavaScript allows you to omit curly braces when the block consists of only one statement (JSHint option 'curly') JavaScriptFile Warning
JSH318906: Use correct === and !== This options prohibits the use of == and != in favor of === and !==. The former try to coerce values before comparing them which can lead to some unexpected results. The latter don't do any coercion so they are generally safer.  (JSHint option 'eqeqeq') JavaScriptFile Warning
JSH318907: Use correct null comparisons This option suppresses warnings about == null comparisons. Such comparisons are often useful when you want to check if a variable is null or undefined. (JSHint option 'eqnull') JavaScriptFile Warning
JSH318908: Do not use eval This option suppresses warnings about the use of eval. The use of eval is discouraged because it can make your code vulnerable to various injection attacks and it makes it hard for JavaScript interpreter to do certain optimizations. (JSHint option 'evil') JavaScriptFile Warning
JSH318909: Do not use a single expression 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 (JSHint option 'expr') JavaScriptFile Warning
JSH318910: Use filter in for in loops This option requires all for in loops to filter object's items. The for in statement allows for looping through the names of all of the properties of an object including those inherited throught the prototype chain. This behavior can lead to unexpected items in your object so it is generally safer to always filter inherited properties out  (JSHint option 'forin') JavaScriptFile Warning
JSH318911: Use parens for immediate function invocations 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. (JSHint option 'immed') JavaScriptFile Warning
JSH318912: Use correct indent This option enforces specific tab width for your code. (JSHint option 'indent') JavaScriptFile Warning
JSH318913: Define variable before it is used This option prohibits the use of a variable before it was defined. JavaScript has function scope only and, in addition to that, all variables are always moved - or hoisted - to the top of the function. This behavior can lead to some very nasty bugs and that's why it is safer to always use variable only after they have been explicitly defined. (JSHint option 'latedef') JavaScriptFile Warning
JSH318914: Use correct line breakings 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.  (JSHint option 'laxbreak') JavaScriptFile Warning
JSH318915: Use correct line breakings around commas This option suppresses warnings about comma-first coding style (JSHint option 'laxcomma') JavaScriptFile Warning
JSH318916: Do not make functions within a loop This option suppresses warnings about functions inside of loops. Defining functions inside of loops can lead to bugs. (JSHint option 'loopfunc') JavaScriptFile Warning
JSH318917: Avoid multi line strings This option suppresses warnings about multi-line strings. Multi-line strings can be dangerous because all hell breaks loose if you accidentally put a whitespace in between the escape character (backslash) and a new line. (JSHint option 'multistr') JavaScriptFile Warning
JSH318918: Do not use empty blocks This option warns when you have an empty block in your code. JSLint was originally warning for all empty blocks and we simply made it optional. There were no studies reporting that empty blocks break your code in any way. (JSHint option 'noempty') JavaScriptFile Warning
JSH318920: Do not use 'new' for side effects 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. (JSHint option 'nonew') JavaScriptFile Warning
JSH318921: Use consistent of quotation marks This option enforces the consistency of quotation marks used throughout your code. It accepts three values: true if you don't want to enforce one particular style but want some consistency. (JSHint option 'quotmark') JavaScriptFile Warning
JSH318922: Do not use single case switch This option avoid switch with single case (JSHint option 'onecase') JavaScriptFile Warning
JSH318923: Use regular expressions correctly This option warns for unescaped last dash (-) inside brackets in regular expressions. (JSHint option 'regexdash') JavaScriptFile Warning
JSH318924: Avoid . in regexp literals This option warns for . in regexp literals (JSHint option 'regexp') JavaScriptFile Warning
JSH318925: Declare variable before it is used This option prohibits the use of explicitly undeclared variables. This option is very useful for spotting leaking and mistyped variables. (JSHint option 'undef') JavaScriptFile Warning
JSH318926: Avoid JavaScript URLs This option suppresses warnings about the use of script-targeted URLs - such as javascript:.... (JSHint option 'scripturl') JavaScriptFile Warning
JSH318927: Remove unused variables 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 undef. (JSHint option 'unused') JavaScriptFile Warning
JSH318928: Avoid redeclaring a variable This option suppresses warnings about variable shadowing i.e. declaring a variable that had been already declared somewhere in the outer scope. (JSHint option 'shadow') JavaScriptFile Warning
JSH318929: Avoid correct construction of objects and function This option suppresses warnings about unusual constructions like new function () { ... } and new Object;. Such constructions are sometimes used to produce singletons (JSHint option 'supernew') JavaScriptFile Warning
JSH318930: Avoid this in non-constructor functions This option suppresses warnings about possible strict violations when the code is running in strict mode and you use this in a non-constructor function. You should use this option - in a function scope only - when you are positive that your use of this is valid in the strict mode (for example, if you call your function using Function.call). (JSHint option 'validthis') JavaScriptFile Warning
JSH318931: Do not use arguments.caller and arguments.callee This option prohibits the use of arguments.caller and arguments.callee. Both .caller and .callee make quite a few optimizations impossible so they were deprecated in future versions of JavaScript. In fact, ECMAScript 5 forbids the use of arguments.callee in strict mode. (JSHint option 'noarg') JavaScriptFile Warning
JSH318941: Use semicolon correctly This option suppresses warnings about missing semicolons. There is a lot of FUD about semicolon spread by quite a few people in the community. The common myths are that semicolons are required all the time (they are not) and that they are unreliable. JavaScript has rules about semicolons which are followed by all browsers so it is up to you to decide whether you should or should not use semicolons in your code. (JSHint option 'asi') JavaScriptFile Warning
JSH318942: Define uppercase constructors This option requires you to capitalize names of constructor functions. Capitalizing functions that are intended to be used with new operator is just a convention that helps programmers to visually distinguish constructor functions from other types of functions to help spot mistakes when using this. (JSHint option 'newcap') JavaScriptFile Warning
JSH318943: Do not use unary increment and decrement operators This option prohibits the use of unary increment and decrement operators. Some people think that ++ and -- reduces the quality of their coding styles and there are programming languages - such as Python - that go completely without these operators. (JSHint option 'plusplus') JavaScriptFile Warning
JSH318944: Use semicolon in last statement This option suppresses warnings about missing semicolons, but only when the semicolon is omitted for the last statement in a one-line block (JSHint option 'lastsemic') JavaScriptFile Warning
JSH318945: Use dot notation instead of [] This option suppresses warnings about using [] notation when it can be expressed in dot notation: person['name'] vs. person.name. (JSHint option 'sub') JavaScriptFile Warning
JSH318946: Avoid trailing whitespaces This option makes it an error to leave a trailing whitespace in your code. Trailing whitespaces can be source of nasty bugs with multi-line strings. (JSHint option 'trailing') JavaScriptFile Warning
JSH318961: Do not exceed max number of formal parameters per function Checks for maximum number of formal parameters allowed per function. The maximum number can be configured in a SPCAF ruleset. Default is 5. (JSHint option 'maxparams') JavaScriptFile Warning
JSH318962: Do not exceed max number of nested blocks in a function Checks for maximum number of nested blocks allowed per function. The maximum number can be configured in a SPCAF ruleset. Default is 5. (JSHint option 'maxdepth') JavaScriptFile Warning
JSH318963: Do not exceed max number of statements per function Checks for maximum number of statements allowed per function. The maximum number can be configured in a SPCAF ruleset. Default is 25. (JSHint option 'maxstatements') JavaScriptFile Warning
JSH318964: Do not exceed max allowed cyclomatic complexity Checks for maximum allowed cyclomatic complexity. Cyclomatic complexity measures the number of linearly independent paths through a program's source code. The maximum number can be configured in a SPCAF ruleset. Default is 10. (JSHint option 'maxcomplexity') JavaScriptFile Warning
JSH318965: Do not exceed max length of a line in code Checks for maximum allowed length of a line in code. The maximum number can be configured in a SPCAF ruleset. Default is 130. (JSHint option 'maxlen') JavaScriptFile Warning
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.