简体   繁体   中英

Which JSlint I should be using?

I have searched in old question. Everyone is giving different suggestion for jslint utility. I want jslint console utility which works on linux console. I tried this one http://www.javascriptlint.com/ but it don't work properly. One example it don't give error if you missed writing var before variable declaration.

Is there any standard command line utility for jslint?

Edit

I tried https://github.com/reid/node-jslint this also works good. But don't know if it is recommended.

About jshint

  client.on('JOB_CREATED', function(handle) {
    sessionid=[];
    return console.log('job created', handle);
    //Do connection close and cleanup                                                                                                                  

  });

Why it is not giving error for sessionid=[];

2¢ -- Yes, as you've added, if you want to run jslint on the command line, Node is currently the way to do it. So you've answered your own question.

For which JSLint package, I don't see anything particularly wrong about reid's implementation. Check out its code :

/*jslint
    nomen: true
 */
var vm = require("vm");
var fs = require("fs");

var ctx = vm.createContext();

vm.runInContext(fs.readFileSync(__dirname + "/jslint.js"), ctx);

module.exports = ctx.JSLINT;

That looks fine. Not that it means much, but npm info jslint points you to the same package, so you're okay, though there are a number of others... npm search jslint pops up a good number, many of which are command-line jslinters.

I want to say I've heard of JSLintCli before, but if reid's is working, it's more recently updated. JSLinting with Node is a simple enough process that you're going to be fine. Would be fun to write your own wrapper.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM