For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/guide/cli/check.md.
close
  • 简体中文
  • check

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

    用法

    rs check [options] [files...]

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

    rs check src/index.ts packages/utils

    检查内容

    默认情况下,rs check 会先运行 rs lint,再运行 rs fmt --check,仅报告问题,不修改文件。

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

    选项

    --fix

    自动修复 lint 和格式问题:

    rs check --fix

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

    --type-check

    添加 --type-check,可在 lint 过程中启用 TypeScript 类型检查:

    rs check --type-check

    -h, --help

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

    rs check --help

    配置

    rs check 使用 define.lint() 中的 lint 配置,以及 define.fmt() 中的格式化配置。