Easy move to ES6
Currently we use CoffeeScript to write our JS. We are hiring more and more really good pure JS devs. ES6 has many features that CS has but drastically improved. At some point in the near future ES6 will be the language of the browser and there will be no reason to use CS. While CS influenced many things in ES6, ES6 has now overtaken it in terms of functionality, and in the end ES6 is (in the end) native JS. It's getting harder and harder to convince new JS devs to write CS and in general they kind of grumble about it.
You can see in this graph that ES6 support is already pretty substantial and will only increase in the future. This is something that all major browsers are currently working on, with quite extensive support in Chrome, Firefox, Safari, and even IE(Edge).
One of our modus operandi is to be proactive and not reactive. I know that ES6 will happen, and I think it will happen sooner rather than later, so let's move now.
Here's how to do it in a super simple way.
- Replace all CoffeeScript files with converted JS file. The JS is already converted for us by CoffeeScript. It's just a matter of replacing the files, 1 by 1.
- Keep the Coffeescript Gem around because Turbolinks uses it.
- Add the Babel compiler.
- We are done.
At this point we can keep ES5 and run ES6 concurrently. This is what has been done in many other companies. Eventually the ES5 will disappear from our code as we slowly replace it with ES6. There is no issue with having ES5 and ES6 running concurrently because ES6 is backwards compatible.
I imagine this plan could happen in a couple of hours, without a hitch.
All frontend devs already know the JS that CS is creating when they type, it's just a matter of continuing that pattern when writing ES5 and new code goes into ES6.
The JS that CS creates is actually quite nice and very maintainable.
This will help us make the app more reactive and reduce code complexity. Babel is finally at a point where I feel like we can use it for real production level code.
Please voice your opinions below. Opinions are greatly appreciated.
cc @iamphill @alfredo1 @JobV @dzaporozhets @lbennett @connorshea @annabeldunstone @DouweM @rspeicher @fatihacet