Rule |
Description |
KPI |
URL |
attemptToOverideConstant |
The “Attempting to override ‘{a}’ which is a constant” error is thrown when JSHint encounters an assignment expression with an identifer that has been declared in a constant variable statement. |
Maintainability |
http://linterrors.com/js/attempting-to-override-a-which-is-a-constant |
badAssignment |
The “Bad assignment” error (and the alternative “Invalid left-hand side in assignment” error) are thrown when JSLint, JSHint or ESLint encounters an assignment expression in which the left-hand side is a call expression. |
Maintainability |
http://linterrors.com/js/bad-assignment |
functionStatementsAreNotInvocable |
The “Function statements are not invocable. Wrap the whole function invocation in parens” error (and the alternative “Function declarations are not invocable” error) is thrown when JSLint and JSHint encounter a function declaration followed by a pair of parentheses. In the provided example we declare the demo function and then attempt to immediately invoke it. |
Maintainability |
http://linterrors.com/js/function-statements-are-not-invocable |
notAFunction |
The “‘{a}’ is not a function” error is thrown when JSLint, JSHint or ESLint encounters an attempt to invoke the Math object as a function. JSLint and ESLint (but not JSHint) will also raise this warning when they encounter an attempt to invoke the JSON object as a function. |
Maintainability |
http://linterrors.com/js/a-is-not-a-function |
unclosedComment |
The “Unclosed comment” error is thrown when JSLint or JSHint encounters a multiline comment that does not end with the character sequence */. |
Accuracy |
http://linterrors.com/js/unclosed-comment |
unclosedMegaLiteral |
The “Unclosed mega literal” error is thrown when JSLint encounters an unclosed template string literal. JSHint raises the “Unclosed template literal” error in the same situation. Note that because template string literals are an ES2015 (ES6) feature this error should only appear when linting ES2015 code with the appropriate option set in the linter. In the provided example we attempt to assign an unclosed template string literal to a: |
Accuracy |
http://linterrors.com/js/unclosed-mega-literal |
unclosedRegularExpression |
The “Unclosed regular expression” error is thrown when JSLint or JSHint encounters a regular expression literal with no closing / character. |
Accuracy |
http://linterrors.com/js/unclosed-regular-expression |
unclosedString |
The “Unclosed string” error is thrown when JSLint or JSHint encounters a a string that is not closed before the next line break or the end of the program. There are numerous situations that could cause this. In this first example, we accidentally forget to close our string. |
Accuracy |
http://linterrors.com/js/unclosed-string |
missingColon |
“The “”Missing ‘:’ on a case clause.”” error is thrown when JSLint or JSHint encounters that ‘:’ is missing after a case keyword in switch block.In the provided example we attempt to write a switch block with case statement: switch(value) { case ‘1’ console.log(‘never reach here’); break; } Why do I get this error? This error is raised to highlight a fatal JavaScript syntax error. Your code will not run if you do not fix this error. “ |
Understandability |
|
expectedOperator |
Expected an operator and instead saw ‘{a}’. |
Maintainability |
|
invalidForEachLoop |
Invalid for each loop. Make sure the expression syntax is correct. |
Accuracy |
|
variableACannotNamedB |
A {a} cannot be named ‘{b}’. |
Maintainability |
|
tooManyStatements |
Put statements in one function |
Maintainability |
|
cyclomaticComplexityTooHigh |
get rid of empty lines, early return |
Maintainability |
|