/** * Example migration unit — template for creating new units. * * This file is a documented reference for how to build a migration unit. * It has `enabled: false`, so it will not appear in `green-core-context * migrate list` or be executed during `migrate run`. * * ## How to create a new migration unit * * 1. Create a file under `units//` (e.g. `units/3/my-migration.ts`) * 2. Export a `MigrationUnit` object as `export const unit` * 3. The registry auto-discovers it from the directory structure — no * manual registration needed * * ## Multi-framework / multi-syntax coverage * * A single migration unit should cover ONE semantic change across ALL * syntax variants. We cannot determine framework from file extension — * an Angular template may live inside a `.ts` file, plain HTML may live * in a `.html` file that is not Angular, and React JSX uses `.tsx`. * * Instead, define variant patterns for every known syntax form of the * same attribute/property rename: * * - HTML attribute: `gds-theme="dark"` * - Angular property: `[gdsTheme]="expr"` * - Angular attr binding: `[attr.gds-theme]="expr"` * - React JSX prop: `gdsTheme="dark"` or `gdsTheme={expr}` * - JS property assignment: `.gdsTheme = value` * - JS setAttribute call: `setAttribute('gds-theme', value)` * * All patterns are applied to ALL files. This means the unit will find * Angular bindings in a `.tsx` file too — that is intentional and harmless. * False positives are better than missed migrations. * * ## Guidelines * * - Keep regex patterns simple and well-commented * - Use non-capturing groups `(?:...)` unless capture is needed * - Reset `lastIndex` before reusing a regex with the `g` flag * - In `detect()`, always set `file` to `filePath` — the engine * normalises it to a relative path afterwards * - In `apply()`, return `null` if nothing changed * - Mark matches as `manualReview: true` when auto-fix isn't safe * - Prefer line-by-line scanning for readable detect logic * - Always provide `exampleBefore` / `exampleAfter` — they are used by * coding models as context when applying changes manually * * @module migrate/units/0/example */ import type { MigrationUnit } from '../../types.js'; export declare const unit: MigrationUnit;