VisualStudio中的JsHint与Ext Js [英] JsHint with Ext Js in VisualStudio

查看:156
本文介绍了VisualStudio中的JsHint与Ext Js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ext Js和Visual Studio。使用_references.js我可以得到智能感知工作。我可以在这里为JsHint添加Ext的定义:






但是关于ext-all-debug.js仍然有500个错误



我想知道如果使用JsHint在我的项目中添加任何值。 Visual Studio似乎照顾了真正的JavaScript语法错误。



一些警告示例:

  JsHint(W116):期待'===',而是看到'=='。 

或:

 code> JsHint(W083):不要在循环中进行功能。 

我应该完全禁用JSHint还是尝试更好地配置?



当一个主要的框架不遵守规则,那么为什么我应该呢?



更新:
在网络必要条件可以创建一个名为something.weignore的文件。它遵循与.jshintignore相同的语法。



资料来源: http://vswebessentials.com/features/general

解决方案

你绝对不应该运行linter over EXT-ALL-debug.js。忽略在项目根目录下使用一个名为.jshintignore的文件,并将ext-all-debug.js的路径放在那里。 .jshintignore的内容示例可以是:

  content / js / extjs5.1 / ext-debug-all.js 
content / js / jquery.js

这将告诉jshint忽略jquery.js和ExtJS的。您也可以排除整个目录。看看jshint忽略jQuery项目:



https://github.com/jquery/jquery/blob/master/.jshintignore

  external 
src / intro.js
src / outro.js
test / data / jquery-1.9.1.js
test / data / badcall.js
test / data / badjson.js
test / data / json_obj.js
test / data / readywaitasset.js
test / data / readywaitloader.js
test / data /支持/ csp.js
test / data / support / getComputedSupport.js

可能Ext JS正在努力在内部解决这些错误,也许他们只是不在乎。但不要让别人的守则对你自己的行为产生不利影响。如果你觉得你会使用jshint编写更好的代码,然后使用它!你看到的警告背后有很好的理由。


I am working with Ext Js and Visual Studio. With _references.js I can get the intellisense working. I can add a definition for "Ext" in here for JsHint:

But it still thows 500 errors about ext-all-debug.js

I am wondering if using JsHint here adds any value to my project. Visual Studio seems to take care of true JavaScript syntax errors.

Some examples of the warnings:

JsHint (W116): Expected '===' and instead saw '=='.

or:

JsHint (W083): Don't make functions within a loop.

Should I disable JSHint completely or try to configure it better?

When a major framework does not respect the rules then why should I?

Update: In web essentials you can create a file called something.weignore. It follows the same syntax than .jshintignore.

Source: http://vswebessentials.com/features/general

解决方案

You definitely shouldn't be running the linter over ext-all-debug.js. Ignore that using a file called .jshintignore in the root of your project and put the path of ext-all-debug.js in there. An example of the content of .jshintignore could be:

content/js/extjs5.1/ext-debug-all.js
content/js/jquery.js

This would tell jshint to ignore jquery.js and extjs. You can also exclude whole directories. Take a look at the jshint ignore for the jQuery project:

https://github.com/jquery/jquery/blob/master/.jshintignore

external
src/intro.js
src/outro.js
test/data/jquery-1.9.1.js
test/data/badcall.js
test/data/badjson.js
test/data/json_obj.js
test/data/readywaitasset.js
test/data/readywaitloader.js
test/data/support/csp.js
test/data/support/getComputedSupport.js

Maybe Ext JS is working to address those errors internally, maybe they just don't care. But don't let another person's code practises negatively affect your own. If you feel you'll be writing better code by using jshint then use it! There are good reasons behind the warnings you are seeing.

这篇关于VisualStudio中的JsHint与Ext Js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆