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 |
SPC0189100: Suspect equality comparison | Did you intend to compare equality here? | JavaScriptFile | CriticalWarning |
SPC0189101: Suspect semicolon | Did you intend to have an empty statement for this branch of the if statement? | JavaScriptFile | CriticalWarning |
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 |
SPC018992: Octal literals are deprecated. Possible cross-browser behavior difference | Octal literals are deprecated. Possible cross-browser behavior difference | JavaScriptFile | Error |
SPC018993: New line not allowed | New line not allowed | JavaScriptFile | Error |
SPC018994: Imported module does not export name | Imported module does not export name | JavaScriptFile | CriticalWarning |
SPC018997: Semicolon insertion | Semicolon insertion | JavaScriptFile | CriticalWarning |
SPC018998: A statement block is expected | A statement block is expected | JavaScriptFile | Error |
SPC018999: Suspect assigment | Did you intend to write an assignment here? | JavaScriptFile | CriticalWarning |
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 AB. 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.