Javascript Standards

Currently, the spike standard JS stack utilizes es2016 on top of babel, with standard as a style linter. The rationale behind each of these decisions is explained below. This is a living document and any and every part of it is subject to change in the future. We try to align as closely as possible with future JS standards when considering our default stack and best practices.

Javascript Transforms

We use ES6 by default via babel's env preset. This is the most up-to-date draft of ECMAScript, and all included proposals are at stage 4, meaning they are solid, tested, and ready for release.

Throughout time, this is subject to change as javascript moves forward as a language. Expect for there to be an update each year alongside TC39's release. However, it will not move backwards, we will only gain additional features. If you are unfamiliar with ES6 and how it works, check out this wonderful article for an overview of some of the most important features.

Code Style

We have decided on standard as our default style. It's a popular and well-supported style, with linters for every major text editor. Adhering to a set javascript style helps to increase code consistency within your projects, and eliminates any issues over different preferences between developers.

Javascript Architecture

Discussing JS architecture is a much deeper topic than html or css, as javascript is a turing-complete programming language. We could not possibly prescribe a method of organizing javascript that would fit any situation, so that part is up to you. However, for client-side code on the web, once the interface starts to get to a place where it's difficult to manage, you will find that it is often extremely helpful to bring in a front-end app framework to organize data and views.

Front-end frameworks are still going through their early stages of evolution compared to the rest of javascript. The ideal front-end framework would be built on a virtual dom spec that everyone can agree with, use standards like template strings, have clean and clear syntax, support for old browsers, strong community support, etc. When there is a front-end framework that we feel 100% confident in, we will recommend it here.

It should also be mentioned that a front-end framework is not necessary for every project, it's something you use when you need. Regardless, they are large pieces of many projects so it's worth considering.

Purely for the curious, this spec's maintainers currently use vue.js.