Eclipse:Javascript 验证已禁用。但仍然产生错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7102299/
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
Eclipse: Javascript validation disabled. but still generating errors?
提问by Old McStopher
The validation in Eclipse is catching what it deems "errors" in the framework I've been using just fine.
Eclipse 中的验证正在捕获它认为我一直在使用的框架中的“错误”。
Project -> Properties -> Validation -> "Suspend all validators"
doesn't work.Project -> Properties -> Javascript -> Validation -> Errors/Warnings -> [Unchecked] "Enable Javascript semantic validation"
doesn't work either.Enabling the above-mentioned checkbox and setting all validation issues to "Ignore" doesn't work either.
Project -> Properties -> Validation -> "Suspend all validators"
不起作用。Project -> Properties -> Javascript -> Validation -> Errors/Warnings -> [Unchecked] "Enable Javascript semantic validation"
也不起作用。启用上述复选框并将所有验证问题设置为“忽略”也不起作用。
Each time one of these settings changes, it does a build and immediately all the "errors" are found and subsequently prevent an otherwise known-good build.
每次这些设置之一发生更改时,它都会进行一次构建,并立即发现所有“错误”,并随后阻止其他已知良好的构建。
回答by 11101101b
- Right click your project
- Select Properties -> JavaScript -> Include
- Select Source tab (It looks similar to the Java Build Path Source tab)
- Expand source folder
- Highlight Excluded pattern
- Click Edit button
- Click Add button next to Exclusion patterns box.
- Click Browse button and select the JavaScript source by name.
- 右键单击您的项目
- 选择属性 -> JavaScript -> 包含
- 选择 Source 选项卡(它看起来类似于 Java Build Path Source 选项卡)
- 展开源文件夹
- 突出显示排除的模式
- 单击编辑按钮
- 单击排除模式框旁边的添加按钮。
- 单击浏览按钮并按名称选择 JavaScript 源。
回答by Ramesh Lingappa
You actually have to disable the global builder settings , to do that :
您实际上必须禁用全局构建器设置,才能做到这一点:
Right Click Project => Build Path => Configure Build Path => Builders
In the right hand side , make sure JavaScript Validator
is Unchecked, if not uncheck it.
在右侧,确保JavaScript Validator
未选中,如果没有取消选中它。
Then Save the Configuration and make a clean build.
然后保存配置并进行干净的构建。
回答by Michael Celey
If you want to remove the JavaScript validation from a project completely, you can just remove it from the .project file.
如果您想从项目中完全删除 JavaScript 验证,只需将其从 .project 文件中删除即可。
- Open your project's .project file in a text editor.
- Remove the line
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- Refresh your project
- 在文本编辑器中打开项目的 .project 文件。
- 删除该行
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- 刷新你的项目
Now if you go into your project properties, you'll notice the JavaScript option is gone entirely.
现在,如果您进入项目属性,您会注意到 JavaScript 选项已完全消失。
回答by nitind
Validation of .js files is handled by the JavaScript Validator, but that's a Builder, not something that plugs into the general Validation Framework. If you change the Errors/Warnings preferences, a Clean and build should show you the results.
.js 文件的验证由 JavaScript Validator 处理,但这是一个Builder,而不是插入通用验证框架的东西。如果您更改了 Errors/Warnings 首选项,Clean and build 应该会显示结果。
回答by venkata madugundu
Assuming you do the steps as specified in the accepted answer of this thread, As an example, in order to exclude all .js files from dojo folder recursively, add dojo/**/*.js
假设您按照此线程的已接受答案中指定的步骤进行操作,例如,为了递归地从 dojo 文件夹中排除所有 .js 文件,请添加 dojo/**/*.js
回答by sean le roy
I tried all of the above and none worked. This worked for me after playing about with it,
我尝试了上述所有方法,但都没有奏效。在玩弄它之后,这对我有用,
- Right click on the little side bar that the errors appear on.
- Click preferences.
- Deselect "Report problems as you type".
- Click apply and OK.
- 右键单击出现错误的小侧栏。
- 单击首选项。
- 取消选择“键入时报告问题”。
- 单击应用并确定。
回答by jameh
I believe this is caused by this bugin Eclipse Web Tools <3.5.2
我相信这是由Eclipse Web Tools <3.5.2 中的这个错误引起的
It also seems to only typically affect minified Javascript (it is sensitive to certain patterns in function declarations - see link)
它似乎也通常只影响缩小的 Javascript(它对函数声明中的某些模式很敏感 - 请参阅链接)
@Marek describes a work around to remove the errors if you are using an affected version of Eclipse Web Tools. However, a better solution might be to update to Eclipse >=4.3 and use Eclipse Web Tools >=3.5.2
@Marek 描述了一种解决方法,如果您使用的是受影响的 Eclipse Web Tools 版本,则可以消除这些错误。但是,更好的解决方案可能是更新到 Eclipse >=4.3 并使用 Eclipse Web Tools >=3.5.2
回答by Karthik
If none of the above steps(unchecking,excluding etc) work....After disabling the validator...delete the js file and add it back into the Workspace.
如果上述步骤(取消选中、排除等)均无效....禁用验证器后...删除 js 文件并将其添加回工作区。
回答by wombling - Chris Paine
It may also be that it's not the standard JS Validation that is generating your error. After being quite confused for about half an hour one evening, I realised that it was the install of JSHint that I was using that was flagging errors in my minified js libs and not the standard JavaScript validation.
也可能不是标准的 JS 验证导致了您的错误。一天晚上,在困惑了大约半个小时之后,我意识到是我使用的 JSHint 的安装在我缩小的 js 库中标记了错误,而不是标准的 JavaScript 验证。
Of course JSHint also has a way to exclude certain files. And we you actually configure it, it does work in much the same way as the above solutions.
当然 JSHint 也有排除某些文件的方法。我们实际配置它,它的工作方式与上述解决方案大致相同。