How do I remove javascript validation from my eclipse project?
Asked Answered
F

8

358

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?

Famished answered 28/6, 2010 at 11:20 Comment(0)
A
723

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.

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.

  1. Right-click your project.
  2. Navigate to: Properties → JavaScript → Include Path
  3. Select Source tab. (It looks identical to Java Build Path Source tab.)
  4. Expand JavaScript source folder.
  5. Highlight Excluded pattern.
  6. Press the Edit button.
  7. Press the Add button next to Exclusion patterns box.
  8. You may either type Ant-style wildcard pattern, or click Browse button to mention the JavaScript source by name.

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

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

Eclipse - Project Properties - JavaScript - Include Path

Aldos answered 28/10, 2011 at 16:6 Comment(11)
This is actually the correct answer. The answer by Redlab is not sufficient, since it doesn't cancels the javascript project builder.Pestiferous
@Yoni. Don't forget the question was asked and originally answered more than a year ago. This solution may not have even been available back then.Aldos
Doesn't change the fact that Redlab's answer doesn't actually solve the problem. You also have to do what Brad suggests below...Mckellar
I've been so long annoyed by error highlight on project that i work on because some issues in jquery ui library... and this was soo easy to fix... thanks :DStith
You browse to any js file that you don't want eclipse to validate, such as jquery.Sensual
At 'edit dialog' you select file/directory with 'add multiple' instead of writing regular some pattern..Struble
Caveat/Tip: After you perform the steps above you'll need to probably do a Project->Clean to make those dreaded red X's go away.Manual
What is meant by this at the end of the answer? "Do not forget to add it to your SCM."Artemisia
@cellepo. SCM - Source Control Managment system, as in GIT, SVN, CVS, etc.Aldos
This is not answer to How to disable validation, this is answer to How to exclude resources from validation. @Brad Marchesseault gave the correct answer.Palatine
The excusion pattern to ignore all the javascript is */*.js. Adding this in the exclusion patter worked for me.Charles
U
125

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

  1. Right click your project
  2. Select Properties -> Builders
  3. Uncheck the "JavaScript Validator"

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

Underplay answered 16/9, 2011 at 13:1 Comment(2)
no need to restart ecplise or rename any file..just build workspace and right click your project and Validate.Charles
project -> clean did it for meLithopone
S
10

I removed the tag in the .project .

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

It's worked very well for me.

Shaver answered 11/2, 2015 at 12:32 Comment(3)
Since I have JSHint, this is the best answer for me. I removed also PyDev JS validator. Building is fast, finally.Ula
If anyone is stuck on building project. This is the answer for you. Thank you very much @Claudionor Oliveira.....Fatshan
Yeah, I was a long time with this problem and a solution was simple \o/Shaver
G
9

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

or

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

Guadalcanal answered 28/6, 2010 at 11:31 Comment(1)
Doesn't work since the Javascript validator is an Eclipse builder and even turning off all validation on a project will still try to validate the Javascript in your project.Denmark
A
4

Go to Windows->Preferences->Validation.

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

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

Astylar answered 7/3, 2012 at 21:51 Comment(1)
It doesn't seem to work, my Eclipse keeps validating JS regardless of this configuration.Triphibious
W
2

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

This corrected all the warnings for the library!

Watershed answered 6/9, 2012 at 6:17 Comment(0)
R
0

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.

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

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

Racket answered 19/9, 2014 at 8:24 Comment(0)
N
0

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

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

Nahuatlan answered 18/5, 2017 at 7:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.