Expand Minimize

JavaScript

Intention

The quality rules for JavaScript identify possible problems or coding errors in JavaScript files. These can be generic JavaScript but also SharePoint specific practices. The rules check the code and return violations as CriticalError, Error, CriticalWarning or Warning.

Rule Configuration

By default all recommended rules are checked. To disable rules or rule categories or to change the severity of a rule the SPCAF Settings Editor can be used.

Rule Severities

Each rule has a severity by default to classify the impact of a violation against the rule.

Severity Description
CriticalError Issues reported on CriticalError level may lead to a failed solution deployment process or the SharePoint farm can become instable after deployment. The code contains syntax errors or files or referenced elements are missing. WSPs or Apps with critical errors should not be deployed to SharePoint because they can damage the farm or could have highly negative impact.
Error Issues reported at Error level should not impact the solution deployment process or the stability of the SharePoint farm. But deployed solutions may not work as expected. Future upgrades of the solution maybe impossible or may most likely fail. WSPs or Apps with errors should only be deployed to SharePoint very carefully after the detected issues have been reviewed.
CriticalWarning Issues reported at CriticalWarning level reflect issues that generally have little or no adverse effect on code behavior; they are primarily concerned with code maintainability, and correcting less-than-optimal choices for visible elements. However, for a minority of cases, these messages are considered errors. Therefore, they should be reviewed closely before they are excluded.
Warning Issues reported at Warning level are generally concerned with doing things correctly to keep your code base stable, extensible, and maintainable.
Information Messages at Information level are returned by rules that report information about a target, as opposed to detecting errors in a target.

Category Index

Category Description
Correctness Correctness rules check the JavaScript code for correct usage.
Security Checks if JavaScript poses security issues.
Supportability Checks the supportability of your JavaScript code.
Best Practice Rules to warn if common best practices are not used.
UX User Experience Rules that propose about UserExperience improvements.
Coding Style Warnings that checking proper JavaScript coding style.
Performance Rules warning about performance problems.
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.