JavaScript should only be used as a progressive enhancement. All core features of the website need to be accessible with JavaScript off (or more likely, broken).
Source javascript files are under src/js/, and are compiled into src/public/assets/js/ with the gulp command gulp js.
On load, a .no-js class will be removed and .js class added to the body.
For now, use “plain old” JavaScript, assuming a minimum version of IE9. We may add in babel to support newer ES6 features as well.
Use VanillaJS. If you’re found to be sneaking in jQuery just to do $('.foo') instead of document.querySelectorAll('.foo'), you will be be hunted down and smacked with youmaynotneedjquery.com. Found a useful tool, but it depends on jQuery or another big library? Find a different library.
When using JavaScript, keep in mind accessibility. Keyboard or mobile users might trigger different events and have different expectations.
Write defensive javascript that catches potential unexpected failures (e.g. a file was blocked). Log errors.