Newer Version Available

This content describes an older version of this product. View Latest

Review and Resolve Validation Errors and Warnings

When you run validations on your Lightning component code, the results include details for each issue found in the files scanned. Review the results and resolve problems in your code.
For example, here is some example output from the force:lightning:lint command.
1error     secure-document    Invalid SecureDocument API
2  Line:109:29
3  scraping = document.innerHTML;
4  ^
5  
6  warning   no-plusplus   Unary operator '++' used
7  Line:120:50
8  for (var i = (index+1); i < sibs.length; i++) {
9  ^
10  
11  error    secure-window  Invalid SecureWindow API
12  Line:33:21
13  var req = new XMLHttpRequest();
14  ^
15  
16  error  default-case  Expected a default case
17  Line:108:13
18  switch (e.keyCode) {
19  ^
Results vary in appearance depending on the tool you use to run validations. However, the essential elements are the same for each issue found.

Issues are displayed, one for each warning or error. Each issue includes the line number, severity, and a brief description of the issue. It also includes the rule name, which you can use to look up a more detailed description of the issue. See “Lightning Component Validation Rules” for the rules applied by Lightning code validations, as well as possible resolutions and options for further reading.

Your mission is to review each issue, examine the code in question, and to revise it to eliminate all of the genuine problems.

While no automated tool is perfect, we expect that most errors and warnings generated by Lightning code validations will point to genuine issues in your code, which you should plan to fix as soon as you can.