The script editor uses JSHint to check for code errors and warns against conflicts with best practices.  If more than ten errors are detected, scanning of the script stops and the message "Too many errors" is displayed.  If more than 50 warnings are detected, scanning of the script stops and a "Too many errors" message is displayed.

With errors, a red X appears on the line that contains an error.  With warnings, an orange exclamation point appears on the line that contains a warning.  

Note that the error message does not differentiate between having too many errors or too many warnings.
If JSHint has detected a warning but it is a rule that ServiceNow has configured to suppress, the suppressed warnings do not appear in the editor but still count towards the maximum number of 50 warnings. If you have more than 50 suppressed warnings, JSHint will stop processing but won't indicate where the warnings are. This situation can be confusing because JSHint might not complete scanning the script but it is unclear why it has stopped.

Steps to Reproduce


Create a script with more than 50 suppressed warnings. The most common suppressed warning is from the "eqeqeq" JSHint rule. Create a script that contains 51 or more occurrences of checking a variable against an empty string with the double-equals operator (for example, if (a == '') {... )


Use one of the following workarounds:

  • Increase the maximum number of allowed warnings by adding the following comment as the first line of the script:
    // jshint maxerr:100

  • Fix the warnings (even though they are not immediately visible).

    1. Set maxerr to 1 with the following comment on the first line:
      // jshint maxerr:1

      A red X appears on the first line that has a warning.

    2. Fix the code to satisfy the check.

      The display moves to the next warning, which has a red X.

    3. Continue fixing each line that has a warning until there are none left.

    4. Remove the "maxerr" comment, leave it set to 1, set it to 100, etc.

NOTE: If the problem you are having is the "eqeqeq" rule (the most common rule that generates warnings), it isn't always a simple change to swap out === for == and !== for !=.  You need to understand the difference and know whether you are relying on type coercion.  Always test your code thoroughly when you make these types of changes.

To help with your understanding of how JavaScript deals with "truth" and "equality", see the following article:

Related Problem: PRB760072

Seen In

Geneva Patch 8 Hot Fix 2

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:37:00