如何使用 Chirpy 设置 JSHint 选项?
我在 Visual Studio 2010 中使用 Chirpy (http://chirpy.codeplex.com/) 并且 JSHint 正在运行。问题是,我不知道如何设置 JSHint 的选项,甚至不知道如何查看默认情况下打开的选项。
我尝试了内联语法(见下文),但 Chirpy 似乎忽略了这一点。有谁知道如何设置选项吗?
/*jshint evil: true, boss: true */
I am using Chirpy (http://chirpy.codeplex.com/) inside Visual Studio 2010 and I've got JSHint running. The problem is, I don't know how to set the options for JSHint, or even to see what options are on by default.
I tried the inline syntax (see below) but Chirpy seems to ignore that. Does anyone know how to set the options?
/*jshint evil: true, boss: true */
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有点尴尬,但也很高兴地说内联语法确实有效。然而,由于默认选项,很难说清楚。
我通读了大部分 Chirpy 代码库以及 UglifyJS 的代码库,发现 Chirpy 只是将选项的所有值设置为 false。这意味着它不需要太多 JavaScript 代码。
要打开最严格的 JSHint 选项,请在 JS 文件顶部使用此选项:
注意,您不能在 /* 和 jshint 之间放置空格。如果您这样做,Chirpy 会忽略它。
I am slightly embarrassed but also pleased to say that the inline syntax does work. However because of the default options it is hard to tell.
I read through most of the Chirpy code base as well as the code base for UglifyJS to figure out that Chirpy just sets all the values for the options to false. This means it doesn't require much of your JavaScript code.
To turn on the strictest JSHint options, using this at the top of your JS file:
Note, you cannot put a space between /* and jshint. Chirpy will ignore it if you do.