-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added codemod for renaming unsafe lifecycles in react #25
base: main
Are you sure you want to change the base?
feat: added codemod for renaming unsafe lifecycles in react #25
Conversation
@@ -0,0 +1 @@ | |||
const toReplace = "hello"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the fixtures need to be updated, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, please take a look and let me know if it works or if any changes are needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shubhraagarwal I ran the tests but they seem to be failing. I can see discrepancies between what I would expect the output to probably be and the given output testfixture. Were you able to get the tests to pass before? By the way, I think it's much easier if you feed the codemod into Codemod Studio, place (and test) your test fixtures there (bottom panels), and then export the codemod package while being sure that the tests were passing.
@shubhraagarwal Fixed the minor issues I found except for the test fixtures. Let me know if you want to pick that up. |
thanks for fixing the license and json issues.i’ll take a look at fixtures,
look at some references and make the changes
…On Wed, 8 Jan 2025 at 8:26 PM, Mohab Sameh ***@***.***> wrote:
@shubhraagarwal <https://github.com/shubhraagarwal> Fixed the minor
issues I found except for the test fixtures. Let me know if you want to
pick that up.
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQA3H67SCKR7724COTODV2T2JU4B5AVCNFSM6AAAAABUZH5YL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZXHA3TIOBVGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
i still dont see the .ts file being added.... @shubhraagarwal once you make all the fixes let me know. |
curious, can we close this out by the end of the week? @shubhraagarwal , @mohab-sameh ? |
Yes, will resolve the issues by weekend
…On Thu, Jan 16, 2025 at 10:49 PM Alex Bit ***@***.***> wrote:
curious, can we close this out by the end of the week? @shubhraagarwal
<https://github.com/shubhraagarwal> , @mohab-sameh
<https://github.com/mohab-sameh> ?
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQA3H65VK4T447BFSMGBEYT2K7SZRAVCNFSM6AAAAABUZH5YL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJWGI4DQNJSGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
🚀 Hey @shubhraagarwal! What's up? 😃 |
Hey, got busy with life 🥲, will complete this as soon as possible,
probably in the next few days
…On Fri, Feb 7, 2025 at 8:13 PM Amirabbas Ghasemi ***@***.***> wrote:
🚀 Hey @shubhraagarwal <https://github.com/shubhraagarwal>! What's up? 😃
We're eagerly waiting for your update! 🔄 What's the status of the issue?
Has it been resolved? The Codemod community would love to see your
improvements! 🚀🔥
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQA3H6ZLXHXNGQBYEP7FLML2OTBBNAVCNFSM6AAAAABUZH5YL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBTGEZTCOJYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@amirabbas-gh @mohab-sameh have updated the testfixtures and tested it locally also, works good for me. Please let me know if any further changes are required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't run tests using npm run test
:
➜ rename-unsafe-lifecycles git:(rename-unsafe-lifecycles) ✗ npm run test
> test
> vitest run
RUN v1.6.1 /***/commons/codemods/react/rename-unsafe-lifecycles
❯ test/test.js (0)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL test/test.js [ test/test.js ]
ReferenceError: describe is not defined
❯ test/test.js:24:1
22| const defineTest = require('jscodeshift/dist/testUtils').defineTest;
23|
24| describe('rename-unsafe-lifecycles', () => {
| ^
25| describe('flow', () => {
26| beforeEach(() => {
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests no tests
Start at 22:25:04
Duration 190ms (transform 42ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 70ms)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add **/test/*.js
to this config because your tests are written in JavaScript.
cc @shubhraagarwal for the next steps... |
📚 Description
While following the command to rename unsafe lifecycles in react given here, I was presented with a command not found.
After discussing with the mods of react-codemod, I copied the existing codemod from that repository, adopted that code according to the codemod standards.
🔗 Linked Issue
https://github.com/reactjs/react-codemod/issues/329🧪 Test Plan
📄 Documentation to Update