Search code examples
mavenpluginsjshintwro4j

How can I configure standardised indentation using JsHint and the wro4j plugin?


I would like to force 4 spaces as the default and required indentation for my whole js codebase.

I have managed to the jshint wro4j plugin to work and obey options:

<options>browser,newcap,noarg,nonew,undef,trailing</options>

However, for indentation, I need to specify the spaces required:

/*jshint indent:4 */

but there appears to be no facility to do this?

I'm not sure how I should be applying this option correctly as any of the layouts I've tried throw errors as being invalid options.


Solution

  • You can force the indentation rule check by adding the following rules:

    <option>indent,white</option>
    

    By default the indentation is set to 4 characters. If you want to set a different value, use this:

    <option>indent=2,white</option>