jshint怎么忽略不输出警告,只显示语法错误呢。

发布于 2022-09-01 07:07:16 字数 97 浏览 9 评论 0

在用grunt 开发的时候,导入了网上的js日期插件,导致代码风格与jshint定义的冲突,能运行,但是jshint 要报错,对于一个有代码洁癖的人来说,这是不能接受的。。。。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

固执像三岁 2022-09-08 07:07:16

配置https://www.npmjs.com/package/grunt-contrib-jshint,不需要的改成false,
具体选项参见http://blog.csdn.net/violet_day/article/details/18676577

options :{
jshintrc:{
    "curly"  : true,     // true: Require {} for every new block or scope
    "eqeqeq" : true,     // true: Require triple equals (===) for comparison
    "immed"  : true,    // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
    "latedef": true,    // true: Require variables/functions to be defined before being used
    "newcap" : true,    // true: Require capitalization of all constructor functions e.g. `new F()`
    "noarg"  : true,     // true: Prohibit use of `arguments.caller` and `arguments.callee`
    "sub"    : true,     // true: Prohibit use of empty blocks
    "undef"  : true,     // true: Require all non-global variables to be declared (prevents global leaks)
    "boss"   : true,     // true: Require all defined variables be used
    "eqnull" : true,     // true: Requires all functions run in ES5 Strict Mode
  "globals": {
    "jQuery": true       //可以使用jquery的函数
  }
}
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文