[英]How can I suppress the JSHint “JSCS: Illegal Space” warnings in Visual Studio 2013?
We're using JSHint in a Visual Studio 2013 solution. 我们在Visual Studio 2013解决方案中使用JSHint。 When building, we are seeing some formatting warnings for items that break style warnings, but are functionally valid.
在构建时,我们看到一些格式警告,用于破坏样式警告但在功能上有效的项目。 Specifically, I would like to suppress the "Illegal Space" warnings.
具体来说,我想压制“非法空间”的警告。 I consider warnings like this in the build error list visual chaff:
我在构建错误列表视觉糠中考虑这样的警告:
Here's why. 这就是原因。 I'm a fan of using the Visual Studio auto-formatting feature (Ctrl+K+D).
我喜欢使用Visual Studio自动格式化功能(Ctrl + K + D)。 In a scenario where a function is defined as follows...
在函数定义如下的场景中......
$select.find('option').each(function(){
... the auto formatting feature will change it to this: ...自动格式化功能会将其更改为:
$select.find('option').each(function () {
JSHint is valuable for finding other problems, like missing semicolons, so I'd prefer to continue using it in this project. JSHint对于发现其他问题很有价值,比如丢失分号,所以我更愿意继续在这个项目中使用它。 There is a settings file via Web Essentials > Edit Global JSHint Settings.
通过Web Essentials>编辑全局JSHint设置有一个设置文件。 But it's unclear to me what setting in that file I need to adjust to suppress those Illegal Space warnings.
但我不清楚我需要调整该文件中的哪个设置来抑制那些非法空间警告。
=== Update 4/6/2015 === === 2015年4月6日更新===
Based on the recommendation from Mike C below, the fix I applied is as follows: 根据下面Mike C的建议,我应用的修复如下:
That isn't a JSHint error, it's a JSCS error. 这不是JSHint错误,它是一个JSCS错误。 Under the Web Essentials menu click
Edit global JSCS settings (.jscsrc)...
. 在“Web Essentials”菜单下,单击“
Edit global JSCS settings (.jscsrc)...
。 Look for requireSpacesInAnonymousFunctionExpression
and change beforeOpeningRoundBrace
to false
. 寻找
requireSpacesInAnonymousFunctionExpression
和改变beforeOpeningRoundBrace
给false
。
See this JSCS reference for a list of all of the rules and their values. 请参阅此JSCS参考以获取所有规则及其值的列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.