Eclipse: Javascript validation disabled. But why is it still generating errors?

JavascriptEclipse

Javascript 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

  1. Right click your project
  2. Select Properties -> JavaScript -> Include
  3. Select Source tab (It looks similar to the Java Build Path Source tab)
  4. Expand source folder
  5. Highlight Excluded pattern
  6. Click Edit button
  7. Click Add button next to Exclusion patterns box.
  8. 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,

  1. Right click on the little side bar that the errors appear on.
  2. Click preferences.
  3. Deselect "Report problems as you type".
  4. 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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOld McStopherView Question on Stackoverflow
Solution 1 - Javascript11101101bView Answer on Stackoverflow
Solution 2 - JavascriptRamesh LingappaView Answer on Stackoverflow
Solution 3 - JavascriptMichael CeleyView Answer on Stackoverflow
Solution 4 - JavascriptnitindView Answer on Stackoverflow
Solution 5 - Javascriptvenkata madugunduView Answer on Stackoverflow
Solution 6 - Javascriptsean le royView Answer on Stackoverflow
Solution 7 - JavascriptKarthikView Answer on Stackoverflow
Solution 8 - JavascriptjamehView Answer on Stackoverflow
Solution 9 - Javascriptwombling - Chris PaineView Answer on Stackoverflow