-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[codemod] Skip sx spread transformation #43291
Conversation
Netlify deploy previewhttps://deploy-preview-43291--material-ui.netlify.app/ Bundle size report |
(data.node.argument.test.type === 'CallExpression' && | ||
data.node.argument.test.callee.type === 'MemberExpression' && | ||
data.node.argument.test.callee.object.name === 'Array' && | ||
data.node.argument.test.callee.property.name === 'isArray') || |
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.
Are you sure that we don't need the sx
prop name check in this rule as well? 🤔
I suspect that given the existing rule, it would skip the following prop as well, even though it probably shouldn't. 🤔
xyz={[
...(Array.isArray(xyz) ? xs : [xyz]),
...(Array.isArray(slotProps?.layout?.xyz) ? slotProps.layout.xyz : [slotProps.layout.sxxyz),
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 codemod only targets sx
prop, so it will not look into this xyz
prop.
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.
Oh, I saw sx
checks in the ||
else rules and assumed these are the only checks. 🙈
LGTM then, sorry for the distraction. 👍
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.
Thanks for taking care of it. 🙏
(data.node.argument.test.type === 'CallExpression' && | ||
data.node.argument.test.callee.type === 'MemberExpression' && | ||
data.node.argument.test.callee.object.name === 'Array' && | ||
data.node.argument.test.callee.property.name === 'isArray') || |
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.
Oh, I saw sx
checks in the ||
else rules and assumed these are the only checks. 🙈
LGTM then, sorry for the distraction. 👍
closes #43230
The code above is a type of sx spread which works with MUI System. The codemod should not transform this code.
Unrelated to this PR but need to check if Pigment CSS will skip this code or not.