12 Rules for Professional JavaScript in 2016

Well, that’s disturbing.

1. JS Belongs in a .js File

2. JS Code Should be Static

Note the chunk of JSON. This is simply a server-side class that’s been serialized to JSON and injected on the page.

3. JS Should be Minified

4. JS Should Be Linted Real-time

5. JS Should Have Automated Tests

6. JS Should Be Encapsulated

7. JS Dependencies Should Be Explicit

//CommonJS
var react = require(‘react’);
//ES6 Modules
import React from ‘React’

8. Transpile to JS

You don’t have to write ES5 anymore. Consider using an abstraction that gives you extra power.

9. JS Should Have an Automated Build

10. Use a Framework or Libraries

Do not attempt to start from scratch. Stand on the shoulders of giants.

11. JS Should Separate Concerns

Think like a server-side developer when writing JavaScript. Separate your presentation from your business logic and data access.

12. Use a Starter Kit

Well, That Was Overwhelming.

We’ve entered an era where the front-end is complicated enough that we need front-end specialists.

--

--

Pluralsight Author, Principal at reactjsconsulting.com, Software Architect, Microsoft MVP, Speaker, Clean Coder, Aspiring Outlier.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store