

So firstly, I embed the full JSLint JavaScript file, create a JavaScript context and run the JSLint code in order that JSLint can be ready for linting. So I went with JavaScript.NET and the V8 JavaScript engine. Jint has better support for integrating between C# and JavaScript, but JavaScript.NET used V8, so I felt it more likely to handle anything thrown at it. So, I found two JavaScript interpreters for C# - Jint, a parser written from scratch with the help of ANTLR and JavaScript.NET which was using the Google V8 JavaScript engine - used in chrome and the fastest JavaScript engine (as far as I know). But JSLint came up with compile errors and I quickly realised that I was trying to run it as JScript which is a Microsoft relative of JavaScript. My initial thought was to try to invoke windows script host directly, so I started looking at the Microsoft script compilers (thinking I could create whatever is used by wsh and run it in the same process). It might be more fun to try and run the JavaScript directly - no temporary files, no JSLint file location and quicker execution time.

When I looked at how it worked - which was to execute the wsh executable and parse the console result, I wasn't satisfied. Failed Attemptsįirstly, there is an existing plug-in for 2008 and my first port of call was to try upgrading this, so I followed the instructions but it seemed the plug-in was written a while ago and didn't follow a standard project structure. When it turned out I would be taking a train trip across France, it seemed the perfect opportunity to have a look at creating a Visual Studio 2010 plug-in.

I had been using the wsh (Windows Script Host) version of the file and executing it as a visual studio external tool, with the output going to the output window - which is fine except that after a while pressing Ctrl+G for each error got annoying. It's written in JavaScript and parses the file, ensures its validity, checks the rules you have switched on and can also report unused but defined variables. If you write JavaScript, it's a good idea to at least have read and understood the rules - quite often they are because something that is common in a language like C# could have unintended consequences because of the nuances of JavaScript, which is why its particularly important to Asp.NET developers where Microsoft has specifically attempted to make an API that is familiar to. Js Lint is a tool created by Douglas Crockford to parse JavaScript, report errors and ensure good coding practices.
