[infra] Enable mui/no-floating-cleanup ESLint rule#22789
Open
romgrk wants to merge 1 commit into
Open
Conversation
5ebf6fc to
5e0bb61
Compare
Contributor
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
5e0bb61 to
5129c50
Compare
Enables the new type-aware `mui/no-floating-cleanup` rule (added in mui-public#1538) across `packages/*/src`. It flags discarded unsubscribe/cleanup return values, like no-floating-promises but for functions. TEMPORARY: overrides `@mui/internal-code-infra` to a local mui-public checkout (sibling `../mui-public`, on the PR branch) so the rule can be tested before it is released. Revert once a code-infra release with the rule is published. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5129c50 to
f47ed2b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables the new type-aware
mui/no-floating-cleanupESLint rule acrosspackages/*/src. The rule (added to code-infra in mui/mui-public#1538) is modeled on@typescript-eslint/no-floating-promises, but for functions: it flags call statements whose return value is a discarded callable (e.g. anunsubscribe/ cleanup callback) — a common source of subscription leaks.Also flags discards behind unary/logical/conditional wrappers (
!subscribe(),a && subscribe(),cond ? subscribe() : x); fluent/builder calls that returnthis(e.g. d3 scale chaining, incl. inferredthis) are not reported.The rule isn't released yet, so this branch overrides
@mui/internal-code-infrato a local mui-public checkout (the rule's PR):This requires mui-public checked out as a sibling
../mui-publicon the mui-public#1538 branch, so CI can't install it as-is. Before merge: drop the override and bump@mui/internal-code-infrato a published release containing the rule. Theeslint.config.mjsblock is the only permanent change.Leaks found
Running the rule surfaces genuine discarded-cleanup leaks, e.g.
MoreEventsPopover.tsx:73(asubscribeCloseHandler(...)in auseEffectwhose unsubscribe is dropped instead of returned as cleanup), plus storesubscribe()/ plugin-register sites across Data Grid, Scheduler, Tree View, and Chat. The rule is set toerror, so the lint job reports these until they're fixed (or it's set towarn) — that surfacing is the point of this PR.🤖 Generated with Claude Code