# Additional Code Validation Using JSLint Plugin

**URL:** <https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780>\
**Category:** Classic Servoy\
**Created:** [March 25, 2011, 3:32pm UTC](https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780 "2011-03-25T15:32:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsummerhays](https://avatars.discourse-cdn.com/v4/letter/h/df788c/32.png) [@hsummerhays](https://forum.servoy.com/u/hsummerhays)\
**Post date:** [March 25, 2011, 3:32pm UTC](https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780/1 "2011-03-25T15:32:27Z")

</div>

Hello all,

The other day I was wishing I had a tool that would help me make sure my JavaScript code was formatted cleanly and correctly. Servoy 6 helps find all kinds of JavaScript problems, but still I wanted more (because I have used Stylecop for C# ![:?]( "Confused") ). The answer I found was the free JSLint Eclipse Plugin from Rock Star Apps. It was easy to install - simply went to Help - Install Software - Input [http://update.rockstarapps.com](http://update.rockstarapps.com) - and Selected Rockstar JsLint. The settings I used are shown below. You just have to right-click your code and then select Rockstarapps - Validate with JSLint. I don’t know if anyone else will find this useful, but I thought I’d share anyway.

JSLint helps you to: format your code consistently, find coding mistakes that Servoy 6 misses (e.g. improper use of “for (myElement in myArray)”), etc.

[attachment=2]3-17-2011 11-31-52 AM.gif[/attachment]

[attachment=1]3-17-2011 11-56-27 AM.gif[/attachment]

[attachment=0]3-25-2011 8-57-57 AM.gif[/attachment]

 ![3-25-2011 8-57-57 AM.gif](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/4/43af482bddd9d2c800f3cc1f3f7168983bb4df85.gif)

 ![3-17-2011 11-56-27 AM.gif](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/e/eefcaabc22d3e70e3d627c8c764df0b59a549230.gif)

 ![3-17-2011 11-31-52 AM.gif](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/6/63e2f20743ba05b30d694600f7814968f667a2dd.gif)

---

<div class="post-metadata">

**Author:** ![hsummerhays](https://avatars.discourse-cdn.com/v4/letter/h/df788c/32.png) [@hsummerhays](https://forum.servoy.com/u/hsummerhays)\
**Post date:** [July 22, 2011, 4:40pm UTC](https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780/2 "2011-07-22T16:40:04Z")

</div>

When using object[“method”] notation (instead of object.method) to hide errors when calling protoype methods in Servoy 6, you must set JsLint to “Tolerate inefficient subscripting”, otherwise it will tell you to change the notation back to object.method.

---

<div class="post-metadata">

**Author:** ![hsummerhays](https://avatars.discourse-cdn.com/v4/letter/h/df788c/32.png) [@hsummerhays](https://forum.servoy.com/u/hsummerhays)\
**Post date:** [January 30, 2012, 10:22pm UTC](https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780/3 "2012-01-30T22:22:12Z")

</div>

Hello all,

I noticed recently that [rockstarapps.com](http://rockstarapps.com) is out of commission. If you want to use jslint with Servoy, here are some new instructions for doing so.

1. Install “Javascript Development Tools” and jslint4java in Eclipse using Help – Install New Software from the following site: [https://svn.codespot.com/a/eclipselabs. … 1/download](https://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/jslint4java1/download). See [http://www.andyjamesdavies.com/javascri … clipse-ide](http://www.andyjamesdavies.com/javascript/installing-jslint-on-eclipse-ide) for detailed instructions.
2. Under Preferences – jslint4java, enable the settings shown here or as desired:  
[attachment=0]Eclipse jslint4java Options 2012-01-30.png[/attachment]
3. Enable it for your project by right clicking your project and choosing “Enable jslint4java”.

Notes:

1. It may be necessary to do a Project – Clean to get the new warnings to show up.
2. Be aware that the “Empty Block” warning shows up on the line after an empty block. It can be confusing if you don’t know this.
3. The first time I installed this, I may have done something wrong because none of the Servoy code completion functionality was working. However, uninstalling and reinstalling “Javascript Development Tools” and jslint4java in Eclipse fixed the problem.

 ![Eclipse jslint4java Options 2012-01-30.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/1X/00417e9c02f6e172d35089adbb39159e52317bb1.png)

---

<div class="post-metadata">

**Author:** ![japink.m](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@japink.m](https://forum.servoy.com/u/japink.m)\
**Post date:** [July 12, 2015, 7:43pm UTC](https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780/4 "2015-07-12T19:43:40Z")

</div>

I installed JSLint in Servoy (Eclips). Installation was pretty straight forward, thanks for your post.

I still have a question about configuring JSLint.  
JSLint is complaining about all Servoy keywords, like ‘scopes’, ‘globals’, ‘databaseManager’, ‘utils’, etc and relations.  
Most keywords can be excluded by the “Names of predefined global variables” field in the preferences as you showed,

But how can I make JSLInt understand relations?

---

<div class="post-metadata">

**Author:** ![hsummerhays](https://avatars.discourse-cdn.com/v4/letter/h/df788c/32.png) [@hsummerhays](https://forum.servoy.com/u/hsummerhays)\
**Post date:** [July 13, 2015, 3:07pm UTC](https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780/5 "2015-07-13T15:07:22Z")

</div>

Unfortunately, the only way around it that I know of is to use bracket notation (e.g. instead of foo.bar, use foo[bar]).

---

<div class="post-metadata">

**Author:** ![japink.m](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@japink.m](https://forum.servoy.com/u/japink.m)\
**Post date:** [July 13, 2015, 7:57pm UTC](https://forum.servoy.com/t/additional-code-validation-using-jslint-plugin/13780/6 "2015-07-13T19:57:02Z")

</div>

Thanks for your reply. A bit dissapoinitng how many false-warnings are generated, but I’ll give it a try.
