Scripts2026年7月28日·1 分钟阅读

StandardJS — JavaScript Style Guide with Built-In Linter and Auto-Fixer

An opinionated JavaScript style guide, linter, and formatter that requires zero configuration. Catch errors and enforce consistent style across your entire codebase automatically.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
StandardJS
直接安装命令
npx -y tokrepo@latest install 393c9f26-8aa2-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

StandardJS is a JavaScript style guide, linter, and formatter rolled into one tool with zero configuration required. It enforces a consistent coding style across projects by combining a curated set of ESLint rules into a single opinionated package, eliminating debates about code formatting.

What StandardJS Does

  • Lints JavaScript and TypeScript files against a fixed rule set with no .eslintrc needed
  • Auto-fixes formatting issues in place with the --fix flag
  • Integrates with editors like VS Code, Vim, and Sublime for real-time feedback
  • Supports JSX and Flow syntax out of the box
  • Provides a sharable ESLint config (eslint-config-standard) for custom setups

Architecture Overview

StandardJS is built on top of ESLint and bundles a carefully curated set of rules from eslint-config-standard. When you run standard, it invokes ESLint internally with a locked configuration, so there are no config files to manage. The --fix flag delegates to ESLint's auto-fix engine to rewrite code in place.

Self-Hosting & Configuration

  • Install via npm: npm install standard --save-dev
  • Add a lint script to package.json: "scripts": {"lint": "standard"}
  • Use standard --fix in CI pipelines for automatic formatting
  • Ignore specific files with a standard.ignore field in package.json
  • Override globals with standard.globals in package.json when needed

Key Features

  • Zero configuration required to get started
  • Catches common bugs like unused variables and accidental globals
  • Automatic code formatting with --fix
  • Supports modern ES2024+ syntax, JSX, and TypeScript via plugins
  • Used by companies including npm, GitHub, and Brave

Comparison with Similar Tools

  • ESLint — More flexible but requires configuration; StandardJS wraps ESLint with fixed rules
  • Prettier — Focuses only on formatting, not linting; StandardJS does both
  • Biome — Rust-based all-in-one tool; StandardJS is JS-native and ESLint-compatible
  • XO — Similar opinionated linter by Sindre Sorhus; StandardJS has a larger community

FAQ

Q: Can I override specific rules? A: StandardJS is intentionally opinionated and does not support per-rule overrides. If you need customization, use eslint-config-standard directly with ESLint.

Q: Does StandardJS work with TypeScript? A: Yes. Use ts-standard or configure eslint-config-standard-with-typescript for full TypeScript support.

Q: Does it support semicolons? A: StandardJS enforces no-semicolon style by default. If you prefer semicolons, use semistandard instead.

Q: How does it compare in performance to ESLint? A: Performance is equivalent since StandardJS runs ESLint under the hood. The difference is in configuration: StandardJS needs none.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产