94

In my dynamic web project in eclipse, I have jQuery in my js source folder. For some reason, Eclipse is not handling it correctly and interpreting many lines as errors in the standard jQuery file (even though I have the javascript development tools installed).

Can I turn off the error checking on the jQuery file (and that file only)? I still want it to detect errors as usual, but ignore anything in jQuery.js.

Alastair Pitts
  • 19,423
  • 9
  • 68
  • 97
oym
  • 6,983
  • 16
  • 62
  • 88

7 Answers7

94

It looks like eclipse has changed a bit,
but the following method which worked for me seems very close to the old one.

The solution consists of 2 steps:

  1. First you have to update Eclipse's preferences (Window > Preferences):

    Update eclipse's preferences

    Make sure that you check both Manual & Build next to the Validator you need
    (in my case - a javascript one).

  2. Last you should change your project's Validators:

    Update project's validators

    Click on Client-side JavaScript Settings (or any other validator you need):

    Validator settings

    The explanation is clear but basically what you should do is as follows:

    Click on Add Exclude Group..., select it and then click on Add rule....
    Then pick Folder or file name (note that there are other options), and specify your file/folder.

You should be able to verify that its working by deleting the existing errors/warnings,
and then left-click your project and select the Validate option.

This setting can be committed into source control as well.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
Gábor Lipták
  • 9,646
  • 2
  • 59
  • 113
  • thanks! how do I commit this setting to source control? In which file is it stored? – oym Nov 26 '10 at 16:09
  • I dont know exactly, but surely some file in projectroot/.settings directory. Change the setting, and see what is outgoing change in team synchronize view. You will see. – Gábor Lipták Nov 26 '10 at 21:07
  • This does not work for me, the errors are still showing up. Do I need to rebuild or something like that. – Saif Bechan Nov 29 '11 at 13:09
  • This does not work for me either...I had to use Javascript->Include Path in the project-specific settings as described in the other answer. It is odd that there are two places to configure this. I'm guessing this one is for validation of any project, whereas the other is for validation of projects that have a javascript aspect added to them. – Tony K. Jan 18 '13 at 16:26
  • 2
    Almost worked for me, added another step which is required (probably due to a newer version of eclipse). – GrizzlyMcBear Jan 18 '16 at 20:04
  • Thanks for the fix @GrizzlyMcBear – Gábor Lipták Jan 18 '16 at 20:18
  • 1
    Thanks @GáborLipták. This really helped me. – Christopher Roscoe Jan 25 '18 at 09:21
  • @ChristopherRoscoe hehe. We should have a call. I am interested, how you are Christopher :) – Gábor Lipták Jan 25 '18 at 15:15
1

Perform these steps to solve this(This will disable eclipse validation for Javascript): 1. Go to Eclipse > preference > Javascript> validators > Errors/Warnings 2. Uncheck "Enable JavaScript semantic validation".

If you have messed around with the javascript settings in your projects, then restore everything to default first for all the projects that u have changed. After that, follow the steps.

Mandark
  • 85
  • 1
  • 5
1

I had javascript errors seen on jquery mobile file on an Android Phonegap project. I simply removed the file from the project and add it afterwards. It works now.

danpop
  • 967
  • 13
  • 25
1

Not sure if it'll work for all. But what i did was select the unnecessary errors in 'problems' tab of eclipse, Rclick and Delete. Eclipse stopped showing the error..

0

One way is that : 1.remove javascript -> validator -> errors/warning. 2.remove project -> .project file -> javascript command 3.It is important,too! delete js file and import again.

0

With eclipse Luna I was getting this as well. I did a right click on jquery.jqGrid.min.js and selected 'Validate'. It then validated fine and the errors went away.

Adam
  • 1
0

A good fix/workaround that doesnt disable the errors but just filters them out is by....

  1. Clicking the "Filters..." button within the "Problems" window in Eclipse. Expand the "Scope" section and select "On working set:". Then click the "Select..." button. Filters window

  2. In the new window that pops up select "Selected Working Sets" option and then click the "New..." button. Select Working Set window

  3. Another window pops up from there where you can select your project and its individual files that you want to see compiler errors/warnings from.New Working Set window

btc5472
  • 1
  • 2