You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[code-infra] Add lint rule requiring explanation on ts-expect-error #1524
scope: code-infraInvolves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd).type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
We should add a lint rule that makes an explanation mandatory on each // @ts-expect-error.
Motivation
A bare // @ts-expect-error suppresses a type error without recording why. Over time these become hard to audit: nobody knows whether the suppression is still needed, what it was working around, or whether removing it is safe. Requiring an explanation forces the author to document the reason and makes future cleanup tractable.
Proposal
Enable the @typescript-eslint/ban-ts-comment rule with a minimum description length for ts-expect-error (and ideally ts-ignore), e.g.:
changed the title [-]Add lint rule requiring an explanation on every `// @ts-expect-error`[/-][+][code-infra] Add lint rule requiring explanation on ts-expect-error[/+]on Jun 9, 2026
Suggestion: If we're not already, we could also reject // @ts-ignore in favor for // @ts-expect-error. Because // @ts-ignore doesn't break if the warning is fixed. We should only use it in very specific cases (e.g. to suppress a warning that only happens in one of two different typescript versions we test)
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
scope: code-infraInvolves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd).type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
Activity
brijeshb42 commentedon Jun 9, 2026
Context / prior discussion: mui/material-ui#48616 (review)
[-]Add lint rule requiring an explanation on every `// @ts-expect-error`[/-][+][code-infra] Add lint rule requiring explanation on ts-expect-error[/+]Janpot commentedon Jun 9, 2026
Suggestion: If we're not already, we could also reject
// @ts-ignorein favor for// @ts-expect-error. Because// @ts-ignoredoesn't break if the warning is fixed. We should only use it in very specific cases (e.g. to suppress a warning that only happens in one of two different typescript versions we test)github-actions commentedon Oct 8, 2026
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.