我試圖修改我的gruntfile,但得到了很多關於我的縮進的錯誤。空格對於gruntfiles總是重要的嗎?解決這些錯誤的最好方法是什麼,計算空白?grunt空白/縮進錯誤
$ 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.
這只是jshint抱怨你的縮進不像它想的那麼整齊。使其停止產生這些錯誤的唯一方法是修復空白並繼續使用適當的空白以避免再次發生,或者可以將jshint設置爲忽略凌亂的空白,但我不知道該怎麼做。 – jonhopkins
所以這是一個jshint特定的事情。咕嚕不關心空白的權利? –
我不這麼認爲。我總是收到類似這樣的錯誤,因爲我使用標籤並忘記了項目中的其他人使用空格,但所有內容仍然運行。 – jonhopkins