Skip to content
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

[Grid2] Add removal of item prop to grid-v2-props codemod #43794

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

sai6855
Copy link
Contributor

@sai6855 sai6855 commented Sep 17, 2024

closes #43621

@sai6855 sai6855 marked this pull request as draft September 17, 2024 10:21
@sai6855 sai6855 added bug 🐛 Something doesn't work component: Grid The React component. package: material-ui Specific to @mui/material package: codemod Specific to @mui/codemod labels Sep 17, 2024
@mui-bot
Copy link

mui-bot commented Sep 17, 2024

Netlify deploy preview

https://deploy-preview-43794--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 24e88d6

@sai6855 sai6855 changed the title [Grid2] Add removal to item prop to grid codemod [Grid2] Add removal to item prop to grid-v2-props codemod Sep 17, 2024
@sai6855 sai6855 marked this pull request as ready for review September 17, 2024 10:32
@sai6855 sai6855 changed the title [Grid2] Add removal to item prop to grid-v2-props codemod [Grid2] Add removal of item prop to grid-v2-props codemod Sep 17, 2024
@@ -192,6 +192,16 @@ export default function gridV2Props(file, api, options) {
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(
(attr) => !attributesToPrune.includes(attr),
);

const itemProp = el.node.openingElement.attributes.find(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation taken from

const lightProp = elementPath.node.openingElement.attributes.find(
(attr) => attr.type === 'JSXAttribute' && attr.name.name === 'light',
);
if (!lightProp) {
return;
}
elementPath.node.openingElement.attributes = elementPath.node.openingElement.attributes.filter(
(attr) => {
if (attr.type === 'JSXAttribute' && attr.name.name === 'light') {
return false;
}
return true;

Copy link
Member

@aarongarciah aarongarciah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@aarongarciah aarongarciah merged commit 52b99cd into mui:master Sep 17, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: Grid The React component. package: codemod Specific to @mui/codemod package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[material-ui][Grid] codemod not updating Grid
3 participants