> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# check

`rs check` 命令用于检查当前项目的 lint 和格式问题，也可以启用 TypeScript 类型检查。

## 用法 \{#usage}

```bash
rs check [options] [files...]
```

传入文件或目录，可以只检查指定路径下的 lint 和格式问题：

```bash
rs check src/index.ts packages/utils
```

## 检查内容 \{#checks}

默认情况下，`rs check` 会先运行 [`rs lint`](/zh/guide/cli/lint.md)，再运行 [`rs fmt --check`](/zh/guide/cli/fmt.md#--check)，仅报告问题，不修改文件。

即使 lint 或类型检查报告错误，也会继续检查格式。只有所有已启用的检查都通过，命令才会成功退出。

## 选项 \{#options}

### `--fix`

自动修复 lint 和格式问题：

```bash
rs check --fix
```

该选项会先运行 `rs lint --fix`，自动修复 lint 问题。只有 lint 和已启用的类型检查都通过，才会继续运行 `rs fmt --write`，格式化修复后的文件。

### `--type-check`

添加 `--type-check`，可在 lint 过程中启用 TypeScript 类型检查：

```bash
rs check --type-check
```

### `-h, --help`

显示命令用法和选项信息，但不运行检查：

```bash
rs check --help
```

## 配置 \{#configuration}

`rs check` 使用 [`define.lint()`](/zh/guide/configuration.md#define-lint) 中的 lint 配置，以及 [`define.fmt()`](/zh/guide/configuration.md#define-fmt) 中的格式化配置。
