Closed
Conversation
810550e to
429d6f2
Compare
pieterv
reviewed
Jan 10, 2024
scripts/codemod/index.js
Outdated
| createVisitors, | ||
| prettierOptions | ||
| ); | ||
| writeFileSync(filename, transformedCode, 'utf8'); |
Member
There was a problem hiding this comment.
You can do if (originalCode !== transformedCode) { to avoid writing to files that don't change.
scripts/codemod/index.js
Outdated
|
|
||
| const prettierOptions = require('../../.prettierrc.js'); | ||
| // path based overrides don't work, this applies to most files | ||
| prettierOptions.trailingComma = 'all'; |
Member
There was a problem hiding this comment.
I believe you can do the following in each transform so path based overrides work:
const prettierOptions = await Prettier.resolveConfig(filePath, {
config:'../../.prettierrc.js',
editorconfig: false,
});
kassens
added a commit
to kassens/react
that referenced
this pull request
Jan 10, 2024
Using the codemod from facebook#27921 as a starting point, this migrates the test to `createRoot`.
kassens
added a commit
to kassens/react
that referenced
this pull request
Jan 11, 2024
Using the codemod from facebook#27921 as a starting point, this migrates the test to `createRoot`.
kassens
added a commit
that referenced
this pull request
Jan 12, 2024
) Upgrade ReactDOMShorthandCSSPropertyCollision-test to createRoot Using the codemod from #27921 as a starting point, this migrates the test to `createRoot`.
f9f3b0f to
ce0d533
Compare
This adds `hermes-transform` as a dependency for scripts to allow us to run some codemods updating tests. If this turns out useful, there's obviously more that can be done to the script, but as these internal codemods are pretty one-off, I'm also okay to keep it fairly rough. The included codemod is a starting point to convert tests to `crateRoot`. Due to many different patterns in tests, this does just the following: - convert `it` and `expect` calls that contain `ReactDOM.render` to the async variant, so `await` can be used inside. - convert `ReactDOM.render(el, container)` to `root.render(el)`. Note that this does not create `root` and that needs to be updated manually.
jackpope
reviewed
Jan 18, 2024
| }; | ||
| } | ||
|
|
||
| // function updateExpectToAsync(context: TransformContext) { |
Contributor
There was a problem hiding this comment.
Are these commented out steps expected to be toggle on and used at all? Should we clean up for now and merge this so its easier to use it in the test migrations?
EdisonVan
pushed a commit
to EdisonVan/react
that referenced
this pull request
Apr 15, 2024
…ebook#27924) Upgrade ReactDOMShorthandCSSPropertyCollision-test to createRoot Using the codemod from facebook#27921 as a starting point, this migrates the test to `createRoot`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add hermes-transform infra
This adds
hermes-transformas a dependency for scripts to allow us to run some codemods updating tests.If this turns out useful, there's obviously more that can be done to the script, but as these internal codemods
are pretty one-off, I'm also okay to keep it fairly rough.
The included codemod is a starting point to convert tests to
crateRoot. Due to many different patterns in tests, this does just the following:itandexpectcalls that containReactDOM.renderto the async variant, soawaitcan be used inside.ReactDOM.render(el, container)toroot.render(el). Note that this does not createrootand that needs to be updated manually.Stack created with Sapling. Best reviewed with ReviewStack.