Home > jsLintWrapper

jsLintWrapper

JsLintWrapper is a project mainly written in JavaScript, it's free.

jsLint all of your javascript files in one go

h1. LintWrapper

h2. How it works

Well I am glad you asked ;) so currently if you want it without tinkering with files paths and what not you should put into into the root of your project or somewhere where the js files are desendants. Loading dependencies relative to the location of this batch is something that I am working on currently. Solution that currently works is to perhaps create your own makefile in the working directory and reference jsLintWrapper in there:

@lint: java -jar ../jsLintWrapper/lib/external/js.jar ../jsLintWrapper/bin/linter@

h2. Settings There are couple of ways to specify different options such as a you individual settings file

all of these settings can be attached as a json object in the command line

to specify relative settings file @ "commandlineOptions={configFile: 'conf/setting.js'}" @

to run on a single file only @ "commandlineOptions={configFile: 'conf/settings.js', :singleFile: 'one/file/of/javascript.js'} @

Probably best to add to your local rake/make/ant or what ever automation options you use currently

jslint is awesome ... but what is the best way to incorporate it into your development environment? And how do you set it up so that your can gradually grow your gigantic javascript library into a lintfree javascript. LintWrapper is how we are attempting to lint the codebase for patch.com. And I would like to extend this tool and see if any others out there have not found a suitable jslint solution that works for large code bases.

h2. Here is the benefits of LintWrapper

  • exclusion (such as libs that are not yours)
  • forgiveness day ... only deal with files after a date
  • ignore some js lint rules (idea snagged from jquery)
  • caching ... no need to check a file that is unchanged

Limitations are that it uses Rhino to run ... this means that you have to have to load up your JVM to run it ... but it does do some caching so it only checks files once and then rechecks them if there is a change.

@java -jar lib/external/js.jar bin/linter@

or better yet

@make lint@

then you can add configurations into the conf/settings.js file... this will be modularized further into the development of this tool.

Any help or ideas are super welcome and appreciated.

h2. Tested on?

I only have two machines that I test on mac and ubuntu netbook ... works on both with no problems. I am running java 1.6.x so presumably it might just work on any machine but then again I have run into problems on two different macs running the same version of java so I wouldn't be surprized if things got busted. If you have errors please notify me and I would be delighted to hear what solved it or I could help you troubleshoot. [email protected]

h2. Tips and Troubleshooting

sometimes it might be good to clear out your tmp/cache folder just to make sure that there aren't files lurking around in error etc