Skip to main content

General

The coding standard for frontends is an extension to our common coding standards.

Coding

Check browser support

When using (new or experimental) features, first check if browser support is acceptable for your target audience. If not, make sure to use a polyfill to fix any issues.

Can I use provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.

Apply progressive enhancement

Provide a baseline of essential functionality to as many users as possible, but best possible experience only to users of the most modern browsers.

For example, if you want to implement notifications using the browser’s Push Notifications API, you could leverage progressive enhancement using feature detection to enrich the experience of users that use browsers with support for this feature.

Documentation

Use documentation tools

To add more documentation, consider using the following tools:

Writing comments

Use JSDoc notation for comments

Write comments using the JSDoc notation. These comments can be parsed by your IDE and shown when referencing code in your project. Check the JSDoc documentation for all options.

Node.js

Use a Node.js version manager

If you run Node on your local machine, use a node version manager (nvm). This makes it easier to install multiple node versions locally and switch active versions depending on the projects you work on.

Only use LTS versions

Use a Long-term support version of Node for projects. Don't use the 'latest' version. LTS versions of node are always even-numbered. Keep your Node version up to date.

Check out the Node versions overview for more information.