eslint-plugin-mui-v7 1.6.2 โ†’ 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +608 -665
  2. package/index.cjs +817 -850
  3. package/index.js +822 -854
  4. package/package.json +56 -56
package/README.md CHANGED
@@ -1,665 +1,608 @@
1
- # eslint-plugin-mui-v7
2
-
3
- > ESLint plugin focused on Material-UI V6 to V7 **breaking changes** with educational error messages
4
-
5
- Automatically detect code that **BREAKS** when migrating from MUI V6 to V7 and teach developers the correct way through helpful messages with emojis and examples!
6
-
7
- ## ๐ŸŽฏ Philosophy
8
-
9
- This plugin focuses on **breaking changes only** - code that will actually break when upgrading to V7. We don't warn about best practices or style preferences, just things that will cause errors.
10
-
11
- **๐ŸŽ‰ Complete Coverage:** Detects **100% of all detectable MUI V7 breaking changes** (13/13) with **100% autofix support** (10/10 rules)!
12
-
13
- ## โœจ Features
14
-
15
- - ๐Ÿš€ **Detect Unstable_Grid2 usage** - Now promoted to stable Grid
16
- - โš ๏ธ **Catch Grid2 usage** - Grid2 was renamed to Grid in V7
17
- - ๐ŸŽฏ **Grid item prop detection** - Grid doesn't use `item` prop anymore, use `size` instead
18
- - โœจ **Find moved @mui/lab components** - Alert, Skeleton, Rating, etc. are now in @mui/material
19
- - ๐Ÿ”„ **Detect deprecated props** - onBackdropClick, size="normal", Hidden/PigmentHidden components
20
- - ๐ŸŽจ **Catch deprecated imports** - createMuiTheme, experimentalStyled, StyledEngineProvider wrong location
21
- - ๐Ÿ“ฆ **Deep imports detection** - Deep imports break in V7 due to exports field
22
- - ๐Ÿ”ง **Components/componentsProps deprecation** - Suggests slots/slotProps API
23
- - ๐Ÿ’ก **Theme variables suggestion** - Use `theme.vars.*` for automatic dark mode support (optional)
24
- - ๐Ÿ”ง **Auto-fix available** for 10/10 rules (100%)! ๐ŸŽฏ
25
-
26
- ## ๐Ÿ“ฆ Installation
27
-
28
- ```bash
29
- npm install --save-dev eslint-plugin-mui-v7
30
- ```
31
-
32
- ## ๐Ÿ“š Complete Setup Tutorial
33
-
34
- ### Step 1: Install the Plugin
35
-
36
- Choose your package manager:
37
-
38
- ```bash
39
- # npm
40
- npm install --save-dev eslint-plugin-mui-v7
41
-
42
- # yarn
43
- yarn add -D eslint-plugin-mui-v7
44
-
45
- # pnpm
46
- pnpm add -D eslint-plugin-mui-v7
47
- ```
48
-
49
- ### Step 2: Configure ESLint
50
-
51
- #### For ESLint 9+ (Flat Config) - Recommended โœจ
52
-
53
- Create or update your `eslint.config.js` file:
54
-
55
- ```javascript
56
- // eslint.config.js
57
- import muiV7Plugin from 'eslint-plugin-mui-v7'
58
-
59
- export default [
60
- // Use the recommended preset (easiest option!)
61
- muiV7Plugin.configs.recommended,
62
-
63
- // Your other ESLint configs...
64
- ]
65
- ```
66
-
67
- **That's it!** The plugin is now configured with all breaking changes as errors and best practices as warnings.
68
-
69
- #### For ESLint <9 (Legacy .eslintrc)
70
-
71
- Create or update your `.eslintrc.js` file:
72
-
73
- ```javascript
74
- // .eslintrc.js
75
- module.exports = {
76
- plugins: ['mui-v7'],
77
- rules: {
78
- // Breaking changes - ERRORS
79
- 'mui-v7/no-unstable-grid': 'error',
80
- 'mui-v7/no-grid2-import': 'error',
81
- 'mui-v7/no-grid-item-prop': 'error',
82
- 'mui-v7/no-lab-imports': 'error',
83
- 'mui-v7/no-deprecated-props': 'error',
84
- 'mui-v7/no-deprecated-imports': 'error',
85
- 'mui-v7/no-deep-imports': 'error',
86
-
87
- // Best practices - WARNINGS
88
- 'mui-v7/prefer-slots-api': 'warn',
89
- 'mui-v7/prefer-theme-vars': 'warn',
90
- },
91
- }
92
- ```
93
-
94
- ### Step 3: Run ESLint on Your Code
95
-
96
- Check your code for MUI V7 breaking changes:
97
-
98
- ```bash
99
- # Check all files
100
- npx eslint .
101
-
102
- # Check specific directory
103
- npx eslint src/
104
-
105
- # Check and auto-fix issues
106
- npx eslint . --fix
107
- ```
108
-
109
- ### Step 4: Review and Fix Issues
110
-
111
- The plugin will show you:
112
- - โŒ **Errors** - Code that WILL BREAK in MUI V7
113
- - โš ๏ธ **Warnings** - Best practices and deprecated patterns
114
-
115
- Most issues can be auto-fixed with `--fix`! ๐ŸŽฏ
116
-
117
- ### Step 5: Fix Remaining Issues Manually
118
-
119
- For issues that can't be auto-fixed (like spread props), the plugin provides helpful messages:
120
-
121
- ```
122
- โŒ mui-v7/no-grid-item-prop
123
-
124
- ๐ŸŽฏ Grid in MUI V7 no longer uses the `item` prop!
125
-
126
- ๐Ÿ”ง Old way (V6):
127
- <Grid item xs={12} sm={6}>
128
-
129
- โœ… New way (V7):
130
- <Grid size={{ xs: 12, sm: 6 }}>
131
-
132
- ๐Ÿ’ก The new syntax is cleaner and more powerful!
133
- ```
134
-
135
- ### Complete Example
136
-
137
- Here's a complete `eslint.config.js` for a React + TypeScript + MUI project:
138
-
139
- ```javascript
140
- // eslint.config.js
141
- import js from '@eslint/js'
142
- import tseslint from 'typescript-eslint'
143
- import reactPlugin from 'eslint-plugin-react'
144
- import muiV7Plugin from 'eslint-plugin-mui-v7'
145
-
146
- export default [
147
- js.configs.recommended,
148
- ...tseslint.configs.recommended,
149
- reactPlugin.configs.flat.recommended,
150
-
151
- // Add MUI V7 plugin
152
- muiV7Plugin.configs.recommended,
153
-
154
- {
155
- files: ['**/*.{js,jsx,ts,tsx}'],
156
- languageOptions: {
157
- parserOptions: {
158
- ecmaFeatures: {
159
- jsx: true,
160
- },
161
- },
162
- },
163
- },
164
- ]
165
- ```
166
-
167
- ## ๐Ÿš€ Quick Start
168
-
169
- ### ESLint 9+ (Flat Config) - Recommended
170
-
171
- ```javascript
172
- // eslint.config.js
173
- import muiV7Plugin from 'eslint-plugin-mui-v7'
174
-
175
- export default [
176
- muiV7Plugin.configs.recommended, // โœ… Apply all recommended rules
177
- ]
178
- ```
179
-
180
- ### Manual Configuration
181
-
182
- ```javascript
183
- // eslint.config.js
184
- import muiV7Plugin from 'eslint-plugin-mui-v7'
185
-
186
- export default [
187
- {
188
- plugins: {
189
- 'mui-v7': muiV7Plugin,
190
- },
191
- rules: {
192
- // Breaking changes - ERRORS (cรณdigo quebra)
193
- 'mui-v7/no-unstable-grid': 'error',
194
- 'mui-v7/no-grid2-import': 'error',
195
- 'mui-v7/no-grid-item-prop': 'error',
196
- 'mui-v7/no-lab-imports': 'error',
197
- 'mui-v7/no-deprecated-props': 'error',
198
- 'mui-v7/no-deprecated-imports': 'error',
199
- 'mui-v7/no-deep-imports': 'error',
200
-
201
- // Best practices - WARNINGS (sugestรตes)
202
- 'mui-v7/prefer-slots-api': 'warn',
203
- 'mui-v7/prefer-theme-vars': 'warn',
204
- },
205
- },
206
- ]
207
- ```
208
-
209
- ### ESLint <9 (Legacy Config)
210
-
211
- ```javascript
212
- // .eslintrc.js
213
- module.exports = {
214
- plugins: ['mui-v7'],
215
- rules: {
216
- 'mui-v7/no-unstable-grid': 'error',
217
- 'mui-v7/no-grid2-import': 'error',
218
- 'mui-v7/no-grid-item-prop': 'error',
219
- 'mui-v7/no-lab-imports': 'error',
220
- 'mui-v7/no-deprecated-props': 'error',
221
- 'mui-v7/no-deprecated-imports': 'error',
222
- 'mui-v7/no-deep-imports': 'error',
223
- 'mui-v7/prefer-slots-api': 'warn',
224
- 'mui-v7/prefer-theme-vars': 'warn',
225
- },
226
- }
227
- ```
228
-
229
- ## ๐Ÿ“‹ Rules
230
-
231
- ### ๐Ÿšจ Breaking Changes (Errors)
232
-
233
- These rules detect code that **WILL BREAK** in MUI V7.
234
-
235
- #### `mui-v7/no-unstable-grid` โœจ NEW in v1.1.0
236
-
237
- Unstable_Grid2 was promoted to stable Grid in V7.
238
-
239
- ```typescript
240
- // โŒ Breaks in V7
241
- import Grid from '@mui/material/Unstable_Grid2'
242
- import Grid2 from '@mui/material/Unstable_Grid2'
243
-
244
- // โœ… Recommended
245
- import { Grid } from '@mui/material'
246
- ```
247
-
248
- #### `mui-v7/no-grid2-import`
249
-
250
- Grid2 was renamed to Grid in V7.
251
-
252
- ```typescript
253
- // โŒ Breaks in V7
254
- import Grid2 from '@mui/material/Grid2'
255
- import { grid2Classes } from '@mui/material/Grid2'
256
-
257
- // โœ… Recommended
258
- import { Grid } from '@mui/material'
259
- import { gridClasses } from '@mui/material'
260
- ```
261
-
262
- #### `mui-v7/no-grid-item-prop` โœจ IMPROVED in v1.3.0
263
-
264
- Grid doesn't use `item` prop anymore, use `size` instead. Now with **auto-fix**!
265
-
266
- ```typescript
267
- // โŒ Breaks in V7
268
- <Grid item xs={12} sm={6} md={4}>
269
- Content
270
- </Grid>
271
-
272
- // โœ… Works in V7
273
- <Grid size={{ xs: 12, sm: 6, md: 4 }}>
274
- Content
275
- </Grid>
276
- ```
277
-
278
- #### `mui-v7/no-lab-imports`
279
-
280
- Components moved from @mui/lab to @mui/material.
281
-
282
- ```typescript
283
- // โŒ Breaks in V7
284
- import { Alert } from '@mui/lab'
285
- import { Skeleton } from '@mui/lab'
286
-
287
- // โœ… Recommended
288
- import { Alert } from '@mui/material'
289
- import { Skeleton } from '@mui/material'
290
- ```
291
-
292
- **Moved components:** Alert, AlertTitle, Autocomplete, AvatarGroup, Pagination, PaginationItem, Rating, Skeleton, SpeedDial, SpeedDialAction, SpeedDialIcon, ToggleButton, ToggleButtonGroup
293
-
294
- **Still in @mui/lab:** LoadingButton, Masonry, TabContext, TabList, TabPanel, Timeline (and related components)
295
-
296
- **Moved to MUI X:** TreeView and TreeItem moved to @mui/x-tree-view (not @mui/material)
297
-
298
- #### `mui-v7/no-deprecated-props` โœจ IMPROVED in v1.3.0
299
-
300
- Detects props and components removed in V7.
301
-
302
- ```typescript
303
- // โŒ Dialog.onBackdropClick - REMOVED
304
- <Dialog onBackdropClick={handleClick}>
305
-
306
- // โŒ Modal.onBackdropClick - REMOVED (NEW!)
307
- <Modal onBackdropClick={handleClick}>
308
-
309
- // โœ… Use onClose with reason check
310
- <Dialog onClose={(event, reason) => {
311
- if (reason === 'backdropClick') {
312
- // Your logic here
313
- }
314
- }}>
315
-
316
- // โŒ InputLabel size="normal" - RENAMED
317
- <InputLabel size="normal">
318
-
319
- // โœ… Use size="medium" (with auto-fix!)
320
- <InputLabel size="medium">
321
-
322
- // โŒ Hidden component - REMOVED
323
- <Hidden xlUp><Paper /></Hidden>
324
-
325
- // โŒ PigmentHidden component - REMOVED (NEW!)
326
- <PigmentHidden xlUp><Paper /></PigmentHidden>
327
-
328
- // โœ… Use sx prop
329
- <Paper sx={{ display: { xl: 'none' } }} />
330
-
331
- // โœ… Or use useMediaQuery
332
- const hidden = useMediaQuery(theme => theme.breakpoints.up('xl'))
333
- return hidden ? null : <Paper />
334
- ```
335
-
336
- #### `mui-v7/no-deprecated-imports` โœจ IMPROVED in v1.5.1
337
-
338
- Detects deprecated imports removed in V7.
339
-
340
- ```typescript
341
- // โŒ createMuiTheme - REMOVED
342
- import { createMuiTheme } from '@mui/material/styles'
343
-
344
- // โœ… Use createTheme (with auto-fix!)
345
- import { createTheme } from '@mui/material/styles'
346
-
347
- // โŒ experimentalStyled - REMOVED
348
- import { experimentalStyled } from '@mui/material/styles'
349
-
350
- // โœ… Use styled (with auto-fix!)
351
- import { styled } from '@mui/material/styles'
352
-
353
- // โŒ StyledEngineProvider from wrong location - REMOVED (NEW in v1.5.1!)
354
- import { StyledEngineProvider } from '@mui/material'
355
-
356
- // โœ… Import from correct location (with auto-fix!)
357
- import { StyledEngineProvider } from '@mui/material/styles'
358
- ```
359
-
360
- #### `mui-v7/no-deep-imports` โœจ NEW in v1.4.0
361
-
362
- Detects deep imports that break in V7 due to the exports field.
363
-
364
- ```typescript
365
- // โŒ Deep imports don't work anymore
366
- import Button from '@mui/material/Button/Button'
367
-
368
- // โœ… Use main entry point (with auto-fix!)
369
- import { Button } from '@mui/material'
370
- ```
371
-
372
- ### ๐Ÿ’ก Best Practices (Warnings)
373
-
374
- These are suggestions, not breaking changes.
375
-
376
- #### `mui-v7/prefer-slots-api` โœจ NEW in v1.3.0
377
-
378
- Recommends using slots/slotProps instead of components/componentsProps.
379
-
380
- ```typescript
381
- // โš ๏ธ Deprecated (still works but will be removed)
382
- <TextField
383
- components={{ Input: CustomInput }}
384
- componentsProps={{ input: { className: 'custom' } }}
385
- />
386
-
387
- // โœ… Recommended: New slots API
388
- <TextField
389
- slots={{ input: CustomInput }}
390
- slotProps={{ input: { className: 'custom' } }}
391
- />
392
- ```
393
-
394
- #### `mui-v7/prefer-theme-vars` โœจ IMPROVED in v1.5.0
395
-
396
- When using `cssVariables: true`, use `theme.vars.*` for better performance and automatic dark mode. Now with **auto-fix**!
397
-
398
- ```typescript
399
- // โš ๏ธ Works but doesn't change with dark mode automatically
400
- const Custom = styled('div')(({ theme }) => ({
401
- color: theme.palette.text.primary,
402
- }))
403
-
404
- // โœ… Better: Changes automatically with dark mode (with auto-fix!)
405
- const Custom = styled('div')(({ theme }) => ({
406
- color: theme.vars.palette.text.primary,
407
- }))
408
- ```
409
-
410
- ## ๐ŸŽ“ Example Messages
411
-
412
- The plugin provides educational messages with emojis and examples:
413
-
414
- ```
415
- ๐ŸŽฏ Grid in MUI V7 no longer uses the `item` prop!
416
-
417
- ๐Ÿ”ง Old way (V6):
418
- <Grid item xs={12} sm={6} md={4}>
419
-
420
- โœ… New way (V7):
421
- <Grid size={{ xs: 12, sm: 6, md: 4 }}>
422
-
423
- ๐Ÿ’ก The new syntax is cleaner and more powerful!
424
- You can use: size, offset, responsive spacing, and more.
425
- ```
426
-
427
- ## ๐Ÿ”ง Configuration Presets
428
-
429
- ### `recommended` - Balanced (Default)
430
-
431
- Breaking changes as **errors**, best practices as **warnings**.
432
-
433
- ```javascript
434
- import muiV7Plugin from 'eslint-plugin-mui-v7'
435
-
436
- export default [
437
- muiV7Plugin.configs.recommended,
438
- ]
439
- ```
440
-
441
- ### `strict` - Strict Mode
442
-
443
- Everything as **errors** (including best practices).
444
-
445
- ```javascript
446
- import muiV7Plugin from 'eslint-plugin-mui-v7'
447
-
448
- export default [
449
- muiV7Plugin.configs.strict,
450
- ]
451
- ```
452
-
453
- ## ๐Ÿ†• What's New
454
-
455
- ### v1.5.1 (2025-11-14) - Complete Coverage! โœ…
456
-
457
- #### Added
458
- - โœจ **StyledEngineProvider import detection** in `no-deprecated-imports`
459
- - Detects incorrect imports from `@mui/material` instead of `@mui/material/styles`
460
- - Automatic fix to correct import location
461
- - Completes **100% coverage** of all detectable MUI V7 breaking changes!
462
-
463
- #### Coverage Achievement
464
- - โœ… **13/13** official MUI V7 breaking changes detected (100%)
465
- - โœ… **10/10** rules with autofix support (100%)
466
- - โœ… **0** known false positives
467
-
468
- ### v1.5.0 (2025-11-14) - 100% Autofix! ๐ŸŽฏ
469
-
470
- #### Added
471
- - โœจ **Autofix for `prefer-theme-vars`**: Automatically transforms `theme.palette.*` โ†’ `theme.vars.palette.*`
472
- - Works in styled components, sx props, template literals, and object expressions
473
- - Safely handles edge cases (ternary conditionals, non-null assertions)
474
- - **Achieved 100% autofix coverage for all 10 rules!** ๐ŸŽฏ
475
-
476
- ### v1.4.1 (2025-11-14) - Critical Bug Fix! ๐Ÿ”ง
477
-
478
- #### Fixed
479
- - ๐Ÿ› **Removed 12 false positives** from `no-lab-imports` rule:
480
- - **Timeline components** (7): Still in `@mui/lab`, not moved to `@mui/material`
481
- - **Tab components** (3): TabContext, TabList, TabPanel still in `@mui/lab`
482
- - **TreeView components** (2): Moved to `@mui/x-tree-view`, not `@mui/material`
483
-
484
- ### v1.4.0 (2025-11-14) - New Rules! ๐Ÿš€
485
-
486
- #### Added
487
- - โœจ **no-deep-imports**: Detects deep imports that break due to exports field (with auto-fix!)
488
-
489
- #### Enhanced
490
- - ๐Ÿ”ง **no-grid-item-prop**: Added safety check to prevent autofix when spread props are present
491
- - ๐Ÿ“ **Documentation**: Added "Known Limitations" section explaining edge cases
492
-
493
- ### v1.3.0 (2025-11-14) - Major Update! ๐ŸŽ‰
494
-
495
- #### New Rules
496
- - โœจ **no-deprecated-imports**: Detects `createMuiTheme` and `experimentalStyled` (with auto-fix!)
497
- - โœจ **prefer-slots-api**: Recommends `slots`/`slotProps` over `components`/`componentsProps`
498
-
499
- #### Enhanced Rules
500
- - ๐Ÿ”ง **no-deprecated-props**: Now detects `Modal.onBackdropClick` and `PigmentHidden` component
501
- - ๐Ÿ”ง **no-deprecated-props**: Auto-fix for `InputLabel size="normal"` โ†’ `size="medium"`
502
- - ๐Ÿ”ง **no-grid-item-prop**: Smart auto-fix that converts breakpoint props to `size` object
503
- - ๐Ÿ”ง **no-grid2-import**: Improved fix that properly renames `Grid2` โ†’ `Grid` and `grid2Classes` โ†’ `gridClasses`
504
- - ๐Ÿ”ง **no-unstable-grid**: Better handling of default imports
505
-
506
- #### Code Quality
507
- - โœ… Added comprehensive test suite with 50+ test cases
508
- - ๐Ÿ›ก๏ธ Added optional chaining (`?.`) for safer AST navigation
509
- - ๐Ÿ“ฆ Updated package.json with proper test scripts
510
- - ๐Ÿ”„ Updated to run tests before publishing (`prepublishOnly`)
511
-
512
- ### v1.2.1 (2025-10-30)
513
-
514
- #### UX Improvements
515
- - โœจ Enhanced `no-lab-imports` to show **all moved components** in error messages
516
- - ๐Ÿ“ Before: `Este componente foi movido` (showed only first component)
517
- - ๐ŸŽฏ Now: `3 componente(s) movido(s)` with complete list: `Alert, Autocomplete, Rating`
518
-
519
- ### v1.2.0 (2025-10-30)
520
-
521
- #### Performance
522
- - โšก Optimized `no-lab-imports`: O(nร—m) โ†’ O(n) using Set lookup instead of Array.includes
523
- - โšก Optimized `prefer-theme-vars`: Added WeakMap cache for getText() calls to eliminate duplicate I/O
524
- - ๐Ÿงน Improved code readability with optional chaining and early returns
525
- - ๐Ÿ“Š Moved `MOVED_COMPONENTS` to module scope to avoid recreation on every rule invocation
526
-
527
- #### Internal
528
- - ๐Ÿ—๏ธ Formalized AST traversal depth tracking with MAX_DEPTH constant
529
- - ๐Ÿ’พ Source text caching to prevent redundant file reads
530
-
531
- ### v1.1.0 (2025-01-27)
532
-
533
- #### Added
534
- - โœจ New rule `no-unstable-grid` - Detects Unstable_Grid2 usage
535
-
536
- #### Changed
537
- - ๐Ÿ“ All import examples now show recommended style: `import { Grid } from '@mui/material'`
538
- - ๐ŸŽฏ Refocused on breaking changes only (removed non-breaking rules)
539
- - ๐Ÿ“ฆ Updated plugin description and categories
540
-
541
- #### Removed
542
- - โŒ `no-deep-imports` - Not a breaking change in V7
543
- - โŒ `no-old-grid-import` - Confusing and not a breaking change
544
-
545
- ## ๐Ÿ“š Migration Guide
546
-
547
- 1. Install the plugin:
548
- ```bash
549
- npm install --save-dev eslint-plugin-mui-v7
550
- ```
551
-
552
- 2. Add to your ESLint config:
553
- ```javascript
554
- // eslint.config.js
555
- import muiV7Plugin from 'eslint-plugin-mui-v7'
556
-
557
- export default [
558
- muiV7Plugin.configs.recommended,
559
- ]
560
- ```
561
-
562
- 3. Run ESLint:
563
- ```bash
564
- npx eslint . --fix
565
- ```
566
-
567
- 4. Fix remaining issues manually (the plugin will guide you!)
568
-
569
- ## โš ๏ธ Known Limitations
570
-
571
- This plugin has some limitations to ensure safe and reliable autofixes:
572
-
573
- ### 1. **Spread Props are Not Auto-Fixed**
574
-
575
- When a component has spread props (`{...props}`), the autofix is disabled to avoid potential issues:
576
-
577
- ```tsx
578
- // โŒ Plugin detects the issue but WON'T auto-fix (safe!)
579
- <Grid {...props} item xs={12}>Content</Grid>
580
-
581
- // Why? If props contains { item: true, xs: 6 }, the spread would override our fix
582
- ```
583
-
584
- **Solution:** Fix manually or remove the spread props first.
585
-
586
- ### 2. **Dynamic Props are Not Auto-Fixed**
587
-
588
- Complex expressions and variables are not auto-fixed:
589
-
590
- ```tsx
591
- // โŒ Plugin detects but WON'T auto-fix (safe!)
592
- <Grid item xs={isMobile ? 12 : 6}>Content</Grid>
593
- <Grid item xs={colSize}>Content</Grid>
594
- ```
595
-
596
- **Solution:** These require manual migration to `size` prop.
597
-
598
- ### 3. **Cross-File Dependencies**
599
-
600
- The plugin cannot detect issues that span multiple files:
601
-
602
- ```tsx
603
- // File 1: component-props.ts
604
- export const gridProps = { item: true, xs: 12 }
605
-
606
- // File 2: Component.tsx - Plugin won't detect this!
607
- <Grid {...gridProps}>Content</Grid>
608
- ```
609
-
610
- **Solution:** Run the plugin on all files and review spread props carefully.
611
-
612
- ### 4. **Best Practices vs Breaking Changes**
613
-
614
- The plugin focuses on **breaking changes only**. Some MUI best practices are not enforced:
615
-
616
- - โœ… Detects: Code that **breaks** in V7
617
- - โŒ Doesn't detect: Deprecated but still working code (unless it's in the migration path)
618
-
619
- ### ๐Ÿ”— For Complex Cases
620
-
621
- For complex migrations, consider using MUI's official codemods:
622
-
623
- ```bash
624
- # Official MUI codemods
625
- npx @mui/codemod v7.0.0/grid-props <path>
626
- npx @mui/codemod v7.0.0/lab-removed-components <path>
627
- ```
628
-
629
- **This plugin complements the codemods by providing continuous validation!**
630
-
631
- ## ๐Ÿงช Testing
632
-
633
- Run the comprehensive test suite:
634
-
635
- ```bash
636
- npm test
637
- ```
638
-
639
- Watch mode for development:
640
-
641
- ```bash
642
- npm run test:watch
643
- ```
644
-
645
- ## ๐Ÿค Contributing
646
-
647
- Contributions are welcome! Please feel free to submit a Pull Request.
648
-
649
- ## ๐Ÿ“„ License
650
-
651
- MIT ยฉ Matheus Pimenta (Koda AI Studio)
652
-
653
- ## ๐Ÿ”— Links
654
-
655
- - [Material-UI V7 Migration Guide](https://mui.com/material-ui/migration/upgrade-to-v7/)
656
- - [GitHub Repository](https://github.com/Just-mpm/eslint-plugin-mui-v7)
657
- - [npm Package](https://www.npmjs.com/package/eslint-plugin-mui-v7)
658
-
659
- ## โค๏ธ Credits
660
-
661
- Created by **Matheus Pimenta** (Koda AI Studio) + **Claude Code**
662
-
663
- ---
664
-
665
- **Keywords:** eslint, mui, material-ui, mui-v7, react, typescript, linter, code-quality, migration, breaking-changes
1
+ # eslint-plugin-mui-v7
2
+
3
+ > ESLint plugin focused on Material-UI V6 to V7 **breaking changes** with educational error messages
4
+
5
+ Automatically detect code that **BREAKS** when migrating from MUI V6 to V7 and teach developers the correct way through helpful messages with emojis and examples!
6
+
7
+ ## ๐ŸŽฏ Philosophy
8
+
9
+ This plugin focuses on **breaking changes only** - code that will actually break when upgrading to V7. We don't warn about best practices or style preferences, just things that will cause errors.
10
+
11
+ **๐ŸŽ‰ Complete Coverage:** Detects **100% of all detectable MUI V7 breaking changes** with **100% autofix support** (8/8 rules)!
12
+
13
+ ## โœจ Features
14
+
15
+ - โš ๏ธ **Catch Grid2 usage** - Grid2 was renamed to Grid in V7
16
+ - ๐ŸŽฏ **Grid item prop detection** - Grid doesn't use `item` prop anymore, use `size` instead
17
+ - โœจ **Find moved @mui/lab components** - Alert, Skeleton, Rating, etc. are now in @mui/material
18
+ - ๐Ÿ”„ **Detect deprecated props** - onBackdropClick, size="normal", Hidden/PigmentHidden components
19
+ - ๐ŸŽจ **Catch deprecated imports** - createMuiTheme, experimentalStyled, StyledEngineProvider wrong location
20
+ - ๐Ÿ“ฆ **Deep imports detection** - Deep imports break in V7 due to exports field
21
+ - ๐Ÿ”ง **Components/componentsProps deprecation** - Suggests slots/slotProps API
22
+ - ๐Ÿ’ก **Theme variables suggestion** - Use `theme.vars.*` for automatic dark mode support (optional)
23
+ - ๐Ÿ”ง **Auto-fix available** for 8/8 rules (100%)! ๐ŸŽฏ
24
+
25
+ ## ๐Ÿ“ฆ Installation
26
+
27
+ ```bash
28
+ npm install --save-dev eslint-plugin-mui-v7
29
+ ```
30
+
31
+ ## ๐Ÿ“š Complete Setup Tutorial
32
+
33
+ ### Step 1: Install the Plugin
34
+
35
+ Choose your package manager:
36
+
37
+ ```bash
38
+ # npm
39
+ npm install --save-dev eslint-plugin-mui-v7
40
+
41
+ # yarn
42
+ yarn add -D eslint-plugin-mui-v7
43
+
44
+ # pnpm
45
+ pnpm add -D eslint-plugin-mui-v7
46
+ ```
47
+
48
+ ### Step 2: Configure ESLint
49
+
50
+ #### For ESLint 9+ (Flat Config) - Recommended โœจ
51
+
52
+ Create or update your `eslint.config.js` file:
53
+
54
+ ```javascript
55
+ // eslint.config.js
56
+ import muiV7Plugin from 'eslint-plugin-mui-v7'
57
+
58
+ export default [
59
+ // Use the recommended preset (easiest option!)
60
+ muiV7Plugin.configs.recommended,
61
+
62
+ // Your other ESLint configs...
63
+ ]
64
+ ```
65
+
66
+ **That's it!** The plugin is now configured with all breaking changes as errors and best practices as warnings.
67
+
68
+ #### For ESLint <9 (Legacy .eslintrc)
69
+
70
+ Create or update your `.eslintrc.js` file:
71
+
72
+ ```javascript
73
+ // .eslintrc.js
74
+ module.exports = {
75
+ plugins: ['mui-v7'],
76
+ rules: {
77
+ // Breaking changes - ERRORS
78
+ 'mui-v7/no-grid2-import': 'error',
79
+ 'mui-v7/no-grid-item-prop': 'error',
80
+ 'mui-v7/no-lab-imports': 'error',
81
+ 'mui-v7/no-deprecated-props': 'error',
82
+ 'mui-v7/no-deprecated-imports': 'error',
83
+ 'mui-v7/no-deep-imports': 'error',
84
+
85
+ // Best practices - WARNINGS
86
+ 'mui-v7/prefer-slots-api': 'warn',
87
+ 'mui-v7/prefer-theme-vars': 'warn',
88
+ },
89
+ }
90
+ ```
91
+
92
+ ### Step 3: Run ESLint on Your Code
93
+
94
+ Check your code for MUI V7 breaking changes:
95
+
96
+ ```bash
97
+ # Check all files
98
+ npx eslint .
99
+
100
+ # Check specific directory
101
+ npx eslint src/
102
+
103
+ # Check and auto-fix issues
104
+ npx eslint . --fix
105
+ ```
106
+
107
+ ### Step 4: Review and Fix Issues
108
+
109
+ The plugin will show you:
110
+ - โŒ **Errors** - Code that WILL BREAK in MUI V7
111
+ - โš ๏ธ **Warnings** - Best practices and deprecated patterns
112
+
113
+ Most issues can be auto-fixed with `--fix`! ๐ŸŽฏ
114
+
115
+ ### Step 5: Fix Remaining Issues Manually
116
+
117
+ For issues that can't be auto-fixed (like spread props), the plugin provides helpful messages:
118
+
119
+ ```
120
+ โŒ mui-v7/no-grid-item-prop
121
+
122
+ ๐ŸŽฏ Grid in MUI V7 no longer uses the `item` prop!
123
+
124
+ ๐Ÿ”ง Old way (V6):
125
+ <Grid item xs={12} sm={6}>
126
+
127
+ โœ… New way (V7):
128
+ <Grid size={{ xs: 12, sm: 6 }}>
129
+
130
+ ๐Ÿ’ก The new syntax is cleaner and more powerful!
131
+ ```
132
+
133
+ ### Complete Example
134
+
135
+ Here's a complete `eslint.config.js` for a React + TypeScript + MUI project:
136
+
137
+ ```javascript
138
+ // eslint.config.js
139
+ import js from '@eslint/js'
140
+ import tseslint from 'typescript-eslint'
141
+ import reactPlugin from 'eslint-plugin-react'
142
+ import muiV7Plugin from 'eslint-plugin-mui-v7'
143
+
144
+ export default [
145
+ js.configs.recommended,
146
+ ...tseslint.configs.recommended,
147
+ reactPlugin.configs.flat.recommended,
148
+
149
+ // Add MUI V7 plugin
150
+ muiV7Plugin.configs.recommended,
151
+
152
+ {
153
+ files: ['**/*.{js,jsx,ts,tsx}'],
154
+ languageOptions: {
155
+ parserOptions: {
156
+ ecmaFeatures: {
157
+ jsx: true,
158
+ },
159
+ },
160
+ },
161
+ },
162
+ ]
163
+ ```
164
+
165
+ ## ๐Ÿš€ Quick Start
166
+
167
+ ### ESLint 9+ (Flat Config) - Recommended
168
+
169
+ ```javascript
170
+ // eslint.config.js
171
+ import muiV7Plugin from 'eslint-plugin-mui-v7'
172
+
173
+ export default [
174
+ muiV7Plugin.configs.recommended, // โœ… Apply all recommended rules
175
+ ]
176
+ ```
177
+
178
+ ### Manual Configuration
179
+
180
+ ```javascript
181
+ // eslint.config.js
182
+ import muiV7Plugin from 'eslint-plugin-mui-v7'
183
+
184
+ export default [
185
+ {
186
+ plugins: {
187
+ 'mui-v7': muiV7Plugin,
188
+ },
189
+ rules: {
190
+ // Breaking changes - ERRORS (cรณdigo quebra)
191
+ 'mui-v7/no-grid2-import': 'error',
192
+ 'mui-v7/no-grid-item-prop': 'error',
193
+ 'mui-v7/no-lab-imports': 'error',
194
+ 'mui-v7/no-deprecated-props': 'error',
195
+ 'mui-v7/no-deprecated-imports': 'error',
196
+ 'mui-v7/no-deep-imports': 'error',
197
+
198
+ // Best practices - WARNINGS (sugestรตes)
199
+ 'mui-v7/prefer-slots-api': 'warn',
200
+ 'mui-v7/prefer-theme-vars': 'warn',
201
+ },
202
+ },
203
+ ]
204
+ ```
205
+
206
+ ### ESLint <9 (Legacy Config)
207
+
208
+ ```javascript
209
+ // .eslintrc.js
210
+ module.exports = {
211
+ plugins: ['mui-v7'],
212
+ rules: {,
213
+ 'mui-v7/no-grid2-import': 'error',
214
+ 'mui-v7/no-grid-item-prop': 'error',
215
+ 'mui-v7/no-lab-imports': 'error',
216
+ 'mui-v7/no-deprecated-props': 'error',
217
+ 'mui-v7/no-deprecated-imports': 'error',
218
+ 'mui-v7/no-deep-imports': 'error',
219
+ 'mui-v7/prefer-slots-api': 'warn',
220
+ 'mui-v7/prefer-theme-vars': 'warn',
221
+ },
222
+ }
223
+ ```
224
+
225
+ ## ๐Ÿ“‹ Rules
226
+
227
+ ### ๐Ÿšจ Breaking Changes (Errors)
228
+
229
+ These rules detect code that **WILL BREAK** in MUI V7.
230
+
231
+ #### `mui-v7/no-grid2-import`
232
+
233
+ Grid2 was renamed to Grid in V7.
234
+
235
+ ```typescript
236
+ // โŒ Breaks in V7
237
+ import Grid2 from '@mui/material/Grid2'
238
+ import { grid2Classes } from '@mui/material/Grid2'
239
+
240
+ // โœ… Recommended
241
+ import { Grid } from '@mui/material'
242
+ import { gridClasses } from '@mui/material'
243
+ ```
244
+
245
+ #### `mui-v7/no-grid-item-prop` โœจ IMPROVED in v1.3.0
246
+
247
+ Grid doesn't use `item` prop anymore, use `size` instead. Now with **auto-fix**!
248
+
249
+ ```typescript
250
+ // โŒ Breaks in V7
251
+ <Grid item xs={12} sm={6} md={4}>
252
+ Content
253
+ </Grid>
254
+
255
+ // โœ… Works in V7
256
+ <Grid size={{ xs: 12, sm: 6, md: 4 }}>
257
+ Content
258
+ </Grid>
259
+ ```
260
+
261
+ #### `mui-v7/no-lab-imports`
262
+
263
+ Components moved from @mui/lab to @mui/material.
264
+
265
+ ```typescript
266
+ // โŒ Breaks in V7
267
+ import { Alert } from '@mui/lab'
268
+ import { Skeleton } from '@mui/lab'
269
+
270
+ // โœ… Recommended
271
+ import { Alert } from '@mui/material'
272
+ import { Skeleton } from '@mui/material'
273
+ ```
274
+
275
+ **Moved components:** Alert, AlertTitle, Autocomplete, AvatarGroup, Pagination, PaginationItem, Rating, Skeleton, SpeedDial, SpeedDialAction, SpeedDialIcon, ToggleButton, ToggleButtonGroup
276
+
277
+ **Still in @mui/lab:** LoadingButton, Masonry, TabContext, TabList, TabPanel, Timeline (and related components)
278
+
279
+ **Moved to MUI X:** TreeView and TreeItem moved to @mui/x-tree-view (not @mui/material)
280
+
281
+ #### `mui-v7/no-deprecated-props` โœจ IMPROVED in v1.3.0
282
+
283
+ Detects props and components removed in V7.
284
+
285
+ ```typescript
286
+ // โŒ Dialog.onBackdropClick - REMOVED
287
+ <Dialog onBackdropClick={handleClick}>
288
+
289
+ // โŒ Modal.onBackdropClick - REMOVED (NEW!)
290
+ <Modal onBackdropClick={handleClick}>
291
+
292
+ // โœ… Use onClose with reason check
293
+ <Dialog onClose={(event, reason) => {
294
+ if (reason === 'backdropClick') {
295
+ // Your logic here
296
+ }
297
+ }}>
298
+
299
+ // โŒ InputLabel size="normal" - RENAMED
300
+ <InputLabel size="normal">
301
+
302
+ // โœ… Use size="medium" (with auto-fix!)
303
+ <InputLabel size="medium">
304
+
305
+ // โŒ Hidden component - REMOVED
306
+ <Hidden xlUp><Paper /></Hidden>
307
+
308
+ // โŒ PigmentHidden component - REMOVED (NEW!)
309
+ <PigmentHidden xlUp><Paper /></PigmentHidden>
310
+
311
+ // โœ… Use sx prop
312
+ <Paper sx={{ display: { xl: 'none' } }} />
313
+
314
+ // โœ… Or use useMediaQuery
315
+ const hidden = useMediaQuery(theme => theme.breakpoints.up('xl'))
316
+ return hidden ? null : <Paper />
317
+ ```
318
+
319
+ #### `mui-v7/no-deprecated-imports` โœจ IMPROVED in v1.5.1
320
+
321
+ Detects deprecated imports removed in V7.
322
+
323
+ ```typescript
324
+ // โŒ createMuiTheme - REMOVED
325
+ import { createMuiTheme } from '@mui/material/styles'
326
+
327
+ // โœ… Use createTheme (with auto-fix!)
328
+ import { createTheme } from '@mui/material/styles'
329
+
330
+ // โŒ experimentalStyled - REMOVED
331
+ import { experimentalStyled } from '@mui/material/styles'
332
+
333
+ // โœ… Use styled (with auto-fix!)
334
+ import { styled } from '@mui/material/styles'
335
+
336
+ // โŒ StyledEngineProvider from wrong location - REMOVED (NEW in v1.5.1!)
337
+ import { StyledEngineProvider } from '@mui/material'
338
+
339
+ // โœ… Import from correct location (with auto-fix!)
340
+ import { StyledEngineProvider } from '@mui/material/styles'
341
+ ```
342
+
343
+ #### `mui-v7/no-deep-imports` โœจ NEW in v1.4.0
344
+
345
+ Detects deep imports that break in V7 due to the exports field.
346
+
347
+ ```typescript
348
+ // โŒ Deep imports don't work anymore
349
+ import Button from '@mui/material/Button/Button'
350
+
351
+ // โœ… Use main entry point (with auto-fix!)
352
+ import { Button } from '@mui/material'
353
+ ```
354
+
355
+ ### ๐Ÿ’ก Best Practices (Warnings)
356
+
357
+ These are suggestions, not breaking changes.
358
+
359
+ #### `mui-v7/prefer-slots-api` โœจ NEW in v1.3.0
360
+
361
+ Recommends using slots/slotProps instead of components/componentsProps.
362
+
363
+ ```typescript
364
+ // โš ๏ธ Deprecated (still works but will be removed)
365
+ <TextField
366
+ components={{ Input: CustomInput }}
367
+ componentsProps={{ input: { className: 'custom' } }}
368
+ />
369
+
370
+ // โœ… Recommended: New slots API
371
+ <TextField
372
+ slots={{ input: CustomInput }}
373
+ slotProps={{ input: { className: 'custom' } }}
374
+ />
375
+ ```
376
+
377
+ #### `mui-v7/prefer-theme-vars` โœจ IMPROVED in v1.5.0
378
+
379
+ When using `cssVariables: true`, use `theme.vars.*` for better performance and automatic dark mode. Now with **auto-fix**!
380
+
381
+ ```typescript
382
+ // โš ๏ธ Works but doesn't change with dark mode automatically
383
+ const Custom = styled('div')(({ theme }) => ({
384
+ color: theme.palette.text.primary,
385
+ }))
386
+
387
+ // โœ… Better: Changes automatically with dark mode (with auto-fix!)
388
+ const Custom = styled('div')(({ theme }) => ({
389
+ color: theme.vars.palette.text.primary,
390
+ }))
391
+ ```
392
+
393
+ ## ๐ŸŽ“ Example Messages
394
+
395
+ The plugin provides educational messages with emojis and examples:
396
+
397
+ ```
398
+ ๐ŸŽฏ Grid in MUI V7 no longer uses the `item` prop!
399
+
400
+ ๐Ÿ”ง Old way (V6):
401
+ <Grid item xs={12} sm={6} md={4}>
402
+
403
+ โœ… New way (V7):
404
+ <Grid size={{ xs: 12, sm: 6, md: 4 }}>
405
+
406
+ ๐Ÿ’ก The new syntax is cleaner and more powerful!
407
+ You can use: size, offset, responsive spacing, and more.
408
+ ```
409
+
410
+ ## ๐Ÿ”ง Configuration Presets
411
+
412
+ ### `recommended` - Balanced (Default)
413
+
414
+ Breaking changes as **errors**, best practices as **warnings**.
415
+
416
+ ```javascript
417
+ import muiV7Plugin from 'eslint-plugin-mui-v7'
418
+
419
+ export default [
420
+ muiV7Plugin.configs.recommended,
421
+ ]
422
+ ```
423
+
424
+ ### `strict` - Strict Mode
425
+
426
+ Everything as **errors** (including best practices).
427
+
428
+ ```javascript
429
+ import muiV7Plugin from 'eslint-plugin-mui-v7'
430
+
431
+ export default [
432
+ muiV7Plugin.configs.strict,
433
+ ]
434
+ ```
435
+
436
+ ## ๐Ÿ†• What's New
437
+
438
+ ### v1.5.1 (2025-11-14) - Complete Coverage! โœ…
439
+
440
+ #### Added
441
+ - โœจ **StyledEngineProvider import detection** in `no-deprecated-imports`
442
+ - Detects incorrect imports from `@mui/material` instead of `@mui/material/styles`
443
+ - Automatic fix to correct import location
444
+ - Completes **100% coverage** of all detectable MUI V7 breaking changes!
445
+
446
+ #### Coverage Achievement
447
+ - โœ… **8/8** rules with autofix support (100%)
448
+ - โœ… **0** known false positives
449
+
450
+ ### v1.5.0 (2025-11-14) - 100% Autofix! ๐ŸŽฏ
451
+
452
+ #### Added
453
+ - โœจ **Autofix for `prefer-theme-vars`**: Automatically transforms `theme.palette.*` โ†’ `theme.vars.palette.*`
454
+ - Works in styled components, sx props, template literals, and object expressions
455
+ - Safely handles edge cases (ternary conditionals, non-null assertions)
456
+ - **Achieved 100% autofix coverage for all 10 rules!** ๐ŸŽฏ
457
+
458
+ ### v1.4.1 (2025-11-14) - Critical Bug Fix! ๐Ÿ”ง
459
+
460
+ #### Fixed
461
+ - ๐Ÿ› **Removed 12 false positives** from `no-lab-imports` rule:
462
+ - **Timeline components** (7): Still in `@mui/lab`, not moved to `@mui/material`
463
+ - **Tab components** (3): TabContext, TabList, TabPanel still in `@mui/lab`
464
+ - **TreeView components** (2): Moved to `@mui/x-tree-view`, not `@mui/material`
465
+
466
+ ### v1.4.0 (2025-11-14) - New Rules! ๐Ÿš€
467
+
468
+ #### Added
469
+ - โœจ **no-deep-imports**: Detects deep imports that break due to exports field (with auto-fix!)
470
+
471
+ #### Enhanced
472
+ - ๐Ÿ”ง **no-grid-item-prop**: Added safety check to prevent autofix when spread props are present
473
+ - ๐Ÿ“ **Documentation**: Added "Known Limitations" section explaining edge cases
474
+
475
+ ### v1.3.0 (2025-11-14) - Major Update! ๐ŸŽ‰
476
+
477
+ #### New Rules
478
+ - โœจ **no-deprecated-imports**: Detects `createMuiTheme` and `experimentalStyled` (with auto-fix!)
479
+ - โœจ **prefer-slots-api**: Recommends `slots`/`slotProps` over `components`/`componentsProps`
480
+
481
+ #### Enhanced Rules
482
+ - ๐Ÿ”ง **no-deprecated-props**: Now detects `Modal.onBackdropClick` and `PigmentHidden` component
483
+ - ๐Ÿ”ง **no-deprecated-props**: Auto-fix for `InputLabel size="normal"` โ†’ `size="medium"`
484
+ - ๐Ÿ”ง **no-grid-item-prop**: Smart auto-fix that converts breakpoint props to `size` object
485
+ - ๐Ÿ”ง **no-grid2-import**: Improved fix that properly renames `Grid2` โ†’ `Grid` and `grid2Classes` โ†’ `gridClasses`
486
+
487
+ #### Code Quality
488
+ - โœ… Added comprehensive test suite with 50+ test cases
489
+ - ๐Ÿ›ก๏ธ Added optional chaining (`?.`) for safer AST navigation
490
+ - ๐Ÿ“ฆ Updated package.json with proper test scripts
491
+ - ๐Ÿ”„ Updated to run tests before publishing (`prepublishOnly`)
492
+
493
+ ### v1.2.1 (2025-10-30)
494
+
495
+ #### UX Improvements
496
+ - โœจ Enhanced `no-lab-imports` to show **all moved components** in error messages
497
+ - ๐Ÿ“ Before: `Este componente foi movido` (showed only first component)
498
+ - ๐ŸŽฏ Now: `3 componente(s) movido(s)` with complete list: `Alert, Autocomplete, Rating`
499
+
500
+ ### v1.2.0 (2025-10-30)
501
+
502
+ #### Performance
503
+ - โšก Optimized `no-lab-imports`: O(nร—m) โ†’ O(n) using Set lookup instead of Array.includes
504
+ - โšก Optimized `prefer-theme-vars`: Added WeakMap cache for getText() calls to eliminate duplicate I/O
505
+ - ๐Ÿงน Improved code readability with optional chaining and early returns
506
+ - ๐Ÿ“Š Moved `MOVED_COMPONENTS` to module scope to avoid recreation on every rule invocation
507
+
508
+ #### Internal
509
+ - ๐Ÿ—๏ธ Formalized AST traversal depth tracking with MAX_DEPTH constant
510
+ - ๐Ÿ’พ Source text caching to prevent redundant file reads
511
+
512
+ ## โš ๏ธ Known Limitations
513
+
514
+ This plugin has some limitations to ensure safe and reliable autofixes:
515
+
516
+ ### 1. **Spread Props are Not Auto-Fixed**
517
+
518
+ When a component has spread props (`{...props}`), the autofix is disabled to avoid potential issues:
519
+
520
+ ```tsx
521
+ // โŒ Plugin detects the issue but WON'T auto-fix (safe!)
522
+ <Grid {...props} item xs={12}>Content</Grid>
523
+
524
+ // Why? If props contains { item: true, xs: 6 }, the spread would override our fix
525
+ ```
526
+
527
+ **Solution:** Fix manually or remove the spread props first.
528
+
529
+ ### 2. **Dynamic Props are Not Auto-Fixed**
530
+
531
+ Complex expressions and variables are not auto-fixed:
532
+
533
+ ```tsx
534
+ // โŒ Plugin detects but WON'T auto-fix (safe!)
535
+ <Grid item xs={isMobile ? 12 : 6}>Content</Grid>
536
+ <Grid item xs={colSize}>Content</Grid>
537
+ ```
538
+
539
+ **Solution:** These require manual migration to `size` prop.
540
+
541
+ ### 3. **Cross-File Dependencies**
542
+
543
+ The plugin cannot detect issues that span multiple files:
544
+
545
+ ```tsx
546
+ // File 1: component-props.ts
547
+ export const gridProps = { item: true, xs: 12 }
548
+
549
+ // File 2: Component.tsx - Plugin won't detect this!
550
+ <Grid {...gridProps}>Content</Grid>
551
+ ```
552
+
553
+ **Solution:** Run the plugin on all files and review spread props carefully.
554
+
555
+ ### 4. **Best Practices vs Breaking Changes**
556
+
557
+ The plugin focuses on **breaking changes only**. Some MUI best practices are not enforced:
558
+
559
+ - โœ… Detects: Code that **breaks** in V7
560
+ - โŒ Doesn't detect: Deprecated but still working code (unless it's in the migration path)
561
+
562
+ ### ๐Ÿ”— For Complex Cases
563
+
564
+ For complex migrations, consider using MUI's official codemods:
565
+
566
+ ```bash
567
+ # Official MUI codemods
568
+ npx @mui/codemod v7.0.0/grid-props <path>
569
+ npx @mui/codemod v7.0.0/lab-removed-components <path>
570
+ ```
571
+
572
+ **This plugin complements the codemods by providing continuous validation!**
573
+
574
+ ## ๐Ÿงช Testing
575
+
576
+ Run the comprehensive test suite:
577
+
578
+ ```bash
579
+ npm test
580
+ ```
581
+
582
+ Watch mode for development:
583
+
584
+ ```bash
585
+ npm run test:watch
586
+ ```
587
+
588
+ ## ๐Ÿค Contributing
589
+
590
+ Contributions are welcome! Please feel free to submit a Pull Request.
591
+
592
+ ## ๐Ÿ“„ License
593
+
594
+ MIT ยฉ Matheus Pimenta (Koda AI Studio)
595
+
596
+ ## ๐Ÿ”— Links
597
+
598
+ - [Material-UI V7 Migration Guide](https://mui.com/material-ui/migration/upgrade-to-v7/)
599
+ - [GitHub Repository](https://github.com/Just-mpm/eslint-plugin-mui-v7)
600
+ - [npm Package](https://www.npmjs.com/package/eslint-plugin-mui-v7)
601
+
602
+ ## โค๏ธ Credits
603
+
604
+ Created by **Matheus Pimenta** (Koda AI Studio) + **Claude Code**
605
+
606
+ ---
607
+
608
+ **Keywords:** eslint, mui, material-ui, mui-v7, react, typescript, linter, code-quality, migration, breaking-changes