From ca012cb12bc9b5e486621a36e359e166d385d107 Mon Sep 17 00:00:00 2001 From: Dmytro Kirpa Date: Wed, 4 Mar 2026 15:43:16 +0100 Subject: [PATCH 1/6] docs: cover more component migrations in fluent-migrate-v8-to-v9 --- skills/fluentui-migrate-v8-to-v9/SKILL.md | 331 +++++++++++++----- .../references/breadcrumb.md | 92 +++++ .../references/button.md | 32 ++ .../references/card.md | 79 +++++ .../references/charts.md | 49 +++ .../references/colorpicker.md | 59 ++++ .../references/image.md | 67 ++++ .../references/keytips.md | 76 ++++ .../references/label.md | 41 +++ .../references/link.md | 81 +++++ .../references/list.md | 92 +++++ .../references/nav.md | 112 ++++++ .../references/overflow.md | 117 +++++++ .../references/persona.md | 81 +++++ .../references/rating.md | 88 +++++ .../references/searchbox.md | 68 ++++ .../references/separator.md | 44 +++ .../references/skeleton.md | 76 ++++ .../references/swatchpicker.md | 101 ++++++ .../references/switch.md | 49 +++ .../references/tagpicker.md | 107 ++++++ .../references/teachingpopover.md | 117 +++++++ .../references/text.md | 82 +++++ .../references/textarea.md | 55 +++ .../references/theme.md | 29 +- .../references/toolbar.md | 25 ++ .../references/tree.md | 101 ++++++ 27 files changed, 2169 insertions(+), 82 deletions(-) create mode 100644 skills/fluentui-migrate-v8-to-v9/references/breadcrumb.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/card.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/charts.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/colorpicker.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/image.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/keytips.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/label.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/link.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/list.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/nav.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/overflow.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/persona.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/rating.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/searchbox.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/separator.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/skeleton.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/swatchpicker.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/switch.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/tagpicker.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/teachingpopover.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/text.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/textarea.md create mode 100644 skills/fluentui-migrate-v8-to-v9/references/tree.md diff --git a/skills/fluentui-migrate-v8-to-v9/SKILL.md b/skills/fluentui-migrate-v8-to-v9/SKILL.md index c7bd906ac4bdea..da037730bafbd9 100644 --- a/skills/fluentui-migrate-v8-to-v9/SKILL.md +++ b/skills/fluentui-migrate-v8-to-v9/SKILL.md @@ -5,23 +5,89 @@ description: 'Guides migration from Fluent UI React v8 (@fluentui/react) to v9 ( # Fluent UI v8 → v9 Migration +## Agent Output Template + +After completing a migration session, report using this structure: + +``` +### Migration Report + +**Scope:** files, component types migrated +**Assumptions logged:** (see inline `// MIGRATION ASSUMPTION:` comments) +**Unresolved deltas:** +**Shims still in place:** +**Shim removal plan:** +**Reference precedence used:** +**Validation evidence:** + - TypeScript check (): ✅ / ❌ (baseline was ) + - lint: ✅ / ❌ / ⏭️ skipped (no linter found) + - tests: ✅ / ❌ / ⏭️ skipped (no test command found) + - No remaining @fluentui/react imports: ✅ / ❌ +**Final status:** ✅ Complete / ⚠️ Partial (see unresolved deltas) / ❌ Blocked () +``` + +--- + ## Migration Workflow ### Step 1 — Assess -Find all files using v8: +**Determine source root first:** + +1. Check `tsconfig.json` for `include` or `rootDir` to identify the source root (e.g., `src/`, `app/`, `lib/`) +2. In a monorepo or if multiple `tsconfig.json` files exist, ask the user: _"Which directory or package should I migrate? (e.g., `packages/my-app/src`)"_ +3. If no tsconfig exists, default to searching from the repo root (`.`) and adjust from there + +Replace `` in the commands below with the path you identified: ```sh -# All files importing from @fluentui/react -grep -rl "@fluentui/react" src/ --include="*.tsx" --include="*.ts" +# All files importing from @fluentui/react — adjust path to your repo layout +grep -rl "@fluentui/react" --include="*.tsx" --include="*.ts" # Tally component usage to prioritize -grep -rh "from '@fluentui/react'" src/ | sort | uniq -c | sort -rn +grep -rh "from '@fluentui/react'" --include="*.tsx" --include="*.ts" | sort | uniq -c | sort -rn ``` Identify which components are used and how many times. Migrate high-count simple components first. -### Step 2 — Setup +Skip files that import **only** from `@fluentui/react-components` — they are already migrated. + +### Setup Boundary + +**Agents do not run installs.** Read `package.json` and report what's missing; the user installs. + +Ready-to-proceed conditions (verify before starting Step 3): + +- `@fluentui/react-components` is present in `package.json` dependencies +- A `FluentProvider` wrapper exists somewhere in the codebase (or the user has confirmed they will add one) + +If either condition is unmet, report what's needed and stop until the user confirms setup is complete. + +### Agent Execution Contract + +**Phase order:** assess (+ tsc baseline) → plan → mechanical pass → semantic pass → validate → report (Output Template above) + +**Baseline TypeScript check before starting:** run the repo's TypeScript check command (`tsc --noEmit` or the equivalent in `package.json` scripts) before any changes and record the error count. In the Validation step, report TypeScript as ✅ if post-migration error count ≤ baseline — do not block on pre-existing errors. + +**Behavior-preserving default:** when uncertain, preserve existing behavior. Never silently drop functionality. + +**Confidence threshold:** if you are less than ~80% confident in a mapping, add an inline comment and flag it — do not skip it silently: + +```tsx +// MIGRATION ASSUMPTION: GroupedList mapped to Tree (expand/collapse usage detected). Verify if tabular layout was intended. +``` + +**Stop and escalate when:** + +- TypeScript errors remain after mechanical pass that you cannot resolve +- A component has no known v9 equivalent and no clear workaround +- More than 2 unresolved 1→many mappings in the same file (see Ambiguity Resolution below) + +In those cases: commit what's done, fill in the Output Template with status ⚠️ or ❌, list the blockers, and wait for user input. + +### Step 2 — User Setup (reference only) + +> **Agent note:** do not execute these commands. Report which packages are missing from `package.json` and wait for the user to confirm installation is complete before proceeding to Step 3. ```sh npm install @fluentui/react-components @fluentui/react-icons @@ -51,8 +117,10 @@ import { PortalCompatProvider } from '@fluentui/react-portal-compat'; **Recommended order within a file:** +#### Pass 1 — Mechanical (safe to automate) + 1. Update import statements (`@fluentui/react` → `@fluentui/react-components`) -2. Rename components per the mapping table below +2. Rename components per the mapping table below (1→1 renames only; defer 1→many to Pass 2) 3. Apply universal prop renames (applies to every component): - `componentRef` → `ref` - `ariaLabel` → `aria-label` @@ -63,6 +131,9 @@ import { PortalCompatProvider } from '@fluentui/react-portal-compat'; - Combine class names with `mergeClasses(s.a, s.b, extra)` (replaces `cx` / `mergeStyles` for className composition) - Remove `theme` prop → handled by `FluentProvider` 4. Apply component-specific prop changes (see reference files below) + +#### Pass 2 — Semantic (requires judgment) + 5. Replace v8-only utility imports (no v9 equivalent — remove the import and use the native alternative): - `useBoolean` → `React.useState(false)` (`const [open, setOpen] = React.useState(false)`) - `KeyCodes.enter` / `KeyCodes.escape` → `event.key === 'Enter'` / `event.key === 'Escape'` @@ -81,6 +152,7 @@ import { PortalCompatProvider } from '@fluentui/react-portal-compat'; ``` - **Alternative (manual):** separate `