Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt whitespace/indentation errors

Tags:

gruntjs

jshint

I tried to modify my gruntfile but am getting a ton of errors about my indentation. Is whitespace always important for gruntfiles? What's the best way to fix these errors, counting whitespaces?

$ grunt
Running "newer:jshint" (newer) task

Running "newer:jshint:all" (newer) task

Running "jshint:all" (jshint) task

Gruntfile.js
  line 33  col 11  Expected 'options' to have an indentation at 9 instead at 11.
  line 36  col 7   Expected '}' to have an indentation at 9 instead at 7.
  line 37  col 7   Expected 'js' to have an indentation at 9 instead at 7.
  line 38  col 9   Expected 'files' to have an indentation at 11 instead at 9.
  line 39  col 9   Expected 'tasks' to have an indentation at 11 instead at 9.
  line 40  col 9   Expected 'options' to have an indentation at 11 instead at 9.
  line 41  col 11  Expected 'livereload' to have an indentation at 13 instead at 11.
  line 42  col 9   Expected '}' to have an indentation at 11 instead at 9.
  line 43  col 7   Expected '}' to have an indentation at 9 instead at 7.
  line 43  col 9   Trailing whitespace.
  line 44  col 7   Expected 'compass' to have an indentation at 9 instead at 7.
  line 45  col 9   Expected 'files' to have an indentation at 11 instead at 9.
  line 46  col 9   Expected 'tasks' to have an indentation at 11 instead at 9.
  line 47  col 7   Expected '}' to have an indentation at 9 instead at 7.
  line 48  col 7   Expected 'gruntfile' to have an indentation at 9 instead at 7.
  line 49  col 9   Expected 'files' to have an indentation at 11 instead at 9.
  line 50  col 7   Expected '}' to have an indentation at 9 instead at 7.
  line 51  col 7   Expected 'livereload' to have an indentation at 9 instead at 7.
  line 52  col 9   Expected 'options' to have an indentation at 11 instead at 9.
  line 53  col 11  Expected 'livereload' to have an indentation at 13 instead at 11.
  line 54  col 9   Expected '}' to have an indentation at 11 instead at 9.
  line 55  col 9   Expected 'files' to have an indentation at 11 instead at 9.
  line 56  col 11  Expected '<%= yeoman.app %>/{,*/}*.html' to have an indentation at 13 instead at 11.
  line 57  col 11  Expected '.tmp/styles/{,*/}*.css' to have an indentation at 13 instead at 11.
  line 58  col 11  Expected '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' to have an indentation at 13 instead at 11.
  line 59  col 9   Expected ']' to have an indentation at 11 instead at 9.
  line 60  col 7   Expected '}' to have an indentation at 9 instead at 7.
  line 61  col 5   Expected '}' to have an indentation at 7 instead at 5.
  line 64  col 5   Expected 'connect' to have an indentation at 7 instead at 5.
  line 65  col 7   Expected 'options' to have an indentation at 9 instead at 7.
  line 66  col 9   Expected 'port' to have an indentation at 11 instead at 9.
  line 68  col 9   Expected 'hostname' to have an indentation at 11 instead at 9.
  line 69  col 9   Expected 'livereload' to have an indentation at 11 instead at 9.
  line 70  col 7   Expected '}' to have an indentation at 9 instead at 7.
  line 71  col 7   Expected 'livereload' to have an indentation at 9 instead at 7.
  line 72  col 9   Expected 'options' to have an indentation at 11 instead at 9.
  line 73  col 11  Expected 'open' to have an indentation at 13 instead at 11.
  line 74  col 11  Expected 'base' to have an indentation at 13 instead at 11.
  line 75  col 13  Expected '.tmp' to have an indentation at 15 instead at 13.
  line 76  col 13  Expected '<%= yeoman.app %>' to have an indentation at 15 instead at 13.
  line 77  col 11  Expected ']' to have an indentation at 13 instead at 11.
  line 78  col 9   Expected '}' to have an indentation at 11 instead at 9.
  line 79  col 7   Expected '}' to have an indentation at 9 instead at 7.
  line 80  col 7   Expected 'test' to have an indentation at 9 instead at 7.
  line 81  col 9   Expected 'options' to have an indentation at 11 instead at 9.
  line 82  col 11  Expected 'port' to have an indentation at 13 instead at 11.
  line 83  col 11  Expected 'base' to have an indentation at 13 instead at 11.
  line 84  col 13  Expected '.tmp' to have an indentation at 15 instead at 13.
  line 85  col 13  Expected 'test' to have an indentation at 15 instead at 13.
  line 86  col 13  Expected '<%= yeoman.app %>' to have an indentation at 15 instead at 13.
  line 86  col 13  Too many errors. (21% scanned).

✖ 51 problems

Warning: Task "jshint:all" failed. Use --force to continue.
like image 915
Connor Leech Avatar asked Feb 06 '14 13:02

Connor Leech


2 Answers

Comment out the 'indent' property in the .jshintrc file, or perhaps in the package.json. Doing a global find on the word 'indent' should get you there.

I find white space really adds to the readability of code, particularly JS. So much so, that I don't know that it should be linted at all, particularly since it has no affect on how the JS is executed.

like image 173
nullsteph Avatar answered Nov 09 '22 09:11

nullsteph


You may be getting the indent errors from 'lint'.

If you have an 'eslintrc' file you can remove the following line from the rules key value pairs

' indent: [2, 2, {"SwitchCase": 1}],'

like image 26
Brian Quinn Avatar answered Nov 09 '22 09:11

Brian Quinn