Skip to content


Update of jshint to 2.1.4 #29

Knusp opened this Issue · 9 comments

5 participants


Thank You!


Phil, let me know if we can do anything to help get this going. I'm super new to jshint but I need to get our build going with a 2.x version so it doesn't differ so much from my team's use of the eclipse plugin. If you have an idea of how hard it will be to upgrade the plugin let me know and I may be able to contribute.


Let me see this weekend.


Is it possible, to change the request to jshint 2.1.6? The new version came out just yesterday: .

Thank you!


I ended up just exec tasking to the jshint command line. That'll do for me for now.


Any news on that issue?

We are using the jshint-eclipse integration plugin in the development environment. This plugin is using the version 2.1.10 of jshint in which some behavior has changed (for ex for trailing whitespace in the comments...)

As a consequence we would like to use the same version of jshint in our ant-based build.
But it is not possible to use a jshint recent release....(tried with 2.1.10, 2.1.11, ...)



@kruser Can you show me the way you achieve this? Thanks in advance! :)


@Knusp - it's more simple on unix-only. Someone here has updated our builds to work on either NodeJS for windows or linux though, so here are those details.

First, install NodeJS and the jshint module.

Then, in your Ant build file, define the module that can exec to this jshint module on either OS:

    <macrodef name="exec-node">
        <attribute name="module" description="The name of the NodeJS module to execute"/>
        <attribute name="failonerror" default="true" description="Fail if the exit code is not 0"/>
        <element name="args" implicit="yes" description="Argument to pass to the exec task"/>
            <exec executable="cmd.exe" failonerror="@{failonerror}" osfamily="winnt">
              <!-- Windows cmd output workaround: -->
              <!-- Forces node's stderror and stdout to a temporary file -->
              <arg line=" &gt; _tempfile.out 2&lt;&amp;1"/>

              <!-- If command exits with an error, then output the temporary file        -->
              <!-- to stdout delete the temporary file and finally exit with error level 1  -->
              <!-- so that the apply task can catch the error if @failonerror="true"        -->
              <arg line=" || (type _tempfile.out &amp; del _tempfile.out &amp; exit /b 1)"/>

              <!-- Otherwise, just type the temporary file and delete it-->
              <arg line=" &amp; type _tempfile.out &amp; del _tempfile.out &amp;"/>      

        <arg line="/c  @{module}" />
            <exec executable="@{module}" failonerror="@{failonerror}" osfamily="unix">

Then we simple add a new target that allows us to 'ant jshint'. The node executable sends back the correct return code and we failonerror in our macro definition such that our continuous build server does the right thing.

    <target name="jshint">
        <echo message="Executing jshint against the source"></echo>
        <exec-node module="jshint">
            <arg value="--config=../coding-standards/jshint/options.json" />
            <arg value="${src.dir}" />

Thank you @kruser ! :)

I encountered an "out of range index exception" with the current versions of JSHint (2.2 to 2.4.2), so I had to downgrade to 2.1.11:

FYI: This bug will be fixed soon: jshint/jshint#1333


FWIW, I've submitted a pull request (#32) that upgrades ant-jshint to use JSHint 2.4.4, and which works around the JSHint/Rhino problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.