Add support for modern JavaScript standards

Currently, the JavaScript in the docs site is written in ES5 and no support has been added for modern JavaScript standards. Even though ES5 is still widely used and fully supported by all major browsers, the standards and feature set of JavaScript has drastically changed.

This is a proposal to add support to the docs codebase for next-generation JavaScript.

Pros

  • We benefit from the latest JavaScript features such as Promises, Classes, import/export (dependency management), new array functions, scope blocked const and let variables... The list goes on...

  • By transpiling our code down to ES5 we reduce the risk of writing JS that could break our docs site (especially in older browsers). This also means we'd be able to keep our current code base and migrate away from ES5 over time (backward compatibility).

  • Our JavaScript codebase isn't so big (yet) in the docs site, the earlier we can start benefitting from modern JS the less we'll have to refactor at a later stage.

  • The docs codebase would be better aligned with the CE/EE codebase.

  • This will make our codebase more maintainable.

  • etc.

Cons

  • We'll end up with two different standards in our codebase (until we migrate all of our JS away from ES5).

Browser support

As of today, modern browsers support about 98% of the features that ES6 (for example) provides (source).

To add support for older browsers a transpiler (like Babel transpiler for instance) would be required to transpile our modern JS down to ES5. This would give us the ability to write modern JavaScript with support for older browsers.