如何从JavaScript中的JavaScript验证中排除Javascript文件 [英] How to exclude a Javascript file from Javascript Validation in Eclipse

查看:292
本文介绍了如何从JavaScript中的JavaScript验证中排除Javascript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有javascript验证工作对我自己的代码很好。我想保持验证。但是,当涉及到开源库(例如jquery)时,验证就会产生警告。



我不希望对下载的库发出警告。但是我想保留我的代码的警告。



我知道您可以在首选项>验证中排除文件验证 窗口,但 javascript验证不存在!我已经看过每个验证器,javascript验证器不在那里。



那么如何从验证中排除特定的文件?



以下是我的验证器列表:
截图



谢谢!



PS:我使用Eclipse PDT。

解决方案

好吧,可能我已经设法做你需要的东西;)这有点棘手。所以我的步骤:


  1. 下载Eclipse PDT(确定
    它适用于您,因为我使用
    Eclipse for Java EE)

  2. 创建项目TestJS(它是
    JavaScript项目)

  3. 创建了两个文件,test.js和
    htmlparser.js(最后一个从
    John Resig的网站复制)

  4. 在这两个文件中键入破碎脚本,所以Eclipse告诉我,两个他们

  5. 转到项目属性>
    JavaScript>包含路径>源

    已排除 要突出显示和
    按编辑按钮,这里您可以
    添加您要排除的
    (文件,文件夹,模式)。

  6. 我排除了test.js文件,按
    申请...

  7. ...得到一个快乐的结局:现在
    Eclipse指出我在htmlparser.js中有
    错误,但不是
    test.js;)

ScreenShot:



真的希望它有帮助!


I have the javascript validation working good for my own code. I want to keep the validation. But when it comes to open source library, like jquery for example, the validation creates warnings.

I don't want warnings over a downloaded library. But I want to keep warnings for my code.

I know you can exclude files from validation in the "Preferences > Validation" window, but the javascript validation is not there ! I've looked each validator, the javascript validator is not there.

So how can I exclude specific files from the validation ?

Here is the list of validators I have : Screenshot

Thanks !

PS : I use Eclipse PDT.!

解决方案

well, probably I've managed to do what you need ;) It is a bit tricky. So my steps:

  1. downloaded Eclipse PDT (to be sure that it works for you, because I use Eclipse for Java EE)
  2. created project TestJS (it was JavaScript project)
  3. created two files, test.js and htmlparser.js (last one copied from John Resig's site)
  4. typed "broken" script in both of them, so Eclipse told me that there were errors in both of them
  5. went to Project Properties > JavaScript > Include Path > Source, there is "Excluded" to highlight and press "Edit" button, here you are able to add what you want to exclude (file, folder, pattern).
  6. I excluded "test.js" file, pressed apply...
  7. ...and got a happy ending: now Eclipse point me out that there is error in htmlparser.js, but not in test.js ;)

ScreenShot:

Really hope that it helps!

这篇关于如何从JavaScript中的JavaScript验证中排除Javascript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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