-
-
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
[material-ui][avatar] Add props deprecation with a codemod #40853
Conversation
Netlify deploy preview@material-ui/lab: parsed: +0.37% , gzip: +0.38% Bundle size reportDetails of bundle changes (Toolpad) |
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
@DiegoAndai I adjust the migration doc format a bit to start with codemod because I think that's what the majority of users are looking for. |
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.
Some comments/questions 😊
docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md
Outdated
Show resolved
Hide resolved
const root = j(file.source); | ||
const printOptions = options.printOptions; | ||
|
||
findComponentJSX(j, { root, componentName: 'Avatar' }, (elementPath) => { |
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.
We should look into an abstraction for the slot pattern standardization codemods, as all will be pretty similar. It doesn't need to happen now, we can wait until we have a couple more.
}); | ||
}); | ||
|
||
root.find(j.ImportDeclaration, { source: { value: '@mui/material' } }).forEach((path) => { |
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.
Isn't @mui/material
covered above?
Thanks! can you rebase and do the same for the recently added Divider one? |
|
||
/** | ||
* @param {import('jscodeshift').FileInfo} file | ||
* @param {import('jscodeshift').API} api | ||
*/ | ||
export default function deprecationsAll(file, api, options) { | ||
file.source = transformAccordionProps(file, api, options); | ||
file.source = transformAvatarProps(file, api, options); | ||
file.source = transformDividerProps(file, api, options); |
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.
@DiegoAndai For completeness, I added divider transform here. Let me know if this is okay to you, otherwise I will open a separate PR.
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.
That's perfect, we missed it 😅
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 🚀
I changed the guide links to point to HEAD
docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md
Outdated
Show resolved
Hide resolved
docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md
Outdated
Show resolved
Hide resolved
docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Diego Andai <diego@mui.com>
Part of #40417