I’m using GNU Emacs on Win32.
I want to be able to run jslint as a compilation on .js files, and then step through the errors that jslint reports.
I have jslint, the WScript version.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDIT – There’s now a simplified module that does this for you.
http://marmalade-repo.org/packages/fly-jshint-wsh
This .el package:
Easy peasy. Still Windows only though.
I kept all the old parts of this answer for reasons of historical interest, but you don’t need to
read any further.
Note – Below I describe how to modify jslint.js for use within emacs.
If you don’t want to do it yourself, the already-modified code required is available.
That link has an additional piece, flymake-for-jslint-for-wsh.el, that allows you to use jslint with flymake, on Windows.
To use jslint within emacs,
Download jslint.js, the WScript version.
Edit the jslint.js file. Scroll to the bottom and find this:
Replace that (and everything that follows) with this:
This change does two things:
The first change allows you to invoke jslint.js from within emacs with
M-x compile. The second allows you to interpet error messages withM-x next-error.Save that file to jslint-for-wsh.js
Then, in your init.el, or emacs.el, add to your
compilation-error-regexp-alist, this regexp:In your javascript mode hook, set the compile command:
That’s it.
When you then open a .js file, and run
M-x compile, you will run jslint.js on the existing buffer. You’ll get a list of errors, andM-x next-errorworks as you expect.Yipee!!
You can also run jslint as the flymake syntax checker tool, on Linux or Windows.
See http://www.emacswiki.org/emacs/FlymakeJavaScript for details.