Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 686333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:00:49+00:00 2026-05-14T02:00:49+00:00

I’m using GNU Emacs on Win32. I want to be able to run jslint

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:00:50+00:00Added an answer on May 14, 2026 at 2:00 am

    EDIT – There’s now a simplified module that does this for you.

    http://marmalade-repo.org/packages/fly-jshint-wsh

    This .el package:

    • downloads jshint or jslint for you (configurable)
    • applies the necessary WSH-friendly modifications I describe below
    • saves the modified result to a temporary file
    • invokes that script via flymake in js-mode buffers

    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:

     (function(){if(!JSLINT(WScript.StdIn.ReadAll(),.....
    

    Replace that (and everything that follows) with this:

    (function(){
        var filename = "stdin";
        var content= "";
        if (WScript.Arguments.length > 0){
            filename = WScript.Arguments(0);
            var fso = new ActiveXObject("Scripting.FileSystemObject");
            //var file = fso.GetFile(filename);
            var fs = fso.OpenTextFile(filename, 1);
            content = fs.ReadAll();
            fs.Close();
            fso = null;
            fs = null;
        } else {
            content = WScript.StdIn.ReadAll();
        }
        if(!JSLINT(content,{passfail:false})){
            WScript.StdErr.WriteLine("JSLINT");
            for (var i=0; i<JSLINT.errors.length; i++) {
                // sample error msg:
                //  sprintf.js(53,42) JSLINT: Use the array literal notation [].
                var e=JSLINT.errors[i];
                if (e !== null){
                    var line = (typeof e.line == "undefined")?'0':e.line;
                    WScript.StdErr.WriteLine(filename + '(' +line+','+e.character+') JSLINT: '+e.reason);
                    WScript.StdErr.WriteLine('    ' + (e.evidence||'').replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"));
                }
            }}}());
    

    This change does two things:

    1. allows you to specify the file to run lint on, on the command line, rather than as stdin. Stdin still works if no file is specified at all.
    2. emits the error messages in a format that is more similar to most C/C++ compilers.

    The first change allows you to invoke jslint.js from within emacs with M-x compile. The second allows you to interpet error messages with M-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:

     ;; JSLINT
     ("^[ \t]*\\([A-Za-z.0-9_: \\-]+\\)(\\([0-9]+\\)[,]\\( *[0-9]+\\))\\( Microsoft JScript runtime error\\| JSLINT\\): \\(.+\\)$" 1 2 3)
    

    In your javascript mode hook, set the compile command:

      (setq compile-command
           (let ((file (file-name-nondirectory buffer-file-name)))
             (concat "%windir%\\system32\\cscript.exe \\LOCATION\\OF\\jslint-for-wsh.js "  file)))
    

    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, and M-x next-error works as you expect.

    alt text

    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.

    alt text

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.