← 返回命令列表

Linux command

xo 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Lint JavaScript

xo

Lint specific files

xo [file.js]

Fix issues

xo --fix

Specify space indent

xo --space

Print config

xo --print-config

说明

xo is an opinionated JavaScript and TypeScript linter built on top of ESLint. It provides a zero-configuration linting experience with a curated set of strict rules designed to enforce consistent, high-quality code without requiring manual ESLint setup. The tool includes built-in TypeScript support and optional Prettier integration for combined linting and formatting. The --fix option automatically corrects fixable issues, while --space switches from the default tab indentation to spaces. By defaulting to strict, well-chosen rules, xo eliminates the need for teams to debate and configure linting rules individually.

参数

--fix
Auto-fix issues.
--space
Use space indent.
--semicolon
Require semicolons.
--prettier
Use Prettier.
--print-config
Show config.

FAQ

What is the xo command used for?

xo is an opinionated JavaScript and TypeScript linter built on top of ESLint. It provides a zero-configuration linting experience with a curated set of strict rules designed to enforce consistent, high-quality code without requiring manual ESLint setup. The tool includes built-in TypeScript support and optional Prettier integration for combined linting and formatting. The --fix option automatically corrects fixable issues, while --space switches from the default tab indentation to spaces. By defaulting to strict, well-chosen rules, xo eliminates the need for teams to debate and configure linting rules individually.

How do I run a basic xo example?

Run `xo` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --fix do in xo?

Auto-fix issues.