Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion website/docs/en/guide/cli/fmt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,23 @@ rs fmt --cache-location .cache/rs-fmt

Relative paths are resolved from the current working directory, while absolute paths are used as-is. The directory is created as needed and excluded from file discovery. Unlike the default cache location, a custom directory does not receive an automatic `.gitignore`; exclude it from version control or manage it through your CI cache configuration.

When both options are provided, `--no-cache` takes precedence and the custom directory is not excluded from file discovery.
If you also pass `--no-cache`, `--cache-location` is ignored and the directory follows the normal file discovery rules.

### `--clear-cache`

Clear the formatting cache and exit without formatting or checking files:

```bash
rs fmt --clear-cache
Comment thread
chenjiahan marked this conversation as resolved.
Resolved
```

The command removes only the cache file, preserving the directory and other files. The default cache location is `.rstack/cache/fmt` under the Rstack configuration root. Use `--cache-location` to specify a custom cache directory:

```bash
rs fmt --clear-cache --cache-location .cache/rs-fmt
```

`--clear-cache` only clears the cache; it does not accept file arguments or other mode options.

### `--no-error-on-unmatched-pattern`

Expand Down
10 changes: 8 additions & 2 deletions website/docs/en/guide/formatting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,15 @@ If you enable these plugins only for specific files through `overrides`, only th

### Clearing the cache

To clear the formatting cache, delete `.rstack/cache/fmt` or the directory specified by `--cache-location`. `rs fmt` recreates the cache as needed.
To clear the formatting cache, run:

Keep the rest of `.rstack`: it may contain Git hook scripts maintained by your project.
```bash
rs fmt --clear-cache
```

If you use a custom cache directory, include `--cache-location <path>`.

The command deletes only the cache file, then exits without formatting files. See [`--clear-cache`](./cli/fmt#--clear-cache) for details.

## Prettier plugins

Expand Down
18 changes: 17 additions & 1 deletion website/docs/zh/guide/cli/fmt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,23 @@ rs fmt --cache-location .cache/rs-fmt

相对路径基于当前工作目录解析,绝对路径则原样使用。目录会在需要时自动创建,并从文件发现中排除。与默认缓存位置不同,自定义目录不会自动生成 `.gitignore`;请将其排除在版本控制之外,或通过 CI 缓存配置进行管理。

同时使用两个选项时,优先使用 `--no-cache`,且不会从文件发现中排除自定义目录。
如果同时传入 `--no-cache`,`--cache-location` 会被忽略,该目录将按正常的文件发现规则处理。

### `--clear-cache`

清理格式化缓存后退出,不执行格式化或格式检查:

```bash
rs fmt --clear-cache
```

命令只删除缓存文件,保留目录和其他文件。默认缓存位于 Rstack 配置根目录下的 `.rstack/cache/fmt`,也可以通过 `--cache-location` 指定自定义缓存目录:

```bash
rs fmt --clear-cache --cache-location .cache/rs-fmt
```

`--clear-cache` 仅用于清理缓存,不接受文件参数或其他运行模式选项。

### `--no-error-on-unmatched-pattern`

Expand Down
10 changes: 8 additions & 2 deletions website/docs/zh/guide/formatting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,15 @@ rs fmt --cache-location .cache/rs-fmt

### 清理缓存 \{#clearing-the-cache}

删除 `.rstack/cache/fmt` 或通过 `--cache-location` 指定的目录,即可清理格式化缓存。`rs fmt` 会在需要时重新生成缓存。
运行以下命令可以清理格式化缓存:

请保留 `.rstack` 中的其他内容,其中可能包含项目维护的 Git hook 脚本。
```bash
rs fmt --clear-cache
```

如果使用了自定义缓存目录,同时传入 `--cache-location <path>` 即可。

命令只删除缓存文件,随后退出,不执行格式化。更多用法见 [`--clear-cache`](./cli/fmt#--clear-cache)。

## Prettier 插件 \{#prettier-plugins}

Expand Down
Loading