Skip to content

[code-infra] Backport flat build setup to v8.x#22536

Merged
brijeshb42 merged 10 commits into
mui:v8.xfrom
brijeshb42:backport/flat-build
Jun 1, 2026
Merged

[code-infra] Backport flat build setup to v8.x#22536
brijeshb42 merged 10 commits into
mui:v8.xfrom
brijeshb42:backport/flat-build

Conversation

@brijeshb42

@brijeshb42 brijeshb42 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport of #21029 (Setup flat build for packages) onto v8.x.

Commits included:

  • [code-infra] Setup flat build for packages ([code-infra] Setup flat build for packages #21029)
  • Bump D3 (Bump D3 #21072) — needed because the new x-charts-vendor uses real d3-shape types
  • [code-infra] Bump @mui/internal-code-infra and fix backport setup
  • [code-infra] Migrate eslint rules to mui/ prefix and fix violations

Notes

  • All 20 @mui/x-* packages build flat (pnpm release:build passes).
  • Conflicts during cherry-pick resolved by deleting PR-modified files for packages not present on v8.x (x-data-grid-headless*, x-scheduler-headless-premium, x-scheduler-premium); accepted the PR's full x-charts-vendor rewrite.
  • mui/consistent-production-guard rule disabled.

🤖 Generated with Claude Code

@mui-bot

mui-bot commented May 20, 2026

Copy link
Copy Markdown

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

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 🔺+201B(+0.06%) 🔺+69B(+0.06%)
@mui/x-charts-pro 🔺+201B(+0.04%) 🔺+77B(+0.05%)
@mui/x-charts-premium 🔺+201B(+0.04%) 🔺+52B(+0.04%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 8f4c1e3

@brijeshb42 brijeshb42 added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). labels May 20, 2026
brijeshb42 and others added 4 commits May 20, 2026 21:16
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Bernardo Belchior <[email protected]>
- Bump @mui/internal-code-infra 0.0.3-canary.70 -> 0.0.4-canary.28 to get
  --flat flag support without pulling in eslint rules introduced in
  canary.29+ that flag pre-existing v8.x patterns.
- Pin @types/react to 19.2.7 via resolutions + pnpm.overrides so transitive
  @base-ui/react ^1.x doesn't pull a newer 19.2.14 (was causing duplicate
  React type packages and tsc destructor type errors).
- Fix @mui/x-codemod bin path for flat build.
- Rename material-ui/* eslint rules to mui/* (plugin renamed in code-infra
  canary.94+). Affects straight-quotes, disallow-react-api-in-server-components,
  mui-name-matches-component-name.
- Pin eslint-plugin-react-hooks to 7.0.1 and eslint-plugin-compat to 6.0.2 via
  resolutions + pnpm.overrides so transitive bumps don't activate new rules
  (set-state-in-effect, Highlight API checks) absent on plain v8.x.
- Current code-infra at canary.94 (PR base). Build passes for all 20 packages.
- Eslint still failing with ~124 errors from rules introduced between
  canary.70 -> canary.94 (disallow-active-element-as-key-event-target,
  consistent-production-guard, flatten-parentheses) that flag pre-existing
  v8.x patterns. Plain v8.x had 6 errors.
@brijeshb42
brijeshb42 force-pushed the backport/flat-build branch 3 times, most recently from 57f492a to 4e437ae Compare May 20, 2026 16:18
brijeshb42 and others added 2 commits May 20, 2026 21:51
- Rename material-ui/* rule references to mui/* in eslint-disable
  comments across packages, docs and tests
- Disable mui/consistent-production-guard (was 15 errors)
- Auto-fix mui/flatten-parentheses

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…rrides

Removed pinned resolutions and pnpm.overrides for the three packages.
After dropping them:

- @types/react and eslint-plugin-react-hooks resolve to the same versions
  (catalog already pins @types/[email protected]; [email protected] is what
  internal-code-infra pulls in).
- eslint-plugin-compat resolves to 6.2.1 (was pinned at 6.0.2). 6.2.1
  added detection for the CSS Highlight API which produces false
  positives on local variables named `highlight`. Scope the rule off
  for `*Highlight*.selectors.ts` in charts packages.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@brijeshb42
brijeshb42 force-pushed the backport/flat-build branch from 4e437ae to d26807c Compare May 20, 2026 16:21
function selectorChartsHighlightedItem(highlight, keyboardItem) {
return highlight.isControlled || highlight.lastUpdate === 'pointer'
? highlight.item
function selectorChartsHighlightedItem(selectorHighlight, keyboardItem) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

variable name, highlight, was mis-understood as the CSS highlight API by eslint compat plugin.

brijeshb42 and others added 2 commits May 20, 2026 22:07
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Reset pnpm-lock.yaml to upstream/v8.x and reinstall. Limits the
lockfile churn to what the canary.94 code-infra bump actually
requires (mainly babel 7.28 -> 7.29 transitives), and keeps
@mui/material at 7.3.7 + playwright at 1.57.0 (same as v8.x).

Without this reset, the loose catalog specs (^7.3.5, ^1.57.0) let
pnpm bump these on fresh install:
- @mui/material 7.3.11 shifts type resolution so
  typescript-to-proptypes expands the polymorphic `component` prop
  into a 180-line oneOfType form, breaking 'pnpm proptypes' (CI
  validate step).
- playwright 1.60.0 mismatches the v1.57.0-noble Docker image used by
  CircleCI.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@brijeshb42
brijeshb42 force-pushed the backport/flat-build branch from d26807c to 114d08c Compare May 20, 2026 16:40
The api-docs-builder emits a "[Slots API](#slots)" link in the props
table whenever a component declares a `slots` prop, but `SlotsSection`
renders nothing when no actual slot entries are exposed - leaving 17
pages with a dangling anchor (charts: bar-chart-premium, charts-axis,
charts-tooltip-container, charts-x-axis, charts-y-axis, funnel-plot,
heatmap, heatmap-plot, heatmap-tooltip, sankey-tooltip; pickers:
date-field, time-field, date-time-field, pickers-range-calendar-header,
single-input-date-range-field, single-input-date-time-range-field,
single-input-time-range-field).

Use the broken-links-checker ignore rules (new in code-infra
canary.94) to suppress these specific anchors so docs build passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@brijeshb42
brijeshb42 force-pushed the backport/flat-build branch from 30a6a09 to d4eae75 Compare May 21, 2026 09:25
@brijeshb42
brijeshb42 requested a review from a team May 21, 2026 09:37
@brijeshb42

Copy link
Copy Markdown
Contributor Author

@Janpot Could you review this

@@ -116,6 +116,8 @@
},
"exports": {
".": "./src/index.ts",
"./icons": "./src/icons/index.tsx",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are these needed?

@brijeshb42 brijeshb42 May 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These were added in master to be used in docs. So I have tried to sync the bare-minmum changes from there.

Edit: its actually used in v8 docs as well.

@Janpot Janpot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks right to me, but maybe @mui/charts could have a look as well?

@brijeshb42
brijeshb42 requested review from a team May 29, 2026 14:00
@@ -16,7 +16,7 @@ export class Transition {

private readonly easingFn: (t: number) => number;

private timer: Timer | null = null;
private transitionTimer: Timer | null = null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume this is also due to an ESlint false positive issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes

@alexfauquette

Copy link
Copy Markdown
Member

This solution is breaking the codesandbox demos. If you open a docs demo from the PR deployed docs the codesandbox will complain with errors like

Cannot find module '@mui/x-charts-vendor/d3-array' from '/node_modules/@mui/x-charts-pro/SankeyChart/d3Sankey/sankey.mjs'

This does not occures on the production branch

@brijeshb42

Copy link
Copy Markdown
Contributor Author

@alexfauquette This is temporary till a new v8 version is published. This was also the case when this change was introduced in v9. The sandbox is looking for a stable version of x-charts-vendor (v8.26.0) but the structure of the stable version is different than the existing structure of v8 which results in the error. Once merged and new v8 published, this wont be an issue.

Bisected as the highest version with no new eslint/proptype regressions
vs canary.94. canary.29+ adds a no-restricted-syntax rule against inline
`xmlns` on `<svg>` (~25 hits in docs+components); canary.33+ adds
`mui/no-guarded-throw` (~51 hits).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@brijeshb42
brijeshb42 force-pushed the backport/flat-build branch from d6b9bd2 to 8f4c1e3 Compare June 1, 2026 08:52
@brijeshb42
brijeshb42 merged commit 0951763 into mui:v8.x Jun 1, 2026
19 checks passed
@brijeshb42
brijeshb42 deleted the backport/flat-build branch June 2, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants