Skip to content

Commit ec69a6a

Browse files
committed
docs: update spec for type import exclusion, sub-component detection, deprecated messages, and extraction fix
1 parent 4766bcc commit ec69a6a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

spec.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ When `--version 4.3.5` is requested, `loadMetadataForVersion("4.3.5")` resolves
5959

6060
### Data Layer Notes
6161

62-
- On load, component props are deduplicated by name (first entry wins) and trailing ` \` from markdown table continuation lines is stripped from `type`, `default`, and `since` fields. This is a defensive normalisation — the extraction script should be the authoritative fix.
62+
- On load, component props are deduplicated by name (first entry wins).
63+
- The extraction script handles `\|` (escaped pipes in markdown table cells) by replacing them with a placeholder before splitting. This ensures multi-value union types like `` `primary` \| `dashed` \| `link` `` are stored correctly as `` `primary` | `dashed` | `link` `` instead of being split across wrong columns.
6364
- Each version file contains both `en` and `zh` descriptions, keyed by language
6465
- `semantic` data extracted from `components/*/demo/_semantic.tsx` files
6566
- Data is auto-extracted from antd source via `scripts/extract.ts`
@@ -297,7 +298,7 @@ antd usage ./src -f Form # combine directory and filter
297298
antd usage --format json
298299
```
299300

300-
Imports are cross-referenced against the antd metadata for the detected version. Known antd component exports (e.g. `Button`, `Form`) appear in `components`. Non-component antd exports (e.g. `message`, `notification`, `theme`, `version`, TypeScript type-only imports like `FormInstance`) are reported separately in `nonComponents`. TypeScript `import { type X }` syntax is handled — the `type` keyword is stripped before matching.
301+
Imports are cross-referenced against the antd metadata for the detected version. Known antd component exports (e.g. `Button`, `Form`, `Row`, `Col`) appear in `components`. Non-component antd exports (e.g. `message`, `notification`, `theme`) are reported separately in `nonComponents`. TypeScript `import { type X }` syntax is handled — type-only imports are excluded entirely (they are not runtime values and have no component usage to track). Sub-component usage detection only counts JSX sub-components with capitalized names (e.g. `Form.Item`, `Table.Column`), not method or hook calls (e.g. `Form.useForm`, `Modal.confirm`).
301302

302303
The scanner skips directories named `node_modules`, `dist`, `build`, `.next`, `.git`, and any directory whose name starts with `.umi` (covers `.umi`, `.umi-production`, `.umi-test`, etc.).
303304

@@ -350,6 +351,8 @@ JSON output:
350351

351352
Note: This is complementary to ESLint. `antd lint` focuses on antd-specific knowledge (deprecated APIs per version, antd best practices) that generic ESLint rules cannot cover.
352353

354+
When a deprecated prop has a replacement hint in its description (e.g. "please use `variant` instead"), the warning includes the replacement: `` Card `bordered` prop is deprecated, use `variant` instead ``.
355+
353356
#### `antd migrate <from> <to>`
354357

355358
Version migration guide with optional auto-fix.

0 commit comments

Comments
 (0)