Don't use ES2015

June 08, 2016 0 Comments by

Using Old Versions of JavaScript

We're halfway through 2016, and there are still folks who refuse to use the latest version of JavaScript, dubbed ES2015.

CoffeeScript and TypeScript really helps you understand JavaScript, where it's at today, and where it's going tommorrow. I like how expressive ES6 is, and I've added the Babel transpiler to Grunt and Gulp tasks on some projects I've been working on this summer. I wanted to enable engineers to write in ES6 and ES5. It doesn't take away any functionality. Unfortunately, I've heard from these teams that this was not acceptable.

Do You Write ES6?

Because if you don't, you'll be happy to hear that you can write ES5 without any worries. However, ES5 JS engines won't understand ES6 constructs. It will be many years before this happens. If you wait until all browsers support this, you're like the person who refused to learn ES5 because IE8 wouldn't handle it without a polyfill.

What Do You Have to Lose?

You'll probably want to configure ESLint to support ES6 and ES7. If the entire team doesn't take advantage of the new methods, it's not the end of the world. Have you ever been on a team where some folks where using ES5 and others where using ES3? When was the last time you saw a codebase that was iterating through an array with a for loop, and in another place, iteration was happening with forEach()? How often do you see linters that check for instances of this occuring?

But the Code Should be Consistent

So in one place a developer is using call or apply to pass context, and in another place a developer is using bind. Should you tell this person not to use the more expressive bind, because everyone else on the team isn't using it? At one point everyone was using jQuery, and they had the live method. The only problem was that there was no unlive method, and it wasn't very articulate. Hence the API changed to on and off, but in some codebases you still saw live being used. Now did anyone ever say, don't use on and off unless everyone is using it?

Don't Stifle Evolution

Regardless of how much you know or like ES2015, don't keep others from writing it. If it's because you don't want to upgrade your linter, have them do it. If it's because the rest of the team doesn't plan to write any ES2015, it's not going to get in their way. If it's because the code won't be consistent and you'll have some places using ES5 constructs and other places using ES6, think back to the last time you saw for loops being used in places perfect for array methods like map, filter, and reduce. Soon 2016 will pass, and we will still see pundits refusing to adopt ES2015. Don't be the one caught holding back evolution of the language.

Tag cloud