Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The codemod is heavy, and designed for large migrations a package at a time. We'd like to be able to re-use the logic, but do it in a faster and much smaller way. This is an experiment in invoking something quickly that can make an individual change.
My thought is to write a special-purpose migrator that takes a file name and a character position. So if we give it a character position anywhere within a string it migrates just that string and exits.
Right now, all this does is run just the constant migrator on a single file. If it's already been compiled, then it runs in sub-second time. But that's not doing a
ddev format
on the _intl.dart file. So we could accept that and leave it unformatted, or we could make the IDE extension run the format on save operation, which is generally faster, or something else. I'm thinking something likedart pub global run over_react_codemod:intl_quick --character-position=12345 --file=lib/src/stuff/thing.dart
So this seems reasonably promising. The migrators can run without a resolved analysis, and do it pretty quickly.
We'd still need to validate we can call this from the IDE extensions easily and get the information we need. And things like revert would take some doing.
Changes
Release Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
QA Checklist
Merge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: