-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[code-infra] Fix proptypes generation #11776
Conversation
@@ -588,128 +588,394 @@ GridRow.propTypes = { | |||
onMouseLeave: PropTypes.func, | |||
pinnedColumns: PropTypes.shape({ |
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 could probably add this prop to the one to skip 🙈
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.
@cherniavskii what do you think?
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.
Yes, absolutely 👍🏻
packages/x-charts/src/ChartsTooltip/DefaultChartsAxisTooltipContent.tsx
Outdated
Show resolved
Hide resolved
packages/x-charts/src/ChartsTooltip/DefaultChartsAxisTooltipContent.tsx
Outdated
Show resolved
Hide resolved
Deploy preview: https://deploy-preview-11776--material-ui-x.netlify.app/ Updated pages: |
docs/scripts/generateProptypes.ts
Outdated
@@ -43,6 +43,12 @@ async function generateProptypes(project: XTypeScriptProject, sourceFile: string | |||
if (propsToNotResolve.includes(name)) { | |||
return false; | |||
} | |||
if (project.name.includes('x-charts') && sourceFile.includes('AxisTooltip')) { |
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.
Could we also include ChartsContainer
here?
Is there a reason not to skip those props on all components or at least all x-charts
components?
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.
My idea was that chart container is the place where the series have to pass, because it is the component where series
is processed.
So having proptypes here to spot early type error for users that are not using typescript was a good reward on investment
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.
But this prop-type is so long 😭
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.
What's the issue of too long proptypes?
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.
Bundle size in dev mostly (I hope everybody is removing them from the prod bundle).
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 reassure you, MUI is automatically removing proptypes in the build thanks to a babel plugin made by a nice contributor 😁
Here is the result if you look in the built package
process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
classes: _propTypes.default.object,
dataIndex: _propTypes.default.number.isRequired,
highlightScope: _propTypes.default.shape({
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
}),
/**
* The props used for each component slot.
* @default {}
*/
slotProps: _propTypes.default.object,
/**
* Overridable component slots.
* @default {}
*/
slots: _propTypes.default.object
} : void 0;
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 moved with the remove all big proptypes. Will put them back if it solves some issues asked by users
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.
OK this plugin is awesome 🤩
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Integrated in #11800 |
Verify proptypes update in mui/material-ui#40617
Fix #11325
Fix #11679
I only spot a differences in the gird. I copy/past those diff in a dedicated file to clean the differences and check what are the different parameters. Here is the result: