Eclipse: Javascript validation disabled. But why is it still generating errors?
JavascriptEclipseJavascript Problem Overview
The validation in Eclipse is catching what it deems "errors" in the framework I've been using just fine.
-
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.
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.
Javascript Solutions
Solution 1 - Javascript
- 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.
Solution 2 - Javascript
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.
Then Save the Configuration and make a clean build.
Solution 3 - Javascript
If you want to remove the JavaScript validation from a project completely, you can just remove it from the .project file.
- Open your project's .project file in a text editor.
- Remove the line
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- Refresh your project
Now if you go into your project properties, you'll notice the JavaScript option is gone entirely.
Solution 4 - Javascript
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.
Solution 5 - Javascript
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
Solution 6 - Javascript
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.
Solution 7 - Javascript
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.
Solution 8 - Javascript
I believe this is caused by this bug in 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)
@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
Solution 9 - Javascript
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.
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.