JavaScript Standard Style

17.1.2 · active · verified Sun Apr 19

Standard is a JavaScript style guide, linter, and formatter designed for simplicity and consistency. It enforces a strict, opinionated code style with zero configuration, aiming to eliminate bike-shedding over stylistic choices. Currently at version 17.1.2, it sees active maintenance with minor releases frequently addressing dependency updates and bug fixes, while major versions, like v17.0.0, primarily focus on synchronizing with the broader ESLint ecosystem rather than introducing new rules. Key differentiators include its 'no configuration' philosophy, automatic code formatting via `standard --fix`, and early detection of style issues and common programmer errors, saving time in code reviews. It functions as an all-in-one alternative to separate tools like ESLint and Prettier, using ESLint under the hood but abstracting away its configuration complexity.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates `standard`'s automatic fixing capabilities by showing a JavaScript file with common style violations (semicolons, var, ==, double quotes) and the command to fix them.

/* eslint-disable no-unused-vars */
const fs = require('fs')

function exampleFunc(arg1) {;
  var unusedVar = 10
  const myString = "hello world"

  if (arg1 == null) {
    console.log(myString)
  }
}

// Save this to a file like 'broken.js'
// Then run 'npx standard broken.js --fix'
// You can also add `"test": "standard"` to your package.json scripts and run `npm test`

view raw JSON →