Correctness |
Correctness rules check the JavaScript code for correct usage.
Index
Rule | Description | Type | Severity |
---|---|---|---|
SPC018901: No assignment in conditional statement | In most cases this is an error in the code, and unintended | JavaScriptFile | Warning |
SPC018902: Consider to not use, or shim the console object | The console object is only available in IE, after the developer console has been opened once, therefore throwing an error | JavaScriptFile | Warning |
SPC018904: Consider to disallow Controls Characters in Regular Expressions | Control characters are special, invisible characters in the ASCII range 0-31. These characters are rarely used in JavaScript strings so a regular expression containing these characters is most likely a mistake. | JavaScriptFile | Warning |
SPC018905: Consider to disallow extra boolean casts | In contexts such as an if statement's test where the result of the expression will already be coerced to a Boolean, casting to a Boolean via double negation (!!) is unnecessary. | JavaScriptFile | Warning |
SPC018906: Disallow negated left operand of 'in' operator | This is an error, if one intended this usage it should be explicitly coerced | JavaScriptFile | Warning |
SPC018907: Disallow Global Object Function Calls | Quote from ESLint 'ECMAScript provides several global objects that are intended to be used as-is. Some of these objects look as if they could be constructors due their capitalization (such as Math and JSON) but will throw an error if you try to execute them as functions.' | JavaScriptFile | CriticalError |
SPC018908: Disallow usage of NaN directly | Quote from ESLint 'In JavaScript, NaN is a special value of the Number type. It's used to represent any of the "not-a-number" values represented by the double-precision 64-bit format as specified by the IEEE Standard for Binary Floating-Point Arithmetic. NaN has the unique property of not being equal to anything, including itself. That is to say, that the condition NaN !== NaN evaluates to true.' | JavaScriptFile | CriticalError |
SPC018909: Ensure type checks are against valid types | This rule prevents spelling mistakes in 'typeof' unary operator checks. Valid types are symbol, undefined, object, boolean, number, string and function. | JavaScriptFile | CriticalError |
SPC018910: Assignment to function name not allowed | This is strictly not allowed in ECMAScript, however some browsers allow it by accident | JavaScriptFile | CriticalError |
SPC018911: Do not do toString directly on method objects | Do not do function.ToString() comparisons directly as they are handled differently in each browser, always assign to a variable first | JavaScriptFile | CriticalError |
SPC018912: Disallow use of delete on variables | 'delete' is exclusively for use with object properties | JavaScriptFile | Error |
SPC018970: Catch identifiers should be unique | Catch identifiers should be unique | JavaScriptFile | Error |
SPC018971: Ambiguous named function expression | Ambiguous named function expression | JavaScriptFile | Error |
SPC018972: Export not at module level | Export not at module level | JavaScriptFile | Error |
SPC018973: Numeric literal causes overflow or underflow exception | Numeric literal causes overflow or underflow exception | JavaScriptFile | Error |
SPC018974: Strict operator always evaluates to true or false | Strict operator always evaluates to true or false | JavaScriptFile | Error |
SPC018975: Array literal trailing commas has cross-browser difference | Array literal trailing commas has cross-browser difference | JavaScriptFile | Error |
SPC018976: Variable or function declaration redefines the catch error name | Variable or function declaration redefines the catch error name | JavaScriptFile | Error |
SPC018977: Constant declaration already declared | Constant declaration already declared | JavaScriptFile | Error |
SPC018978: Duplicate lexical declaration; cannot redefine let or const variables | Duplicate lexical declaration; cannot redefine let or const variables | JavaScriptFile | Error |
SPC018979: High-surrogate pair value not followed by low-surrogate value | High-surrogate pair value not followed by low-surrogate value | JavaScriptFile | Error |
SPC018980: Reserved words and should not be used as an identifier | Reserved words and should not be used as an identifier | JavaScriptFile | Error |
SPC018981: Low-surrogate pair value not preceeded by high-surrogate value | Low-surrogate pair value not preceeded by high-surrogate value | JavaScriptFile | Error |
SPC018982: Function declaration should not be inside a statement. Cross-browser behavior difference | Function declaration should not be inside a statement. Cross-browser behavior difference | JavaScriptFile | Error |
SPC018983: Reserved word used as object literal property name; cross-browser issue | Reserved word used as object literal property name; cross-browser issue | JavaScriptFile | Error |
SPC018985: Identifier already in use | Identifier already in use | JavaScriptFile | Error |
SPC018991: Octal literals are deprecated. Possible cross-browser behavior difference | Octal literals are deprecated. Possible cross-browser behavior difference | JavaScriptFile | Error |
SPC018992: New line not allowed | New line not allowed | JavaScriptFile | Error |
SPC018993: Imported module does not export name | Imported module does not export name | JavaScriptFile | CriticalWarning |
SPC018996: Semicolon insertion | Semicolon insertion | JavaScriptFile | CriticalWarning |
SPC018997: A statement block is expected | A statement block is expected | JavaScriptFile | Error |
SPC018998: Suspect assigment | Did you intend to write an assignment here? | JavaScriptFile | CriticalWarning |
SPC2389100: Strict-mode does not allow certain variable names | Strict-mode does not allow certain variable names | JavaScriptFile | Error |
SPC2389101: Strict-mode does not allow certain function names | Strict-mode does not allow certain function names | JavaScriptFile | Error |
SPC2389102: Strict-mode does not allow duplicate property names | Strict-mode does not allow duplicate property names | JavaScriptFile | Error |
SPC2389103: Strict-mode does not allow assignment to certain variables | Strict-mode does not allow assignment to certain variables | JavaScriptFile | Error |
SPC2389104: Strict-mode does not allow ++ or -- on certain objects | Strict-mode does not allow ++ or -- on certain objects | JavaScriptFile | Error |
SPC2389105: Strict-mode does not allow certain delete operands | Strict-mode does not allow certain delete operands | JavaScriptFile | Error |
SPC2389106: Strict-mode does not allow certain argument names | Strict-mode does not allow certain argument names | JavaScriptFile | Error |
SPC2389107: Assignment to constant | Assignment to constant | JavaScriptFile | Error |
SPC2389108: String literal is not safe for inline | String literal is not safe for inline | JavaScriptFile | Error |
SPC2389109: Strict-mode does not allow assignment to undefined variables | Strict-mode does not allow assignment to undefined variables | JavaScriptFile | Error |
SPC2389110: End of file encountered before function is properly closed | End of file encountered before function is properly closed | JavaScriptFile | Error |
SPC2389111: Expected ///#ENDIF directive | Expected ///#ENDIF directive | JavaScriptFile | Error |
SPC2389112: Expected ///#ENDDEBUG directive | Expected ///#ENDDEBUG directive | JavaScriptFile | Error |
SPC2389113: Invalid numeric literal | Invalid numeric literal | JavaScriptFile | Error |
SPC2389114: Suspect equality comparison | Suspect equality comparison | JavaScriptFile | Error |
SPC2389115: Strict-mode does not allow certain catch error binding names | Strict-mode does not allow certain catch error binding names | JavaScriptFile | Error |
SPC2389116: Binding patterns in var statements require initializer | Binding patterns in var statements require initializer | JavaScriptFile | Error |
SPC2389117: Implicit object property name must be identifier | Implicit object property name must be identifier | JavaScriptFile | Error |
SPC2389118: Setter method must have a single format argument | Setter method must have a single format argument | JavaScriptFile | Error |
SPC2389119: Rest parameter can only be last parameter | Rest parameter can only be last parameter | JavaScriptFile | Error |
SPC2389120: Unable to convert to binding syntax | Unable to convert to binding syntax | JavaScriptFile | Error |
SPC2389121: Unable to convert from binding syntax | Unable to convert from binding syntax | JavaScriptFile | Error |
SPC2389122: Invalid binding syntax | Invalid binding syntax | JavaScriptFile | Error |
SPC2389123: Methods not allowed in object literal bindings | Methods not allowed in object literal bindings | JavaScriptFile | Error |
SPC2389124: Expected for or if keyword | Expected for or if keyword | JavaScriptFile | Error |
SPC2389125: Expected class element | Expected class element | JavaScriptFile | Error |
SPC2389126: Duplicate class element name | Duplicate class element name | JavaScriptFile | Error |
SPC2389127: Class constructor must be regular method | Class constructor must be regular method | JavaScriptFile | Error |
SPC2389128: Class static method cannot be named 'prototype' | Class static method cannot be named 'prototype' | JavaScriptFile | Error |
SPC2389129: Expected binding | Expected binding | JavaScriptFile | Error |
SPC2389130: Multiple default exports | Multiple default exports | JavaScriptFile | Error |
SPC2389131: Import statement must include module name | Import statement must include module name | JavaScriptFile | Error |
SPC2389132: Duplicate module declaration | Duplicate module declaration | JavaScriptFile | Error |
SPC2389133: Imported module has no default export | Imported module has no default export | JavaScriptFile | Error |
SPC2389134: Expected 'from' | Expected 'from' | JavaScriptFile | Error |
SPC2389135: Expected string literal | Expected string literal | JavaScriptFile | Error |
SPC2389136: Expected specifier set | Expected specifier set | JavaScriptFile | Error |
SPC2389137: Arrow functions cannot be constructors | Arrow functions cannot be constructors | JavaScriptFile | Error |
SPC2389138: Application Error | Application Error | JavaScriptFile | Error |
SPC2389139: No Source Error | No Source Error | JavaScriptFile | Error |
SPC238950: Could not parse JavaScript code | Could not parse JavaScript code | JavaScriptFile | Error |
SPC238951: Syntax error | Syntax error | JavaScriptFile | Error |
SPC238952: Expected ':' | Expected ':' | JavaScriptFile | Error |
SPC238953: Expected ';' between statements | Expected ';' between statements | JavaScriptFile | Error |
SPC238954: Expected '(' | Expected '(' | JavaScriptFile | Error |
SPC238955: Expected ')' | Expected ')' | JavaScriptFile | Error |
SPC238956: Expected ']' | Expected ']' | JavaScriptFile | Error |
SPC238957: Expected '{' | Expected '{' | JavaScriptFile | Error |
SPC238958: Expected '}' | Expected '}' | JavaScriptFile | Error |
SPC238959: Expected identifier | Expected identifier | JavaScriptFile | Error |
SPC238960: Expected '=' | Expected '=' | JavaScriptFile | Error |
SPC238961: Illegal assignment | Illegal assignment | JavaScriptFile | Error |
SPC238962: Syntax error in regular expression | Syntax error in regular expression | JavaScriptFile | Error |
SPC238963: Invalid character | Invalid character | JavaScriptFile | Error |
SPC238964: Unterminated string constant | Unterminated string constant | JavaScriptFile | Error |
SPC238965: Unterminated comment | Unterminated comment | JavaScriptFile | Error |
SPC238966: 'return' statement outside of function | 'return' statement outside of function | JavaScriptFile | Error |
SPC238967: Can't have 'break' outside of loop | Can't have 'break' outside of loop | JavaScriptFile | Error |
SPC238968: Can't have 'continue' outside of loop | Can't have 'continue' outside of loop | JavaScriptFile | Error |
SPC238969: unused label | unused label | JavaScriptFile | Error |
SPC238970: Expected hexadecimal digit | Expected hexadecimal digit | JavaScriptFile | Error |
SPC238971: Expected 'while' | Expected 'while' | JavaScriptFile | Error |
SPC238972: Label redefined | Label redefined | JavaScriptFile | Error |
SPC238973: Label not found | Label not found | JavaScriptFile | Error |
SPC238974: 'default' can only appear once in a 'switch' statement | 'default' can only appear once in a 'switch' statement | JavaScriptFile | Error |
SPC238975: Expected identifier or string | Expected identifier or string | JavaScriptFile | Error |
SPC238976: Expected '@end' | Expected '@end' | JavaScriptFile | Error |
SPC238977: Conditional compilation is turned off | Conditional compilation is turned off | JavaScriptFile | Error |
SPC238978: Expected 'catch' | Expected 'catch' | JavaScriptFile | Error |
SPC238979: Unmatched 'else'; no 'if' defined | Unmatched 'else'; no 'if' defined | JavaScriptFile | Error |
SPC238980: Expected ',' | Expected ',' | JavaScriptFile | Error |
SPC238981: Missing 'case' or 'default' statement | Missing 'case' or 'default' statement | JavaScriptFile | Error |
SPC238982: Unmatched '@end'; no '@if' defined | Unmatched '@end'; no '@if' defined | JavaScriptFile | Error |
SPC238983: Unmatched '@else'; no '@if' defined | Unmatched '@else'; no '@if' defined | JavaScriptFile | Error |
SPC238984: Unmatched '@elif'; no '@if' defined | Unmatched '@elif'; no '@if' defined | JavaScriptFile | Error |
SPC238985: Expecting more source characters | Expecting more source characters | JavaScriptFile | Error |
SPC238986: Expected ',' or ')' | Expected ',' or ')' | JavaScriptFile | Error |
SPC238987: Expected ',' or ']' | Expected ',' or ']' | JavaScriptFile | Error |
SPC238988: Expected expression | Expected expression | JavaScriptFile | Error |
SPC238989: Unexpected ';' | Unexpected ';' | JavaScriptFile | Error |
SPC238990: Too many tokens have been skipped in the process of recovering from errors. The file may not be a JScript.NET file | Too many tokens have been skipped in the process of recovering from errors. The file may not be a JScript.NET file | JavaScriptFile | Error |
SPC238991: Did you intend to have an empty statement for this branch of the if statement? | Did you intend to have an empty statement for this branch of the if statement? | JavaScriptFile | Error |
SPC238992: A variable argument list must be the last argument | A variable argument list must be the last argument | JavaScriptFile | Error |
SPC238993: Function expression expected | Function expression expected | JavaScriptFile | Error |
SPC238994: JSParser Exception | JSParser Exception | JavaScriptFile | Error |
SPC238995: Resource reference must be single constant value | Resource reference must be single constant value | JavaScriptFile | Error |
SPC238996: Conditiona compilation structure too complex | Conditiona compilation structure too complex | JavaScriptFile | Error |
SPC238997: Unterminated ASP.NET block | Unterminated ASP.NET block | JavaScriptFile | Error |
SPC238998: Strict-mode does not allow with-statements | Strict-mode does not allow with-statements | JavaScriptFile | Error |
SPC238999: Strict-mode does not allow duplicate argument names | Strict-mode does not allow duplicate argument names | JavaScriptFile | Error |
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.