Giter VIP home page Giter VIP logo

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.

jslintrb's People

Contributors

smparkes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jslintrb's Issues

Readme doesn't explain how to do globals

The Readme doesn't explain how to configure globals. This information isn't obvious on jslint.com either. Would be nice for the readme to say 'configure globals using "predef": ["myglobal"]'.

fix with processing

The with() code added doesn't actually add anything to the enclosed block's namespace for purposes of variable checking. Impossible to do in general, but for the case I want to use it for, I'd like just to add predefined members. That shouldn't be hard and is still safe. Then don't have to declare that all the with'd object's members are global.

rewrite the driver in ruby

The driver is actually mostly in javacript. That's kinda silly: it could be made less OS-specific and do better path manipulation using Ruby's OS interface.

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.