[code-infra] Fix lint issues#22757
Conversation
brijeshb42
commented
Jun 11, 2026
- I have followed (at least) the PR section of the contributing guide.
Deploy previewBundle size
PerformanceTotal duration: 1,738.15 ms -308.89 ms(-15.1%) | Renders: 63 (▼-4)
…and 9 more (+12 within noise) — details Check out the code infra dashboard for more information about this PR. |
| }, | ||
| rules: { | ||
| '@typescript-eslint/no-redeclare': 'error', | ||
| '@typescript-eslint/no-shadow': 'off', |
There was a problem hiding this comment.
typescript-eslint >=8.60 flags the named function expression in the common const Foo = React.forwardRef(function Foo() {}) idiom as shadowing its own const binding. So disabled it. The implication is that it disables genuine shadowing issues.
There was a problem hiding this comment.
Should we look into this at the code infra level? I guess all repos will hit this?
There was a problem hiding this comment.
Yes. We can disable it at code-infra level, but it should be temporary. Otherwise, it'll not surface genuine issues.
There was a problem hiding this comment.
I'll move this to code-infra parallelly though since I need this PR to merge my other i18n related PR.
| { | ||
| files: [`**/*${EXTENSION_TEST_FILE}`, `test/**/*${EXTENSION_TS}`], | ||
| rules: { | ||
| 'react-hooks/set-state-in-effect': 'off', |
There was a problem hiding this comment.
v7.1.1 has this on by default resulting in lint error.
be1ba9e to
9d46a61
Compare
2837b0b to
5f0b1ed
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
5f0b1ed to
521cd3f
Compare
|
@Janpot Need to merge this till we fix it in code-infra as it might block newer PRs. Same on mui/material-ui#48672 |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
521cd3f to
7e1aa3d
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
ce7422d to
0400e31
Compare
LukasTy
left a comment
There was a problem hiding this comment.
Claude Opus 4.8 Review
Which disables can be dropped
-
Both
useIsHydratedcopies (packages/x-charts/src/hooks/useIsHydrated.ts,packages/x-chat-headless/src/chat/internals/useIsHydrated.ts) -- avoidable now, low risk. The rule fires only on passiveuseEffect. Two options:- Lowest friction (no new dep): swap
React.useEffect->useEnhancedEffect. It is already a dep in both packages, isuseLayoutEffecton the client / SSR-safe, is not flagged by the rule, and it matches the gaearon gist the file comment already cites ("Option 2: useLayoutEffect"). Bonus: removes the one-frame unhydrated flash. - More idiomatic: mirror the existing precedent.
packages/x-data-grid/src/hooks/utils/useIsSSR.ts:7already does exactly this withuseSyncExternalStore(viause-sync-external-store/shim, React-17-safe), no effect at all --useIsHydratedis just its inverse (clientSnapshot = () => true,serverSnapshot = () => false). This needs adding the shim dep to those two packages, so theuseEnhancedEffectswap is the lighter touch.
- Lowest friction (no new dep): swap
-
@typescript-eslint/no-shadow: 'off'(eslint.config.mjs, global) -- reconsider. This turns off a real correctness rule across the entire monorepo to unblock a version bump -- the heaviest hammer in the PR. If it is masking a small number of new violations from the parser bump (8.59 -> 8.60), prefer fixing them or scoping the off to the offending files; at minimum add a comment/TODO explaining why.
Leave as-is (legitimate, not worth churning in a bump)
useMounteddefer branch -- intentional post-paint passive effect; the non-defer branch already usesuseEnhancedEffectand is not flagged.- The 5 charts-premium
setProgram(...)effects -- the effect owns the GL program lifecycle (cleanup callsdispose()); setState there is appropriate. useGridSelector(exhaustive-deps+ newuse-memodisable) -- hand-optimized hot path passing a module-levelEMPTYdeps array on purpose; fine.set-state-in-effect: 'off'for test files -- fine. For docs -- acceptable (demos), though docs ideally model best practice.
Out of scope here -- track as a follow-up
The ~15 remaining sites all share one shape: a useEffect that mirrors/adjusts a prop into local state (GridEditBooleanCell, GridEdit{Input,LongText,Date}Cell, the GridFilterInput* family, Month/YearCalendar, GridColumnHeaderItem, the GridActionsCell clamp, Toolbar, ToolbarContext, tree-view itemPlugin). The React-blessed fix is set-state-during-render with a stored previous prop -- the same pattern useGridSelector already uses at packages/x-data-grid/src/hooks/utils/useGridSelector.ts:83, which the linter accepts. Each has behavioral nuance (StrictMode double-invoke, meta guards), so they should not be refactored inside a dependency bump. Worth a tracked tech-debt issue.
a3c742a to
8203c2a
Compare
0ff2323 to
c470845
Compare
c470845 to
da27754
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
da27754 to
361331e
Compare
361331e to
7d7fd84
Compare
c9e49d2 to
14e7d9f
Compare
