执行grunt时linq.js抛出错误

时间:2014-03-15 22:32:15

标签: javascript gruntjs webstorm

在我的index.html中,我添加了这一行:

<script src="scripts/vendor/linq.js."></script>

My Web storm IDE说linq.js无法解析。

但道路肯定是正确的,我多次检查过......

当我运行grunt时,它说有51个错误,从:

开始

似乎web风暴还有其他代码格式,因为grunt正在使用...

app/scripts/vendor/linq.js
  line 12  col 5   Missing "use strict" statement.
  line 16  col 5   Expected '}' to have an indentation at 7 instead at 5.
  line 22  col 26  Strings must use singlequote.
  line 26  col 5   Expected '}' to have an indentation at 7 instead at 5.
...

可能是什么错误?

更新

查看图像,linq.js的路径是正确的。

enter image description here

当我运行咕噜声时,由于上面提到的51个问题而中止...

更新2:

我现在删除了<script linq.js...>并重新运行grunt,但仍然出现同样的错误。

所以在我看来,足够的理由是我在脚本文件夹下有一个.js文件,它在某种程度上没有正确格式化为jshint任务,因为它在这里被中止。

我仍然找到了这个链接:JSHint behave differently in Webstorm and Grunt

看起来和我非常相似,我会尝试一下!

更新3

这些是完整的错误列表:

我不想更改第三方脚本只是为了满足我的IDE代码格式设置,这是愚蠢的......

应用程序/脚本/供应商/ linq.js

 line 12  col 5   Missing "use strict" statement.
  line 16  col 5   Expected '}' to have an indentation at 7 instead at 5.
  line 22  col 26  Strings must use singlequote.
  line 26  col 5   Expected '}' to have an indentation at 7 instead at 5.
  line 29  col 25  Strings must use singlequote.
  line 35  col 28  Expected '===' and instead saw '=='.
  line 35  col 37  Expected '{' and instead saw 'return'.
  line 38  col 17  Expected 'var' to have an indentation at 15 instead at 17.
  line 39  col 17  Expected 'if' to have an indentation at 15 instead at 17.
  line 39  col 23  Expected '!==' and instead saw '!='.
  line 40  col 21  Expected 'return' to have an indentation at 17 instead at 21.
  line 41  col 17  Expected '}' to have an indentation at 15 instead at 17.
  line 43  col 17  Expected 'if' to have an indentation at 15 instead at 17.
  line 43  col 44  Strings must use singlequote.
  line 44  col 21  Expected 'var' to have an indentation at 17 instead at 21.
  line 44  col 51  Strings must use singlequote.
  line 44  col 56  Strings must use singlequote.
  line 46  col 21  Expected 'var' to have an indentation at 17 instead at 21.
  line 47  col 21  Expected 'var' to have an indentation at 17 instead at 21.
  line 48  col 21  Expected 'while' to have an indentation at 17 instead at 21.
  line 48  col 62  Expected '!==' and instead saw '!='.
  line 49  col 25  Expected 'var' to have an indentation at 19 instead at 25.
  line 50  col 25  Expected 'if' to have an indentation at 19 instead at 25.
  line 51  col 29  Expected 'maxLength' to have an indentation at 21 instead at 29.
  line 52  col 25  Expected '}' to have an indentation at 19 instead at 25.
  line 53  col 21  Expected '}' to have an indentation at 17 instead at 21.
  line 55  col 21  Expected 'var' to have an indentation at 17 instead at 21.
  line 56  col 21  Expected 'for' to have an indentation at 17 instead at 21.
  line 57  col 25  Expected 'var' to have an indentation at 19 instead at 25.
  line 57  col 40  Strings must use singlequote.
  line 58  col 25  Expected 'for' to have an indentation at 19 instead at 25.
  line 59  col 29  Expected 'dollar' to have an indentation at 21 instead at 29.
  line 59  col 42  Strings must use singlequote.
  line 60  col 25  Expected '}' to have an indentation at 19 instead at 25.
  line 61  col 25  Expected 'argArray' to have an indentation at 19 instead at 25.
  line 62  col 21  Expected '}' to have an indentation at 17 instead at 21.
  line 64  col 21  Expected 'var' to have an indentation at 17 instead at 21.
  line 64  col 71  Strings must use singlequote.
  line 66  col 21  Expected 'f' to have an indentation at 17 instead at 21.
  line 66  col 37  The Function constructor is a form of eval.
  line 66  col 53  Strings must use singlequote.
  line 67  col 21  Expected 'funcCache' to have an indentation at 17 instead at 21.
  line 68  col 21  Expected 'return' to have an indentation at 17 instead at 21.
  line 69  col 17  Expected '}' to have an indentation at 15 instead at 17.
  line 71  col 21  Expected 'var' to have an indentation at 17 instead at 21.
  line 72  col 21  Expected 'f' to have an indentation at 17 instead at 21.
  line 72  col 37  The Function constructor is a form of eval.
  line 72  col 56  Strings must use singlequote.
  line 73  col 21  Expected 'funcCache' to have an indentation at 17 instead at 21.
  line 74  col 21  Expected 'return' to have an indentation at 17 instead at 21.
  line 74  col 21  Too many errors. (2% scanned).

1 个答案:

答案 0 :(得分:0)

.标记的linq.js属性中的src之后您还有script个{{1}}。 Grunt错误看起来像是linting警告,而不是错误(更新:我的意思是,不是代码中的错误)。