84

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.

peterh
  • 11,875
  • 18
  • 85
  • 108
Old McStopher
  • 6,295
  • 10
  • 60
  • 89
  • Which version of Eclipse? Inline JS or in a `.js` file? – Matt Ball Aug 18 '11 at 04:23
  • Eclipse 3.7.0 (Indigo) with Web Tools Platform plugin installed. (As well as Android and PhoneGap plugins.) These are in .js files. – Old McStopher Aug 18 '11 at 04:27
  • http://stackoverflow.com/questions/3420536/how-do-you-clear-the-validation-errors-in-eclipse/7764506#7764506 – Ravi Parekh Oct 14 '11 at 07:41
  • possible duplicate of [How do I remove javascript validation from my eclipse project?](http://stackoverflow.com/questions/3131878/how-do-i-remove-javascript-validation-from-my-eclipse-project) – BalusC Mar 22 '13 at 16:47

9 Answers9

195
  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.
Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
11101101b
  • 7,679
  • 2
  • 42
  • 52
  • i've a question, everytime i run maven->update project, i need to clean and build the project again, is there anyway to avoid this? – hetaoblog Jan 22 '14 at 05:43
  • 3
    I don't think this aswer is the correct one. You want to disable the validation itself, not to exclude sources from it. – Jaroslav Záruba Oct 01 '14 at 09:16
  • This did not work on my project. Perhaps some other builder is running. I have a definite incorrect code line: return
    Hello {this.props.name}
    ; However, that line is correct, jsx. Yes, will instead use the *.jsx extension going forward, but this does illustrate an Eclipse config pain point.
    – Josef.B May 29 '15 at 11:07
  • What if a particular folder (like bower_components) contains Javascript, HTML and JSON files? adding that folder to the excluded pattern is valid only for JS validation. – Bruno Bruzzano Jun 09 '15 at 09:45
32

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.

Michael Celey
  • 12,645
  • 6
  • 57
  • 62
Ramesh Lingappa
  • 2,448
  • 20
  • 33
  • 3
    Of course this is the correct answer. You want to disable JS validation, not exclude resources form it. – Jaroslav Záruba Oct 01 '14 at 09:15
  • 2
    When you do this then right clicking your project and selecting Validate should do. But you might also need to delete the errors from the Problems tab, subsequent clean/build will no more perform the validation. – Jaroslav Záruba Oct 01 '14 at 09:18
  • I found this answer to be useful in RSA which does not have the inlclude/exclude javascript option. – Ravi Dec 05 '14 at 21:41
  • Thanks for this answer. With Luna 4.4 : `Project Properties => Builders` – NBcrafts Nov 10 '15 at 16:42
  • 1
    This would be great except it doesn't work. I've disabled the Javascript Validation Builder. I've also put an "exclude" rule as "star star slash star" in the Javascript project settings. I've also restarted Eclipse, cleaned the project, and said my prayers. Seriously, Eclipse is total garbage when it comes to validation. The JSP validation SUCKS and the JS validations SUCKS. End rant. – KyleM Oct 21 '16 at 16:24
12

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.

Michael Celey
  • 12,645
  • 6
  • 57
  • 62
5

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.

nitind
  • 19,089
  • 4
  • 34
  • 43
2

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

2

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.
sean le roy
  • 571
  • 1
  • 7
  • 19
1

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.

Karthik
  • 1,383
  • 1
  • 10
  • 11
1

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

jameh
  • 1,149
  • 3
  • 12
  • 20
0

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.

wombling - Chris Paine
  • 1,651
  • 1
  • 18
  • 17