Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

standard

> 开发工具
Open source

🌟 JavaScript Style Guide, with linter & automatic code fixer

29.4K stars0 likes3 views
WebsiteGitHub

About

🌟 JavaScript Style Guide, with linter & automatic code fixer


JavaScript Standard Style

Sponsored by              

English • Español (Latinoamérica) • Français • Bahasa Indonesia • Italiano (Italian) • 日本語 (Japanese) • 한국어 (Korean) • Português (Brasil) • 简体中文 (Simplified Chinese) • 繁體中文 (Taiwanese Mandarin)

JavaScript style guide, linter, and formatter

This module saves you (and others!) time in three ways:

  • No configuration. The easiest way to enforce code quality in your project. No decisions to make. No .eslintrc files to manage. It just works.
  • Automatically format code. Just run standard --fix and say goodbye to messy or inconsistent code.
  • Catch style issues & programmer errors early. Save precious code review time by eliminating back-and-forth between reviewer & contributor.

Give it a try by running npx standard --fix right now!

Table of Contents

  • Quick start
    • Install
    • Usage
    • What you might do if you're clever
  • FAQ
    • Why should I use JavaScript Standard Style?
    • Who uses JavaScript Standard Style?
    • Are there text editor plugins?
    • Is there a readme badge?
    • I disagree with rule X, can you change it?
    • But this isn't a real web standard!
    • Is there an automatic formatter?
    • How do I ignore files?
    • How do I disable a rule?
    • I use a library that pollutes the global namespace. How do I prevent "variable is not defined" errors?
    • How do I use experimental JavaScript (ES Next) features?
    • Can I use a JavaScript language variant, like Flow or TypeScript?
    • What about Mocha, Jest, Jasmine, QUnit, etc?
    • What about Web Workers and Service Workers?
    • What is the difference between warnings and errors?
    • Can I check code inside of Markdown or HTML files?
    • Is there a Git pre-commit hook?
    • How do I make the output all colorful and pretty?
    • Is there a Node.js API?
    • How do I contribute to StandardJS?

Install

The easiest way to use JavaScript Standard Style is to install it globally as a Node command line program. Run the following command in Terminal:

bash
$ npm install standard --global

Or, you can install standard locally, for use in a single project:

bash
$ npm install standard --save-dev

Note: To run the preceding commands, Node.js and npm must be installed.

Usage

After you've installed standard, you should be able to use the standard program. The simplest use case would be checking the style of all JavaScript files in the current working directory:

bash
$ standard
Error: Use JavaScript Standard Style
  lib/torrent.js:950:11: Expected '===' and instead saw '=='.

If you've installed standard locally, run with npx instead:

bash
$ npx standard

You can optionally pass in a directory (or directories) using the glob pattern. Be sure to quote paths containing glob patterns so that they are expanded by standard instead of your shell:

bash
$ standard "src/util/**/*.js" "test/**/*.js"

Note: by default standard will look for all files matching the patterns: **/*.js, **/*.jsx.

What you might do if you're clever

  1. Add it to package.json

    json
    {
      "name": "my-cool-package",
      "devDependencies": {
        "standard": "*"
      },
      "scripts": {
        "test": "standard && node my-tests.js"
      }
    }
  2. Style is checked automatically when you run npm test

    bash
    $ npm test
    Error: Use JavaScript Standard Style
      lib/torrent.js:950:11: Expected '===' and instead saw '=='.
  3. Never give style feedback on a pull request again!

Why should I use 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. Enough of this madness!

This module saves you (and others!) time in three ways:

  • No configuration. The easiest way to enforce consistent style in your project. Just drop it in.
  • Automatically format code. Just run standard --fix and say goodbye to messy or inconsistent code.
  • Catch style issues & programmer errors early. Save precious code review time by eliminating back-and-forth between reviewer & contributor.

Adopting standard style means ranking the importance of code clarity and community conventions higher than personal style. This might not make sense for 100% of projects and development cultures, however open source can be a hostile place for newbies. Setting up clear, automated contributor expectations makes a project healthier.

For more info, see the conference talk "Write Perfect Code with Standard and ESLint". In this talk, you'll learn about linting, when to use standard versus eslint, and how prettier compares to standard.

Who uses JavaScript Standard Style?

| | [](

Issues· 128 open

View all issuesOpen on GitHub
  • #351

    JSX but not React in scope

    help wantedenhancementacceptedUpdated Sep 1, 2026
  • #1119

    Rule suggestion: Forbid cyclic dependencies

    help wantedenhancementUpdated Sep 1, 2026
  • #1355

    Lint all JavaScript in markdown files by default

    help wantedblockedenhancementUpdated Sep 1, 2026
  • #1458

    indentation/alignment in jsx (react/jsx-curly-newline)

    bughelp wantedblockedUpdated Sep 1, 2026
  • #1555

    Disallow returning values from Promise executor functions (no-promise-executor-return)

    help wantedblockedenhancementUpdated Sep 1, 2026
  • #1977

    Parsing error when using import attributes

    Updated Jun 29, 2026
  • #1991

    open

    Updated Feb 24, 2026
  • #1989

    Deprecated dependencies on installation

    Updated Nov 19, 2025
  • #1988

    Provide a github action

    Updated Nov 8, 2025
  • #1847

    Please get rid of 2-space indent lint

    Updated Oct 19, 2025

> Tags

JavaScriptdevelopmentecmascriptes6eslint

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具