如何从我的 eclipse 项目中删除 javascript 验证?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3131878/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 03:22:44  来源:igfitidea点击:

How do I remove javascript validation from my eclipse project?

javascriptjqueryeclipsevalidationsyntax

提问by Ritesh M Nayak

I am using eclipse on my project and while messing around with my eclipse settings, I turned on Javascript support. Now eclipse complains that JQuery library has errors in it and is not letting me compile the project. Does anyone know how to turn javascript validation off?

我在我的项目中使用了 eclipse 并且在处理我的 eclipse 设置时,我打开了 Javascript 支持。现在 eclipse 抱怨 JQuery 库中有错误并且不让我编译项目。有谁知道如何关闭javascript验证?

回答by Alexander Pogrebnyak

I actually like MY JavaScript files to be validated, but I definitely don't want to validate and deal with trivial warnings with third party libraries.

我实际上喜欢验证我的 JavaScript 文件,但我绝对不想验证和处理第三方库的琐碎警告。

That's why I think that turning off validation all together is too drastic. Fortunately with Eclipse, you can selectively remove some JavaScript sources from validation.

这就是为什么我认为一起关闭验证太激烈了。幸运的是,使用 Eclipse,您可以有选择地从验证中删除一些 JavaScript 源。

  1. Right-click your project.
  2. Navigate to: Properties → JavaScript → Include Path
  3. Select Sourcetab. (It looks identical to Java Build Path Source tab.)
  4. Expand JavaScript source folder.
  5. Highlight Excludedpattern.
  6. Press the Editbutton.
  7. Press the Addbutton next to Exclusion patternsbox.
  8. You may either type Ant-style wildcard pattern, or click Browsebutton to mention the JavaScript source by name.
  1. 右键单击您的项目。
  2. 导航到:属性 → JavaScript → 包含路径
  3. 选择Source选项卡。(它看起来与 Java Build Path Source 选项卡相同。)
  4. 展开 JavaScript 源文件夹。
  5. 突出Excluded图案。
  6. 按下Edit按钮。
  7. 按框Add旁边的按钮Exclusion patterns
  8. 您可以输入 Ant 风格的通配符模式,也可以单击Browse按钮以按名称提及 JavaScript 源。

The information about JavaScript source inclusion/exclusion is saved into .settings/.jsdtscopefile. Do not forget to add it to your SCM.

有关 JavaScript 源包含/排除的信息保存到.settings/.jsdtscope文件中。不要忘记将它添加到您的 SCM。

Here is how configuration looks with jQuery files removed from validation:

以下是从验证中删除的 jQuery 文件的配置外观:

Eclipse - Project Properties - JavaScript - Include Path

Eclipse - 项目属性 - JavaScript - 包含路径

回答by Brad Marchesseault

Turn off the JavaScript Validator in the "Builders" config for your project:

在您的项目的“Builders”配置中关闭 JavaScript 验证器:

  1. Right click your project
  2. Select Properties -> Builders
  3. Uncheck the "JavaScript Validator"
  1. 右键单击您的项目
  2. 选择属性 -> 构建器
  3. 取消选中“JavaScript 验证器”

Then either restart your Eclipse or/and rename the .js to something like .js_ then back again.

然后重新启动 Eclipse 或/并将 .js 重命名为 .js_ 之类的名称,然后再次返回。

回答by Claudionor Oliveira

I removed the tag in the .project .

我删除了 .project 中的标签。

    <buildCommand>
        <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
        <arguments>
        </arguments>
    </buildCommand>

It's worked very well for me.

这对我来说非常有效。

回答by Redlab

Window -> Preferences -> JavaScript -> Validator (also per project settings possible)

Window -> Preferences -> JavaScript -> Validator(也可以按项目设置)

or

或者

Window -> Preferences -> Validation (disable validations and configure their settings)

窗口 -> 首选项 -> 验证(禁用验证并配置其设置)

回答by treociti

I was able to exclude the jquery.mobile 1.1.1 in Juno by selecting Add Multiplenext to the Exlusion Patterns, which brings up the tree, then drilling down to the jquery-mobile folder and selecting that.

我能够通过选择Exlusion Patterns 旁边的Add Multiple来排除 Juno 中的 jquery.mobile 1.1.1 ,这会显示树,然后深入到 jquery-mobile 文件夹并选择它。

This corrected all the warnings for the library!

这纠正了图书馆的所有警告!

回答by Rahul

Go to Windows->Preferences->Validation.

转到 Windows->首选项->验证。

There would be a list of validators with checkbox options for Manual & Build, go and individually disable the javascript validator there.

会有一个带有手动和构建复选框选项的验证器列表,去那里单独禁用javascript验证器。

If you select the Suspend All Validators checkbox on the top it doesn't necessarily take affect.

如果您选中顶部的暂停所有验证器复选框,它不一定会生效。

回答by pvgoddijn

Another reason could be that you acidentically added a Javascript nature to your project unintentionally (i just did this by accident) which enables javascript error checking.

另一个原因可能是您无意中在项目中添加了 Javascript 特性(我只是无意中这样做了),从而启用了 javascript 错误检查。

removing this ....javascriptnature from your project fixes that.

从你的项目中删除这个 ....javascriptnature 修复了这个问题。

(this is ofcourse only if you dont want eclipse to realise you have any JS)

(这当然是在你不想让 eclipse 意识到你有任何 JS 的情况下)

回答by Sairam Krish

In addition, if you are using Tern eclipse IDEor IBM Node.js Tools for Eclipse, you may need to disable JSHint and other libraries that you don't want.

此外,如果您使用Tern eclipse IDE或 IBM Node.js Tools for Eclipse,您可能需要禁用 JSHint 和其他您不想要的库。

To disable this, Project Properties > Tern > Modules > JSHint or any other library that you don't want. enter image description here

要禁用此功能,请选择 Project Properties > Tern > Modules > JSHint 或您不想要的任何其他库。 在此处输入图片说明