Skip to content

smparkes/jslintrb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jslintrb

Description

jslintrb is a packaged version of Douglas Crockford’s JSLint JavaScript code checker. jslintrb uses SpiderMonkey via the Johnson Ruby gem to interpret the JSLint javascript.

Usage

jslintrb <javascript files to be checked>

You can provide .jslinrbrc files in the directory from which the command is run, the directory in which any file is found, and in any parent of that directory, to set jslint options. They are processed default first, then current directory, then ancestor directories, then the immediate parent. For example, I have a .jslintrbrc file in my top-level project directory that sets options for my project, then one in my spec directory (like a test directory) which adds the globals that exist for the tests but not for the core application code.

The file is JSON-formatted. See the jslint documentation (www.jslint.com/lint.html#options) for allowed options and an example at github.com/smparkes/env-js/blob/envjsrb/.jslintrbrc.

Differences from upstream

JSLint warns against using new to be evaluated soley for side-effects. jslintrb allows this if you set the “newside” option.

JSLint forbids the use void(x). I find this the cleanest/most reliable way of generating the undefined value, since the “undefined” variable can be defined. The “void” option enables the use of void.

Upstream recently added support for ECMAScript 5 getters and setters but this hasn’t been integrated yet. (Not sure about the requirements for paired getters/setters.) Nick Galbreath (blog.client9.com/) had the idea of just using a regexp to mangle the common cases for the purposes of jslint until upstream suports them. You can do this now in jslintrb by setting the “gettersetter” option to true. Note that this option has to be turned on in a .jslintrbrc file; it can’t be turned on with inline comments.

jslintrb copyright © 2010 Steven Parkes. See LICENSE for details. jslint copyright © 2002 Douglas Crockford. See lib/jslintrb/fulljslint.js for details.

About

Ruby gem driver for Douglas Crockford's jslint

Resources

License

Stars

Watchers

Forks

Packages

No packages published