I'm trying to use Eclipse for JavaScript (the "Eclipse IDE for Java EE Developers" package).
My project uses Bluebird (a promises implementation), and so it has a lot of lines like:
somePromise.catch(function(err){...
Eclipse considers this to be an error, probably because it thinks that "catch" is a reserved keyword that cannot be used as a method name. Same for the promise.finaly method. Maybe it's right, but I'd rather not switch to a different library just because of this.
Is there a way to make it ignore these specific errors (but keep reporting other errors in the same files)?
I'm trying to use Eclipse for JavaScript (the "Eclipse IDE for Java EE Developers" package).
My project uses Bluebird (a promises implementation), and so it has a lot of lines like:
somePromise.catch(function(err){...
Eclipse considers this to be an error, probably because it thinks that "catch" is a reserved keyword that cannot be used as a method name. Same for the promise.finaly method. Maybe it's right, but I'd rather not switch to a different library just because of this.
Is there a way to make it ignore these specific errors (but keep reporting other errors in the same files)?
Share Improve this question asked Jun 15, 2014 at 13:01 user3742276user3742276 811 silver badge2 bronze badges 5- 1 Reported as bugs.eclipse/bugs/show_bug.cgi?id=457830 – Gilead Commented Jan 19, 2015 at 13:52
- I don't know if it helps, but Eclipse's Problems tab can be filtered. If you click the little upside down triangle and select "Configure Contents..." you may be able to create a filter so that the errors you report don't show there. – OCarneiro Commented Jan 21, 2015 at 17:49
- My work-around (until Eclipse bug is fixed) is to use somePromise["catch"](function(err){... Ugly, but for me it looked better than seeing a prominent but spurious error. – br2000 Commented May 19, 2015 at 22:45
-
doesn't eclipse have some sort of support for
jshint
overrides from the default linter? – naterkane Commented May 22, 2015 at 0:06 - Dude, mark response as the correct answer - it works! – Software Prophets Commented Aug 18, 2016 at 12:28
1 Answer
Reset to default 7This has been reported and fixed not long ago in this bug :https://bugs.eclipse/bugs/show_bug.cgi?id=443876
Go into Preferences->Javascript->Validator->Errors/Warnings and uncheck a new option "Strict validation of JavaScript keywords usage". That should fix it.
I had the same problem before and had implemented a plugin that manipulated bytecode of JSDT at load time to silence this error. Now such hacks are not needed.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742396075a4435971.html
评论列表(0条)