JavaScript Standard Style

The beauty of JavaScript Standard Style is that it’s simple. No one wants to maintain multiple hundred-line style configuration files for every module/project they work on. 

This module saves you time in two ways:

  • No configuration. The easiest way to enforce consistent style in your project. Just drop it in.
  • Catch style errors before they’re submitted in PRs. Saves precious code review time by eliminating back-and-forth between maintainer and contributor.


  • 2 spaces – for indentation
  • Single quotes for strings – except to avoid escaping
  • No unused variables – this one catches tons of bugs!
  • No semicolons – It’s fine. Really!
  • Never start a line with (, [, or `

    • This is the only gotcha with omitting semicolons – automatically checked for you!
    • More details
  • Space after keywords if (condition) { ... }
  • Space after function name function name (arg) { ... }
  • Always use === instead of == – but obj == null is allowed to check null || undefined.
  • Always handle the node.js err function parameter
  • Always prefix browser globals with window – except document and navigator are okay
    • Prevents accidental use of poorly-named browser globals like open, length, event, and name.
  • And more goodnessgive standard a try today!
Related Post

Chrome style tab-resizing for jQuery UI tabs.OverflowResize provides methods for adding and removing tabs.

CSSX is a library to generate / apply CSS with Javascript. It has good API for managing styles. CSSX doesn't Read more

Descartes is an experimental library for writing CSS in JavaScript. Descartes has most of the features you're familiar with from Less Read more

dynamicColorPage is a jQuery plugin that lets user change the color style of your page dynamically. The user got a Read more

jQuery cForm replaces your standard, ugly form-elements with nice and clean non-form html code which can be styled via CSS. Read more

Polished is a lightweight toolset for writing styles in JavaScript. Make your app look great without stress Cross framework compatible: Read more

Bootstrap File Input plugin standardizes the file input field to look like a Bootstrap button in all browsers.

Bootstrap Chosen is an alternate stylesheet for Chosen. This one is supposed to integrate better with Bootstrap 3.0.