-
Notifications
You must be signed in to change notification settings - Fork 64
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
LG-4525: popover-v12 code mod #2484
Conversation
🦋 Changeset detectedLatest commit: 6520e5c The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
7e740ac
to
c133311
Compare
Size Change: +92 B (+0.01%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
tools/codemods/src/codemods/consolidate-popover-usePortal-renderMode-props/transform.ts
Outdated
Show resolved
Hide resolved
tools/codemods/src/utils/transformations/addJSXAttributes/addJSXAttributes.ts
Show resolved
Hide resolved
tools/codemods/src/codemods/consolidate-popover-usePortal-renderMode-props/transform.ts
Outdated
Show resolved
Hide resolved
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.
This looks great! A few comments I have:
- Can you update the README to include this codemod? We should also remove the current codemods in the README because those currently are not consumer-facing.
- Should we also add a section in
Popover
's README about this codemod? - You mentioned before about creating codemods for components that consume
Popover
such asSelect
,Tooltip
, etc. What's the plan for those components? We could technically add all those components into this codemode. We can create an array of components that need updating and loop through them in the transformer file. - Were you able to test this locally with
yarn lg codemod consolidate-usePortal-into-renderMode <path>
?
done!
I have some README changes in PR #2482 that I'd want to build off of. I will revisit this with work in this ticket
great, I updated the code mod to cover those components as well
I tested it locally on the LGUI repo, and it's able to correctly modify most instances. It errors on a few unique cases which I might expect it to but curious what degree of effectiveness we should expect / be aiming for:
|
6bd427a
to
54664af
Compare
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.
LGTM!
tools/codemods/src/codemods/consolidate-popover-usePortal-renderMode-props/transform.ts
Outdated
Show resolved
Hide resolved
6c8a4cd
to
3cfece1
Compare
54664af
to
0c1e5fb
Compare
01fdd0f
to
fab3612
Compare
tools/codemods/src/utils/transformations/removeJSXAttributes/removeJSXAttributes.ts
Outdated
Show resolved
Hide resolved
|
||
const WrappedPopover = () => { | ||
return ( | ||
/* Please manually update from prop: usePortal to prop: renderMode */ |
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.
🔥
0b07e37
to
9133382
Compare
tools/codemods/src/codemods/consolidate-props/tests/consolidate-props.output.tsx
Show resolved
Hide resolved
tools/codemods/src/utils/transformations/removeJSXAttributes/removeJSXAttributes.ts
Show resolved
Hide resolved
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'm sorry If I asked this before, but have you tested this in an app besides the jest tests? When i was working on this, i linked from .design so that i could run the codemode there.
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 forgot to mention another thing: can you update the transform.config.js file inside the codemods directory? I'm not sure if this file is doing anything but we should remove the codemods that don't exist anymore.
2ed7bbd
to
2d1cbb1
Compare
* Add addJSXAttributes code mod util * Update consolidateJSXAttributes util to handle edge case * Add removeJSXAttributes code mod util * Fix comment utils * Export utils from utils/transformations * Add popover-v12 codemod * Changeset * Fix build type * Clean up comments * Update docs * Add commentOverride * Update transform.config.js
✍️ Proposed changes
consolidateJSXAttributes
utilinsertJSXComment
utiladdJSXAttributes
utilremoveJSXAttributes
utilpopover-v12
code mod🎟 Jira ticket: LG-4525
✅ Checklist
For bug fixes, new features & breaking changes
yarn changeset
and documented my changes