Configuring code linting in ServiceNow

Recently, Pathways has been working to update our coding standards and establish a new code review process internally.
In the search for tools to aid us, we came across a great new feature in the New York release of ServiceNow: customizable linting for the script editor. A more detailed explanation of linting can be found at the preceding link, but, to summarize, a linter analyzes source code for programming or stylistic errors based on a set of predefined rules.
This feature can be modified by editing the glide.ui.syntax_editor.linter.eslint_config system property.

There are several baseline options configured, and nearly all options listed on the website for esLint, a popular JavaScript linter, can be implemented in ServiceNow.


An example of the above highlighted rule being applied:



*We recommend implementing this first in a sandbox or developer instance, as you may find some of ServiceNow’s baseline functions and wrappers do not align with your selected linting options, leading to frustration from your development team with excessive warnings\errors that would be encountered when editing these scripts.*