dojo / dojo/cli-upgrade-app

Automatically migrate `.replace` to `.replaceChildren` for assertionTemplates

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1
Forks
10
PR merge metrics
No merged PRs in 30d

Description

The `.replace` API has been renamed in version 6 to `replaceChildren`. We should look at whether this is something that we can automate using the upgrade tool.

```ts
const baseAssertion = assertionTemplate(() => v('div', { '~key': 'root' }, [
v('span')
]));

const buttonAssertion = baseAssertion.replace('~root', [ v('button') ]);

const otherAssertion = buttonAssertion.replace('~root', [ v('div') ]);
```

Would become

```ts
const baseAssertion = assertionTemplate(() => v('div', { '~key': 'root' }, [
v('span')
]));

const buttonAssertion = baseAssertion.replaceChildren('~root', [ v('button') ]);

const otherAssertion = buttonAssertion.replaceChildren('~root', [ v('div') ]);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named. Start by tracing the upgrade tool's migration entry points and existing transforms for assertionTemplates, then determine whether the example's `.replace` calls can be safely rewritten to `.replaceChildren`. Done means the upgrade tool performs this migration correctly and has coverage for the shown transformation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.