Skip to content

Commit 866e6a2

Browse files
committed
docs: place extends after staged configuration
1 parent 3cd57d0 commit 866e6a2

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎website/docs/en/guide/configuration.mdx‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,14 @@ Configuration options follow the formats of the underlying tools. When using API
8080

8181
| API | Tool | Commands |
8282
| ------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
83-
| [`define.extends()`](#define-extends) | — | — |
8483
| [`define.app()`](#define-app) | [Rsbuild](https://rsbuild.rs/config/) | [`rs dev`](./cli/dev), [`rs build`](./cli/build), [`rs preview`](./cli/preview) |
8584
| [`define.lib()`](#define-lib) | [Rslib](https://rslib.rs/config/) | [`rs lib`](./cli/lib) |
8685
| [`define.doc()`](#define-doc) | [Rspress](https://rspress.rs/api/config/config-basic) | [`rs doc`](./cli/doc) |
8786
| [`define.test()`](#define-test) | [Rstest](https://rstest.rs/config/) | [`rs test`](./cli/test) |
8887
| [`define.lint()`](#define-lint) | [Rslint](https://rslint.rs/config/) | [`rs lint`](./cli/lint) |
8988
| [`define.fmt()`](#define-fmt) | [Prettier](https://prettier.io/docs/options) | [`rs fmt`](./cli/fmt) |
9089
| [`define.staged()`](#define-staged) | [lint-staged](https://github.com/lint-staged/lint-staged#configuration) | [`rs staged`](./cli/staged) |
91-
92-
### `define.extends()` \{#define-extends}
93-
94-
Accepts an array of shared configuration objects and applies their tool settings before merging the project's own `define.*()` configurations.
95-
96-
**Type:** `(configs: readonly RstackConfig[]) => void`
97-
98-
See [Shared configurations](#shared-configurations) for usage and merge rules.
90+
| [`define.extends()`](#define-extends) | — | — |
9991

10092
### `define.app()` \{#define-app}
10193

@@ -214,6 +206,14 @@ define.staged({
214206

215207
Provide a staged configuration through `define.staged()` or a [shared configuration](#shared-configurations). `rs staged` reports an error if neither provides one.
216208

209+
### `define.extends()` \{#define-extends}
210+
211+
Accepts an array of shared configuration objects and applies their tool settings before merging the project's own `define.*()` configurations.
212+
213+
**Type:** `(configs: readonly RstackConfig[]) => void`
214+
215+
See [Shared configurations](#shared-configurations) for usage and merge rules.
216+
217217
## Shared configurations
218218

219219
Use `define.extends()` to share build, test, lint, and formatting settings across projects. A shared configuration is a plain object whose fields accept the same values as the corresponding `define.*()` APIs. In TypeScript, use `RstackConfig` to check its types:

‎website/docs/zh/guide/configuration.mdx‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,14 @@ define.fmt({
8080

8181
| API | 底层工具 | 对应命令 |
8282
| ------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
83-
| [`define.extends()`](#define-extends) | — | — |
8483
| [`define.app()`](#define-app) | [Rsbuild](https://rsbuild.rs/zh/config/) | [`rs dev`](./cli/dev)、[`rs build`](./cli/build)、[`rs preview`](./cli/preview) |
8584
| [`define.lib()`](#define-lib) | [Rslib](https://rslib.rs/zh/config/) | [`rs lib`](./cli/lib) |
8685
| [`define.doc()`](#define-doc) | [Rspress](https://rspress.rs/zh/api/config/config-basic) | [`rs doc`](./cli/doc) |
8786
| [`define.test()`](#define-test) | [Rstest](https://rstest.rs/zh/config/) | [`rs test`](./cli/test) |
8887
| [`define.lint()`](#define-lint) | [Rslint](https://rslint.rs/config/) | [`rs lint`](./cli/lint) |
8988
| [`define.fmt()`](#define-fmt) | [Prettier](https://prettier.io/docs/options) | [`rs fmt`](./cli/fmt) |
9089
| [`define.staged()`](#define-staged) | [lint-staged](https://github.com/lint-staged/lint-staged#configuration) | [`rs staged`](./cli/staged) |
91-
92-
### `define.extends()` \{#define-extends}
93-
94-
接收一组公共配置对象,先应用其中各工具的配置,再合并当前项目通过 `define.*()` 定义的配置。
95-
96-
**类型:** `(configs: readonly RstackConfig[]) => void`
97-
98-
用法和合并规则请参阅[公共配置](#shared-configurations)。
90+
| [`define.extends()`](#define-extends) | — | — |
9991

10092
### `define.app()` \{#define-app}
10193

@@ -214,6 +206,14 @@ define.staged({
214206

215207
请通过 `define.staged()` 或[公共配置](#shared-configurations)提供 staged 配置,否则 `rs staged` 会报错。
216208

209+
### `define.extends()` \{#define-extends}
210+
211+
接收一组公共配置对象,先应用其中各工具的配置,再合并当前项目通过 `define.*()` 定义的配置。
212+
213+
**类型:** `(configs: readonly RstackConfig[]) => void`
214+
215+
用法和合并规则请参阅[公共配置](#shared-configurations)。
216+
217217
## 公共配置 \{#shared-configurations}
218218

219219
使用 `define.extends()` 可以在多个项目之间共享构建、测试、lint 和格式化配置。公共配置是一个普通对象,各字段的用法与对应的 `define.*()` API 一致。在 TypeScript 中,可以用 `RstackConfig` 检查配置类型:

0 commit comments

Comments
 (0)