Using Node ES6 today

Current level of ES6 in various tools.

Supported :)

The following products support ES6 options, at least partially:

Supports most of ES6 features when running with --harmony flag. I would define a shell alias harm=node --harmony and use harm <es6 filename.js> from the command line.

If you need to switch between stable and unstable nodejs versions, use nvm, it works excellent on Mac.

Set option esnext to true, the list of supported ES6 options is here. Most importantly it includes the generators.

Travis continuous integration servers support multiple nodejs versions Set the nodejs version to 0.11 in .travis.yml file and define npm start command in package.json to turn on harmony features:

1
2
3
"scripts": {
"test": "node --harmony ..."
}

Cloud hosting for nodejs apps Heroku supports multiple nodejs versions, including latest 0.11.x. There is nothing to do, except specify the version in the package.json file

1
2
3
"engines": {
"node": "0.11.x"
}

Do not break

Excellent syntax highlighter for browser Prism does not break, but does not highlight ES6 syntax yet.

Not supported :(

Complexity metrics I love and use jscomplexity, plato and grunt-complexity do not parse ES6 syntax yet.

Good news

Most of the tools support Harmony generator functions nicely. To bridge the remaining gap and distribute your ES6 code so it could be used from ES5, I wrote this es6-generators-example.

Browser?

Aside from Nodejs, what about ES6 support among the browsers? Again, the support varies is feature by feature, see table. For a lot of features (for example extending Array and Math objects), there is a good es6 shim.

Related