GithubHelp home page GithubHelp logo

smparkes / jslintrb Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 164 KB

Ruby gem driver for Douglas Crockford's jslint

Home Page: http://github.com/smparkes/jslintrb

License: Other

Ruby 0.09% JavaScript 99.91%

jslintrb's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.