Best Practice |
Rules to warn if common best practices are not used.
Index
Rule | Description | Type | Severity |
---|---|---|---|
SPC058901: Consider using a "Value and Type" comparison in if statements | Consider using a "Value and Type" comparison in if statements, it is possible for values to be the same but types to be different. This helps to prevent cases such as "0 == false" from occuring. This isn't required were a type is asserted | JavaScriptFile | Warning |
SPC058902: Consider not using 'arguments.callee' and arguments.caller' | Consider not using 'arguments.callee' and 'arguments.caller', these have been deprecated to allow for code optimisations in JavaScript. Consider replacing with a recursive callback were required | JavaScriptFile | Warning |
SPC058903: Consider to not use empty labels | Consider to not use empty labels, goto is not supported in ECMAScript | JavaScriptFile | Warning |
SPC058904: Missing break in switch statement | Missing break in switch statement, In most cases this is an error | JavaScriptFile | Warning |
SPC058905: __iterator__ is a reserved word | The __iterator__ property is not implemented in all browsers | JavaScriptFile | CriticalError |
SPC058906: Do not reassign native objects | Native objects are protected from ECMA6 due to issues with reassigning | JavaScriptFile | CriticalWarning |
SPC058907: Do not use new keyword without assignment | This creates an object without assignment to a variable | JavaScriptFile | Warning |
SPC058908: Disallow use of the function constructor | This is implied code evaluation, the function contructor cause cross site scripting attack vulnerabilities in the code | JavaScriptFile | Error |
SPC058909: Consider to disallow primitive wrapper instances | Objects created from primitive wrappers, are not the same as the primitives themseleves, and used only internally | JavaScriptFile | Warning |
SPC058910: __proto__ is a reserved word | The __proto__ property is not implemented in all browsers | JavaScriptFile | CriticalError |
SPC0589100: With statement is not recommended | With statement is not recommended | JavaScriptFile | Warning |
SPC058911: Consider to not allow assignment in return statements | Assigning values inside a return statement, can cause confusion as to the codes intent | JavaScriptFile | Warning |
SPC058912: Always supply a radix with parseInt | You must always supply a radix with parseInt, as some valid values will be shown as NaN (Not a Number) | JavaScriptFile | Warning |
SPC058913: Do not declare code in the global namespace directly | Do not declare code in the global namespace directly. Instead consider using the $_global_ namespace pattern with Namespace registration, this will ensure correct execution with the MDS garbage collector | JavaScriptFile | Warning |
SPC058914: Use the latest versions of JavaScript libraries | Use the latest versions of JavaScript libraries which contain the latest bug fixes and security patches | JavaScriptFile | Warning |
SPC058984: Argument was defined but not referenced | Argument was defined but not referenced | JavaScriptFile | Warning |
SPC058986: A function was defined but not referenced | A function was defined but not referenced | JavaScriptFile | Warning |
SPC058987: Function has not been declared | Function has not been declared | JavaScriptFile | Warning |
SPC058988: A variable was defined but not set or referenced | A variable was defined but not set or referenced | JavaScriptFile | Warning |
SPC058989: Function name should be a simple identifier; possible browser-specific implementation | Function name should be a simple identifier; possible browser-specific implementation | JavaScriptFile | Warning |
SPC058990: Object constructor takes no arguments | Object constructor takes no arguments | JavaScriptFile | Warning |
SPC058994: Consider replacing maximum numeric literal with Number.MAX_VALUE | Consider replacing maximum numeric literal with Number.MAX_VALUE | JavaScriptFile | Warning |
SPC058995: Consider replacing minimum numeric literal with Number.MIN_VALUE | Consider replacing minimum numeric literal with Number.MIN_VALUE | JavaScriptFile | Warning |
SPC058999: Unused label | Unused label | 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.