Skip to content

Conversation

@brijeshb42
Copy link
Contributor

@brijeshb42 brijeshb42 commented Nov 21, 2025

This rule naively (currently) checks for all optional properties in interface and types and provides autofix to add | undefined wherever it doesn't exist.
One optimization is added where locally defined types are also checked for | undefined and if it already has undefined, its not added at places where the type is used.

See tests for scenarios. We can optimize the discovery further by allowing options to, for example, only affect optional properties of exported types/interface.

Integration PR in Base UI - mui/base-ui#3302

@brijeshb42 brijeshb42 requested a review from a team November 21, 2025 10:59
@brijeshb42 brijeshb42 added the scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). label Nov 21, 2025
@oliviertassinari oliviertassinari temporarily deployed to eslint-undef-plugin - mui-tools-public PR #909 November 21, 2025 10:59 — with Render Destroyed
@mui-bot
Copy link

mui-bot commented Nov 21, 2025

Bundle size report

Bundle Parsed size Gzip size
@base-ui-components/react 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 🔺+1.41KB(+0.32%) 🔺+297B(+0.22%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

This rule naively (currently) checks for all optional properties in
interface and types and provides autofix to add `| undefined` wherever
it doesn't exist.
One slight optimization is added where locally defined types are also
checked for `| undefined` and if it already has `undefined`, its not
added at places where the type is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: out-of-date The pull request has merge conflicts and can't be merged. scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants