[code-infra] Backport flat build setup to v8.x#22536
Conversation
|
Deploy preview: https://deploy-preview-22536--material-ui-x.netlify.app/ Bundle size report
|
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.
57f492a to
4e437ae
Compare
- 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]>
4e437ae to
d26807c
Compare
| function selectorChartsHighlightedItem(highlight, keyboardItem) { | ||
| return highlight.isControlled || highlight.lastUpdate === 'pointer' | ||
| ? highlight.item | ||
| function selectorChartsHighlightedItem(selectorHighlight, keyboardItem) { |
There was a problem hiding this comment.
variable name, highlight, was mis-understood as the CSS highlight API by eslint compat plugin.
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]>
d26807c to
114d08c
Compare
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]>
30a6a09 to
d4eae75
Compare
|
@Janpot Could you review this |
| @@ -116,6 +116,8 @@ | |||
| }, | |||
| "exports": { | |||
| ".": "./src/index.ts", | |||
| "./icons": "./src/icons/index.tsx", | |||
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Looks right to me, but maybe @mui/charts could have a look as well?
| @@ -16,7 +16,7 @@ export class Transition { | |||
|
|
|||
| private readonly easingFn: (t: number) => number; | |||
|
|
|||
| private timer: Timer | null = null; | |||
| private transitionTimer: Timer | null = null; | |||
There was a problem hiding this comment.
I assume this is also due to an ESlint false positive issue
|
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
This does not occures on the production branch |
|
@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]>
d6b9bd2 to
8f4c1e3
Compare
Summary
Backport of #21029 (Setup flat build for packages) onto
v8.x.Commits included:
x-charts-vendoruses reald3-shapetypes@mui/internal-code-infraand fix backport setupmui/prefix and fix violationsNotes
@mui/x-*packages build flat (pnpm release:buildpasses).x-data-grid-headless*,x-scheduler-headless-premium,x-scheduler-premium); accepted the PR's fullx-charts-vendorrewrite.mui/consistent-production-guardrule disabled.🤖 Generated with Claude Code