Sha256: 469a421de26f484f80ded26e1af55c2f65ba766927967d93518568a30b1d7664

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 KB

Contents

// rhino.js
// 2009-09-11
/*
Copyright (c) 2002 Douglas Crockford  (www.JSLint.com) Rhino Edition
*/

// This is the Rhino companion to fulljslint.js.

/*global JSLINT */
/*jslint rhino: true, strict: false */

(function (a) {
    var e, i, options, arg;
    if (!a[0]) {
        print("Usage: jslint.js [options] file.js");
        quit(1);
    }
    options = {
        rhino: true,  passfail:false,
        bitwise: true, eqeqeq: true, immed: true,
        newcap: true, nomen: true, onevar: true, plusplus: true,
        regexp: true,  undef: true, white: true
    };
    while((arg = a.shift())) {
        if (arg.match(/^--no(\w+)$/)) {
            options[RegExp.$1] = false;
        }
        else if (arg.match(/^--(\w+)=(\S.*)$/)) {
            options[RegExp.$1] = JSON.parse(RegExp.$2);
        }
        else if (arg.match(/^--(\w+)$/)) {
            options[RegExp.$1] = true;
        }
        else {
            var filename = arg
            var input = readFile(filename);
            if (!input) {
                print("jslint: Couldn't open file '" + filename + "'.");
                quit(1);
            }
        }
    }
    if (!JSLINT(input, options)) {
        for (i = 0; i < JSLINT.errors.length; i += 1) {
            e = JSLINT.errors[i];
            if (e) {
                print('Lint at line ' + e.line + ' character ' +
                        e.character + ': ' + e.reason);
                print((e.evidence || '').
                        replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
                print('');
            }
        }
        quit(2);
    } else {
        print("jslint: No problems found in " + a[0]);
        quit();
    }
}(arguments));

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jslint-1.0.5 jslint/rhino.js
jslint-1.0.4 jslint/rhino.js
jslint-1.0.1 jslint/rhino.js
jslint-1.0.0 jslint/rhino.js