Text File rules - JavaScript and CSS validation

The Rule-File-Text rule form supports validation errors and warnings for JavaScript and CSS files. This support makes JavaScript and CSS code easier to maintain and allows you to follow best practices while editing the rule.

Validation is performed at the client level without sending the content of the file back to the server for validation, freeing up resources and bandwidth. You can perform validation as needed by clicking Check JavaScript Syntax or Check CSS Syntax at the top of the rule form text area. Error icons are displayed next to the lines that contain errors.

The following types of errors can occur:

  • Critical error: For JavaScript files, you must fix critical errors before you save the file. CSS files can be saved, but you should fix the error before checking in the rule.
  • Warning error: In JavaScript files, warnings must be fixed before you save the file. In CSS files, warnings are best practices to adhere to .

For more details about JavaScript errors, go to http://eslint.org/docs/rules/ and append the text in parenthesis from the error at the end of the link.

JavaScript or CSS validation warnings generate a guardrail warning of moderate severity.

  • pxJavascriptSyntaxWarning - This guardrail warning indicates that the JavaScript file contains a warning error.
  • pxCSSSyntaxWarning - This warning indicates that the CSS contains a critical or warning error. The warning contains the number of critical and warning errors found during validation.

CSS validation might return a critical min-width error. The min-width: auto CSS is part of the flexbox layout module and is not part of the CSS3 specification. You can ignore this error