Skip to content

Commit eea2805

Browse files
chenjiahanswwind
andauthored
docs(skills): update lint migration guidance (#356)
Co-authored-by: swwind <i@sww.moe>
1 parent c843462 commit eea2805

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

.agents/skills/migrate-to-rstack-cli/SKILL.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,21 @@ define.test({
5353
});
5454
```
5555

56-
Prefer async config functions and dynamic imports for runtime plugins and presets:
56+
Use dynamic imports in async config functions only for external plugins, presets, and other dependencies:
5757

5858
```ts
59-
define.lint(async () => {
60-
const { js, ts } = await import('rstack/lint');
61-
return [js.configs.recommended, ts.configs.recommended];
59+
define.app(async () => {
60+
const { pluginReact } = await import('@rsbuild/plugin-react');
61+
return {
62+
plugins: [pluginReact()],
63+
};
6264
});
6365
```
6466

67+
`define.lint` provides `@rslint/core` APIs to its config factory, so no manual import is needed:
68+
69+
```ts
70+
define.lint(({ js }) => [js.configs.recommended]);
71+
```
72+
6573
Rstack loads TypeScript configs as native ESM. Preserve runtime-resolvable file extensions, replace CommonJS globals such as `__dirname`.

.agents/skills/migrate-to-rstack-cli/references/rslint.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@ Read this reference when the project uses `@rslint/core`, `rslint.config.*`, `rs
55
## Steps
66

77
1. Replace the `rslint` executable prefix with `rs lint`. For example, replace `rslint --fix` with `rs lint --fix`.
8-
2. Move the old config into `define.lint`, replacing Rslint's `defineConfig()` wrapper and import. Dynamically import presets from `rstack/lint` inside an async config function.
9-
3. Replace direct config/API imports from `@rslint/core` with exports from `rstack/lint` where available.
10-
4. Replace custom `--config` paths with the migrated `rstack.config.*` path.
11-
5. Remove `@rslint/core` only when no uncovered direct runtime API remains. Delete `rslint.config.*`.
8+
2. Move the old config into `define.lint`, replacing Rslint's `defineConfig()` wrapper and import. Receive `@rslint/core` exports from the factory parameter.
9+
3. Replace custom `--config` paths with the migrated `rstack.config.*` path.
10+
4. Remove `@rslint/core` only when no uncovered direct runtime API remains. Delete `rslint.config.*`.
1211

1312
## Config Pattern
1413

1514
```ts
1615
import { define } from 'rstack';
1716

18-
define.lint(async () => {
19-
const { js, ts } = await import('rstack/lint');
20-
return [js.configs.recommended, ts.configs.recommended];
21-
});
17+
define.lint(({ js, ts }) => [js.configs.recommended, ts.configs.recommendedTypeChecked]);
2218
```
2319

20+
Preserve existing presets and rules during migration.
21+
2422
## Script Pattern
2523

2624
If a script also runs Prettier, migrate its formatting command as described in [prettier.md](prettier.md).

0 commit comments

Comments
 (0)