Eclipse IDE alternative with ECMAScript 6 validation - javascript

I'm running Eclipse Mars 4.5 with JSDT and it's getting increasingly difficult to use this for JavaScript/Node.JS development, since it doen't recognize modern patterns:
This is because the JavaScript Validator is set to ECMAScript 3.
To my surprise for such an up-to-date release of Eclipse, this dropdown is greyed out and I cannot select 5 or 5.1, let alone 6. ES3 is from 1999 (!).
Am I correct to assume that Eclipse has no considerable JavaScript community? Other FOSS projects with modern ECMAScript support:
NetBeans supports ES5.1, ES6 in 8.1
Atom.io supports ES6
(I haven't used these so I don't know how they compare to Eclipse)
Is Eclipse discouraged for JavaScript development? Or is there actually a well-documented non-hacky go-to plugin for Eclipse to play nice with ES6?

Eclipse Neon will improve a lot support for JavaScript with JST 2.0.0 like :
support for ES6
Grunt, Gulp, npm support
You can try too tern.java if you wish advanced completion, validation where you can use for eslint, jshint which support ES6. See Tern Linter section for that.

Related

how to use ES6 features in ASP.Net

My one website is into requirement gathering stage. I know that JavaScript new version ES6 is introduced.
On googling, I found some good tools to work with ES6 like:-
Bable
Traceur
Is there any Nuget package available or any alternate that will convert ES6 to ES5 parallely.
or How do I get started with ES6 in ASP.Net MVC site.
I am using VS 2015 & ASP.Net(4.5.2)
You can try Webpack with visual Studio here is a useful package. Just dont forget you require the Babel module.

Using ECMAScript 6 on WebStorm without installing Babel

I enabled ECMAScript 6 on WebStorm so that I do not get IDE errors when using arrow functions.
However, I did not install Babel. I was prompted to install Babel after enabling ECMAScript 6. I had problems installing Babel.
Is it necessary to use Babel together with ECMAScript 6? What would be the side effect of enabling ECMAScript 6 without installing Babel?
I am using node.js on WebStorm.
The purposes of Babel is to convert es6 code into es5 code BECAUSE most browsers do not FULLY support es6 yet, although are getting closer.
https://kangax.github.io/compat-table/es6/
You will see that IE11 support is poor whilst Firefox and Chrome almost have full support.
However, given that the latest Node fully understands ES6 there is now no need for Babel when using Node only unless of course you need to support older versions of Node which only understand ES5.
PS: if you enable Babel support in Webstorm it can generate ES5 files on the fly for you as you code in ES6. Alternatively, you can use a task runner such as Grunt or Gulp to do this for you. Depends if you need it!

Does Aptana support ES6?

Aptana Studio gives me syntax errors for uses of function* and yield in JavaScript code.
These are ES6 features. Is it possible to configure Aptana to accept them?
No, Aptana does not support ES6 (nor JSX) and there are no plugins available to support it.
Aptana is compatible with all Eclipse plugins. The plugin "Enide Studio 2015" is tagged with ES6, which is disingenuous because as far as I can tell the only thing it enables a subset of the const keyword. Nothing else.
To install the plugin (which won't help you), visit the plugin page, then drag the "install" button into your Aptana editor.

JavaScript GameClosure support in Eclipse

I am learning GameClosure (a HTML5 game engine) and want to develop in JavaScript in Eclipse. I've downloaded WTP 3.4.2 plugin, but Eclipse don't recognize the syntax of import ... as ... like here:
Is there any way to fix that and have GameClosure support? There is needed a special compiler or something? (GameClosure uses basil)
I also have an warning with no semicolon after last entry in parameter-array:
I assume this semicolon isn't needed, but how can I make this warning go away?
Looks like it's using the old Harmony modules proposal, in which case Eclipse will not parse it properly, it chokes on "let" never mind modules.
Hopefully once the standard is released later on this year Eclipse will receive an upgraded parser.
you can use jsio as an importer:
jsio("import device");
//etc.

ECMAScript:Harmony / ES6 to JavaScript compiler

After reading Peter's article on JavaScript I noticed
Brendan Eich stated that one the goals for Harmony is to be a better target for to-JavaScript compilers.
There are currently two popular compilers with some vague ES:Harmony compliance:
Traceur
CoffeeScript
Although CoffeeScript has some compliance it's not designed to be an ES:Harmony compiler so it's not useful to this end.
Tracuer seems to be sticking more rigorously to the ES:Harmony specification but I don't know whether it intends to become a full ES:Harmony compiler.
Since the aim is to to compile ES6 down to ES3 it would also need to support ES5 features (and probably a switch whether to compile ES5 to ES3 or ES6 to ES3).
Are there currently any other projects aiming to create a full ES:Harmony to ES3 compiler?
Is it wise to start writing such a compiler knowing that the standard is young / unstable / in flux.
Are there currently any ES5 -> ES3 compilers?
I've left a question on the Traceur mailing list.
The aim of such a compiler would be backwards compatibility with ES3. Not full emulation of ES5 and ES6 in ES3.
(shameless but relevant plug below)
Caja is reworking its ES5 support via ES5/3 and will do the same for ES harmony. So our structure would be implemented as a Harmony to ES3 layer which can be skipped for real harmony implementations, and then a separable loader that preserves the security properties that concern caja.
Like Traceur, members of the Caja team are part of TC39 (the committee defining ES Harmony).
I don't know about Coffeescript's plans, but it was mentioned during discussions of Harmony modules. Module loaders will likely have the ability to intercept loaded source code (via eval hooks) and rewrite it before module initialization, so if a module is written in CoffeeScript, a runtime CoffeeScript rewriter could be invoked at initialization time. This would allow apps to be composed of modules written in multiple languages that compile down to Harmony at load time.
One thing to note is that not everything in Harmony can be implemented easily via translation. For example, implementing weak maps correctly would require implementing your own garbage collector in JavaScript and even if you did that you would probably just reintroduce the host object/native object cycle problem.
Check out TypeScript, Microsoft's new language based on ES6.
Continuum has implemented most of the relevant features and should run in es3 browsers (like older IEs).
Mascara is probably what you're looking for.
As of the time of typing, we now have Babel. It integrates with many different build tools/systems, and will transpile ES6+ in order to support legacy browsers (it doesn't state which version it targets, but it does say that it targets IE9+).
To install it type npm install babel -g.
Note that it has rather a lot of dependencies and when installed it is ~23.4 MB (2888 files).
Google Closure Compiler (Github) is a great tool for ES6 compilation. It's a simple Java jar that is used from the command line. There are other options such as API services and GUIs, but I find that it was best to set up an automatic build system hooking into the Java JAR. It can transpile your ES6 code into ES5 compatible code. I started using it for compressing and obfuscating code, but it can also do error checking and the ES6 transpilation as I mentioned.
Note that the ES6 features are marked as experimental. But I'm planning on using them in production soon, since my tests were rock solid.
There's also https://github.com/matthewrobb/six
Six is a language super-set of JavaScript that enables new syntactic features from the 6th edition of ECMAScript to be used, through a transpiler, in your scripts today.
WARNING: Still in a very early state, proceed with caution.
I'm not sure in what instance compilation back to ES3 would valuable as opposed to ES5, seeing that implementation changes are limited to array and object helper functions, and ES5 support is so prevalent.
So for completeness, another ES6 to ES5 compiler is the esnext project by Square. It is a collection of a number of modules designed to polyfill various ES6 features provided in one package. Here is the list modules included: https://github.com/square/esnext#available

Categories