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

[code-infra] Fix proptypes generation #11776

Closed
wants to merge 5 commits into from

Conversation

alexfauquette
Copy link
Member

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:

  • image one compare the first shape with the second one
  • image two compare the first shape with the third one

Screenshot from 2024-01-22 14-06-35
Screenshot from 2024-01-22 14-05-51

@alexfauquette alexfauquette added the core Infrastructure work going on behind the scenes label Jan 22, 2024
@@ -588,128 +588,394 @@ GridRow.propTypes = {
onMouseLeave: PropTypes.func,
pinnedColumns: PropTypes.shape({
Copy link
Member

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 🙈

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, absolutely 👍🏻

@mui-bot
Copy link

mui-bot commented Jan 22, 2024

Deploy preview: https://deploy-preview-11776--material-ui-x.netlify.app/

Updated pages:

Generated by 🚫 dangerJS against c9cc1a5

@alexfauquette alexfauquette changed the title [code-infra][WIP] Fix proptypes generation [code-infra] Fix proptypes generation Jan 22, 2024
@@ -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')) {
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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 😭

Copy link
Member Author

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?

Copy link
Member

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).

Copy link
Member Author

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;

Copy link
Member Author

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

Copy link
Member

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 🤩

@alexfauquette alexfauquette mentioned this pull request Jan 24, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 24, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@alexfauquette
Copy link
Member Author

Integrated in #11800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[charts] Pie chart tooltip runtime warning
4 participants