How to Install Jslint on Ubuntu

How do I install JSLint on Ubuntu?

Here are the instructions I followed to have jslint working on Ubuntu 10.10/Vim 7.3 (and Mac OS X).

EDIT

So, I've just spotted a mistake in the given link. Here are the correct steps (assuming you have already downloaded and unpacked the archive to your desktop:

$ cd /path/to/jsl-0.3.0/src
$ make -f Makefile.ref
$ cp Linux_All_DBG.OBJ/jsl /usr/local/bin/jsl

At that point you can open a new terminal window and type $ jsl to display a quick help or invoke it from Vim or directly on a file in the terminal.

END EDIT

  • /usr/local/bin is not your "PATH", it's only one of the many directories that can be part your PATH environment variable. $ echo $PATH will tell you what these directories are and thus where you can put the jsl executable. You can also put it in another place and add an alias to your .bashrc.

  • Why do you expect to be able to run jslint from rhino?

Install JSL or JSlint with Node/Npm on Ubuntu

Have you tried install nodeJS from the website, that will also install npm. Once both are installed, you may simply run npm install jslint .

How to install JsHint for Rhino and vim on ubuntu 11.10

It would be more easier to use node/npm to install jshint:

  1. grab nave from github
  2. sudo nave usemain latest
  3. npm install jshint

How to do JSLint in Vim

You can follow the intructions from JSLint web-service + VIM integration or do what I did:

Download http://jslint.webvm.net/mylintrun.js and http://www.jslint.com/fulljslint.js
and put them in a directory of your choice.

Then add the following line to the beginning of mylintrun.js:

var filename= arguments[0];

and change last line of code in mylintrun.js ("print( ...)") to:

 print ( filename + ":" + (obj["line"] + 1) + ":" + (obj["character"] + 1) + ":" + obj["reason"] );

This makes in mylintrun.js output a error list that can be used with the VIM quickfix window (:copen).

Now set the following in VIM:

set makeprg=cat\ %\ \\\|\ /my/path/to/js\ /my/path/to/mylintrun.js\ %
set errorformat=%f:%l:%c:%m

where you have to change /my/path/to/js to the path to SpiderMonkey and /my/path/to/mylintrun.js to the path where you put the JS files.

Now, you can use :make in VIM and use the quickfix window (:he quickfix-window) to jump from error to error.

Visual Studio Code Error - Failed to load jshint library

You'll need to follow the prompt and install jshint.

For just the workspace

npm install jshint

or

For all your workspaces

npm install -g jshint



Related Topics



Leave a reply



Submit