@backstage/migrate-checkbox-to-react-aria
Migrates Checkbox component usage from the Base UI implementation to the React Aria implementation introduced in @backstage/ui@0.9.0 (Backstage v1.45.0).
What it transforms
- Prop renames —
checked→isSelected,defaultChecked→defaultSelected,disabled→isDisabled,required→isRequired labelprop → children — convertslabel="text"orlabel={expr}to children content, changing self-closing elements to open/close formdata-checked→data-selected— renames data attributes in JSX attribute valuesbui-CheckboxLabel— flags references with a// TODO(backstage-codemod)comment since this CSS class was removed
Handles named imports, aliased imports, and namespace imports.
Installation
bash
Usage (from this repo)
bash
AI fixup
For complex cases the AST transform cannot handle mechanically:
bash
Development
From the repo root:
bash
Known limitations
bui-CheckboxLabelCSS class references are flagged with a TODO but not removed — manual review requireddata-checked→data-selectedreplacement only applies to strings within JSX attributes; CSS files need manual update- Checkboxes without a
labelprop and without existing children are not flagged — the new Checkbox requires a label via children
License
MIT