1

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.

Caroline
  • 1,582
  • 3
  • 16
  • 30

1 Answers1

2

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>
Alex Objelean
  • 3,893
  • 2
  • 27
  • 36
  • Thanks for that I didn't realise I needed to also specify 'white'. Also, I found it necessary to include 'indent=4' for the system to force 4 spaces (leaving as just 'indent' behaved as though I'd written 'indent=1'). In conclusion 'indent=4,white' worked a treat, thanks! – Caroline Sep 04 '12 at 12:57