Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Linting our code?

Syvo
Giga Guru

Hi all,

I'm trying to integrate Servicenow with a linting tool such as eslint or jslint, to enforce standard and custom best practices.
I can see Servicenow embeds Code mirror, which has an eslint plugin.

Is there a documented or undocumented way to add our configuration to the code mirror instances?

Thanks,
Sylvain

1 ACCEPTED SOLUTION

Syvo
Giga Guru

Replying to my own old question, answered by the New York release. Check out JavaScript syntax editor on docs.servicenow.com and the glide.ui.syntax_editor.linter.eslint_config sys property.

 

View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

I just looked at the store and share portal and don't see anything related to eslint or jslint.

Where did you find the info on Code Mirror?

Hi Chuck,

I inspected the DOM:

find_real_file.png

Then on the debugger tab you can search for "codemirror" and you find occurrences in /scripts/GlideEditor5Includes.jsx .

I can't see where I could inject some additional "gutter" such as eslint. That would be awesome!

Sebastian R_
Kilo Sage

You can also find CodeMirror in scripts/classes/syntax_editor5/GlideEditor.js.

However ServiceNow uses JSHint "/scripts/classes/syntax_editor2/jshint.js". Can´t you use JSHint instead of?

 

 

cburkins
Tera Contributor

I also would like my team to have an easier way to run eslint on their code within the ServiceNow instance.  Upvote !