@mui/codemod 5.8.0 → 5.8.4
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.
- package/README.md +55 -55
- package/codemod.js +0 -0
- package/node/v5.0.0/jss-to-tss-react.js +8 -5
- package/node/v5.0.0/jss-to-tss-react.test/actual-from-mui-styles-makeStyles.js +53 -0
- package/node/v5.0.0/jss-to-tss-react.test/actual-todo-comments.js +8 -0
- package/node/v5.0.0/jss-to-tss-react.test/expected-from-mui-styles-makeStyles.js +57 -0
- package/node/v5.0.0/jss-to-tss-react.test/expected-todo-comments.js +11 -1
- package/node/v5.0.0/modal-props.js +1 -1
- package/node/v5.0.0/modal-props.test/expected.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -145,7 +145,7 @@ Imports and inserts `adaptV4Theme` into `createTheme` (or `createMuiTheme`)
|
|
|
145
145
|
npx @mui/codemod v5.0.0/adapter-v4 <path>
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
148
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#theme).
|
|
149
149
|
|
|
150
150
|
#### `autocomplete-rename-closeicon`
|
|
151
151
|
|
|
@@ -162,7 +162,7 @@ Renames `Autocomplete`'s `closeIcon` prop to `clearIcon`.
|
|
|
162
162
|
npx @mui/codemod v5.0.0/autocomplete-rename-closeicon <path>
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
165
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#autocomplete).
|
|
166
166
|
|
|
167
167
|
#### `autocomplete-rename-option`
|
|
168
168
|
|
|
@@ -181,7 +181,7 @@ Renames `Autocomplete`'s `getOptionSelected` to `isOptionEqualToValue`.
|
|
|
181
181
|
npx @mui/codemod v5.0.0/autocomplete-rename-option <path>
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
184
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#autocomplete).
|
|
185
185
|
|
|
186
186
|
#### `avatar-circle-circular`
|
|
187
187
|
|
|
@@ -200,7 +200,7 @@ Updates the `Avatar`'s `variant` value and `classes` key from 'circle' to 'circu
|
|
|
200
200
|
npx @mui/codemod v5.0.0/avatar-circle-circular <path>
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
203
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#avatar).
|
|
204
204
|
|
|
205
205
|
#### `badge-overlap-value`
|
|
206
206
|
|
|
@@ -235,7 +235,7 @@ Renames the badge's props.
|
|
|
235
235
|
npx @mui/codemod v5.0.0/badge-overlap-value <path>
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
238
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#badge).
|
|
239
239
|
|
|
240
240
|
#### `box-borderradius-values`
|
|
241
241
|
|
|
@@ -254,7 +254,7 @@ Updates the Box API from separate system props to `sx`.
|
|
|
254
254
|
npx @mui/codemod v5.0.0/box-borderradius-values <path>
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
257
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#box).
|
|
258
258
|
|
|
259
259
|
#### `box-rename-css`
|
|
260
260
|
|
|
@@ -269,7 +269,7 @@ Renames the Box `css` prop to `sx`
|
|
|
269
269
|
npx @mui/codemod v5.0.0/box-rename-css <path>
|
|
270
270
|
```
|
|
271
271
|
|
|
272
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
272
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#box).
|
|
273
273
|
|
|
274
274
|
#### `box-rename-gap`
|
|
275
275
|
|
|
@@ -290,7 +290,7 @@ Renames the Box `grid*Gap` props.
|
|
|
290
290
|
npx @mui/codemod v5.0.0/box-rename-gap <path>
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
293
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#box).
|
|
294
294
|
|
|
295
295
|
#### `button-color-prop`
|
|
296
296
|
|
|
@@ -307,7 +307,7 @@ Removes the outdated `color` prop values.
|
|
|
307
307
|
npx @mui/codemod v5.0.0/button-color-prop <path>
|
|
308
308
|
```
|
|
309
309
|
|
|
310
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
310
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#button).
|
|
311
311
|
|
|
312
312
|
#### `chip-variant-prop`
|
|
313
313
|
|
|
@@ -324,7 +324,7 @@ Removes the Chip `variant` prop if the value is `"default"`.
|
|
|
324
324
|
npx @mui/codemod v5.0.0/chip-variant-prop <path>
|
|
325
325
|
```
|
|
326
326
|
|
|
327
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
327
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#chip).
|
|
328
328
|
|
|
329
329
|
#### `circularprogress-variant`
|
|
330
330
|
|
|
@@ -341,7 +341,7 @@ Renames the CircularProgress `static` variant to `determinate`.
|
|
|
341
341
|
npx @mui/codemod v5.0.0/circularprogress-variant <path>
|
|
342
342
|
```
|
|
343
343
|
|
|
344
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
344
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#circularprogress).
|
|
345
345
|
|
|
346
346
|
#### `collapse-rename-collapsedheight`
|
|
347
347
|
|
|
@@ -360,7 +360,7 @@ Renames `Collapse`'s `collapsedHeight` prop to `collapsedSize`.
|
|
|
360
360
|
npx @mui/codemod v5.0.0/collapse-rename-collapsedheight <path>
|
|
361
361
|
```
|
|
362
362
|
|
|
363
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
363
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#collapse).
|
|
364
364
|
|
|
365
365
|
#### `component-rename-prop`
|
|
366
366
|
|
|
@@ -418,7 +418,7 @@ Remove `disableBackdropClick` prop from `<Dialog>`
|
|
|
418
418
|
npx @mui/codemod v5.0.0/dialog-props <path>
|
|
419
419
|
```
|
|
420
420
|
|
|
421
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
421
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#dialog).
|
|
422
422
|
|
|
423
423
|
#### `dialog-title-props`
|
|
424
424
|
|
|
@@ -433,11 +433,11 @@ Remove `disableTypography` prop from `<DialogTitle>`
|
|
|
433
433
|
npx @mui/codemod v5.0.0/dialog-title-props <path>
|
|
434
434
|
```
|
|
435
435
|
|
|
436
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
436
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#dialog).
|
|
437
437
|
|
|
438
438
|
#### `emotion-prepend-cache`
|
|
439
439
|
|
|
440
|
-
Adds `prepend: true` to
|
|
440
|
+
Adds `prepend: true` to Emotion `createCache`
|
|
441
441
|
|
|
442
442
|
```diff
|
|
443
443
|
const cache = emotionCreateCache({
|
|
@@ -458,7 +458,7 @@ Renames `ExpansionPanel*` to `Accordion*`
|
|
|
458
458
|
npx @mui/codemod v5.0.0/expansion-panel-component <path>
|
|
459
459
|
```
|
|
460
460
|
|
|
461
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
461
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#expansionpanel).
|
|
462
462
|
|
|
463
463
|
#### `fab-variant`
|
|
464
464
|
|
|
@@ -471,7 +471,7 @@ You can find more details about this breaking change in [the migration guide](ht
|
|
|
471
471
|
npx @mui/codemod v5.0.0/fab-variant <path>
|
|
472
472
|
```
|
|
473
473
|
|
|
474
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
474
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#fab).
|
|
475
475
|
|
|
476
476
|
#### `fade-rename-alpha`
|
|
477
477
|
|
|
@@ -491,7 +491,7 @@ Renames the `fade` style utility import and calls to `alpha`.
|
|
|
491
491
|
npx @mui/codemod v5.0.0/fade-rename-alpha <path>
|
|
492
492
|
```
|
|
493
493
|
|
|
494
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
494
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#styles).
|
|
495
495
|
|
|
496
496
|
#### `grid-justify-justifycontent`
|
|
497
497
|
|
|
@@ -508,7 +508,7 @@ Renames `Grid`'s `justify` prop to `justifyContent`.
|
|
|
508
508
|
npx @mui/codemod v5.0.0/grid-justify-justifycontent <path>
|
|
509
509
|
```
|
|
510
510
|
|
|
511
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
511
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#grid).
|
|
512
512
|
|
|
513
513
|
#### `grid-list-component`
|
|
514
514
|
|
|
@@ -518,7 +518,7 @@ Renames `GridList*` to `ImageList*`
|
|
|
518
518
|
npx @mui/codemod v5.0.0/grid-list-component <path>
|
|
519
519
|
```
|
|
520
520
|
|
|
521
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
521
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#gridlist).
|
|
522
522
|
|
|
523
523
|
#### `icon-button-size`
|
|
524
524
|
|
|
@@ -535,7 +535,7 @@ Adds `size="large"` if `size` is not defined to get the same appearance as v4.
|
|
|
535
535
|
npx @mui/codemod v5.0.0/icon-button-size <path>
|
|
536
536
|
```
|
|
537
537
|
|
|
538
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
538
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#iconbutton).
|
|
539
539
|
|
|
540
540
|
#### `jss-to-styled`
|
|
541
541
|
|
|
@@ -600,10 +600,10 @@ export const MyCard = () => {
|
|
|
600
600
|
npx @mui/codemod v5.0.0/jss-to-styled <path>
|
|
601
601
|
```
|
|
602
602
|
|
|
603
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
603
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#1-use-styled-or-sx-api).
|
|
604
604
|
|
|
605
605
|
> **Note:** This approach converts the first element in the return statement into styled component but also increases CSS specificity to override nested children.
|
|
606
|
-
> This codemod should be adopted after handling all breaking changes, [check out the migration documentation](https://mui.com/material-ui/
|
|
606
|
+
> This codemod should be adopted after handling all breaking changes, [check out the migration documentation](https://mui.com/material-ui/migration/migration-v4/).
|
|
607
607
|
|
|
608
608
|
#### `jss-to-tss-react`
|
|
609
609
|
|
|
@@ -685,7 +685,7 @@ The following scenarios are not currently handled by this codemod and will be ma
|
|
|
685
685
|
- If an arrow function at the rule level contains a code block (i.e. contains an explicit `return`
|
|
686
686
|
statement) rather than just an object expression, it will not be converted.
|
|
687
687
|
|
|
688
|
-
You can find more details about migrating from JSS to tss-react in [the migration guide](https://mui.com/
|
|
688
|
+
You can find more details about migrating from JSS to tss-react in [the migration guide](https://mui.com/migration/migrating-from-jss/#2-use-tss-react).
|
|
689
689
|
|
|
690
690
|
#### `link-underline-hover`
|
|
691
691
|
|
|
@@ -697,10 +697,10 @@ Apply `underline="hover"` to `<Link />` that does not define `underline` prop (t
|
|
|
697
697
|
```
|
|
698
698
|
|
|
699
699
|
```sh
|
|
700
|
-
npx @mui/codemod v5.0.0/
|
|
700
|
+
npx @mui/codemod v5.0.0/link-underline-hover <path>
|
|
701
701
|
```
|
|
702
702
|
|
|
703
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
703
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#link).
|
|
704
704
|
|
|
705
705
|
#### `material-ui-styles`
|
|
706
706
|
|
|
@@ -751,7 +751,7 @@ Renames `Omit` import from `@material-ui/types` to `DistributiveOmit`
|
|
|
751
751
|
npx @mui/codemod v5.0.0/material-ui-types <path>
|
|
752
752
|
```
|
|
753
753
|
|
|
754
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
754
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#material-ui-types).
|
|
755
755
|
|
|
756
756
|
#### `modal-props`
|
|
757
757
|
|
|
@@ -768,7 +768,7 @@ Removes `disableBackdropClick` and `onEscapeKeyDown` from `<Modal>`
|
|
|
768
768
|
npx @mui/codemod v5.0.0/modal-props <path>
|
|
769
769
|
```
|
|
770
770
|
|
|
771
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
771
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#modal).
|
|
772
772
|
|
|
773
773
|
#### `moved-lab-modules`
|
|
774
774
|
|
|
@@ -794,13 +794,13 @@ npx @mui/codemod v5.0.0/moved-lab-modules <path>
|
|
|
794
794
|
|
|
795
795
|
You can find more details about this breaking change in the migration guide.
|
|
796
796
|
|
|
797
|
-
- [Alert](https://mui.com/material-ui/
|
|
798
|
-
- [Autocomplete](https://mui.com/material-ui/
|
|
799
|
-
- [AvatarGroup](https://mui.com/material-ui/
|
|
800
|
-
- [Pagination](https://mui.com/material-ui/
|
|
801
|
-
- [Skeleton](https://mui.com/material-ui/
|
|
802
|
-
- [SpeedDial](https://mui.com/material-ui/
|
|
803
|
-
- [ToggleButton](https://mui.com/material-ui/
|
|
797
|
+
- [Alert](https://mui.com/material-ui/migration/v5-component-changes/#alert)
|
|
798
|
+
- [Autocomplete](https://mui.com/material-ui/migration/v5-component-changes/#autocomplete)
|
|
799
|
+
- [AvatarGroup](https://mui.com/material-ui/migration/v5-component-changes/#avatar)
|
|
800
|
+
- [Pagination](https://mui.com/material-ui/migration/v5-component-changes/#pagination)
|
|
801
|
+
- [Skeleton](https://mui.com/material-ui/migration/v5-component-changes/#skeleton)
|
|
802
|
+
- [SpeedDial](https://mui.com/material-ui/migration/v5-component-changes/#speeddial)
|
|
803
|
+
- [ToggleButton](https://mui.com/material-ui/migration/v5-component-changes/#togglebutton)
|
|
804
804
|
|
|
805
805
|
#### `pagination-round-circular`
|
|
806
806
|
|
|
@@ -817,7 +817,7 @@ Renames `Pagination*`'s `shape` values from 'round' to 'circular'.
|
|
|
817
817
|
npx @mui/codemod v5.0.0/pagination-round-circular <path>
|
|
818
818
|
```
|
|
819
819
|
|
|
820
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
820
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#pagination).
|
|
821
821
|
|
|
822
822
|
#### `optimal-imports`
|
|
823
823
|
|
|
@@ -844,7 +844,7 @@ Removes `RootRef` from the codebase.
|
|
|
844
844
|
npx @mui/codemod v5.0.0/root-ref <path>
|
|
845
845
|
```
|
|
846
846
|
|
|
847
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
847
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#rootref).
|
|
848
848
|
|
|
849
849
|
#### `skeleton-variant`
|
|
850
850
|
|
|
@@ -859,7 +859,7 @@ You can find more details about this breaking change in [the migration guide](ht
|
|
|
859
859
|
npx @mui/codemod v5.0.0/skeleton-variant <path>
|
|
860
860
|
```
|
|
861
861
|
|
|
862
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
862
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#skeleton).
|
|
863
863
|
|
|
864
864
|
#### `styled-engine-provider`
|
|
865
865
|
|
|
@@ -869,7 +869,7 @@ Applies `StyledEngineProvider` to the files that contains `ThemeProvider`.
|
|
|
869
869
|
npx @mui/codemod v5.0.0/styled-engine-provider <path>
|
|
870
870
|
```
|
|
871
871
|
|
|
872
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
872
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-style-changes/#style-library).
|
|
873
873
|
|
|
874
874
|
#### `table-props`
|
|
875
875
|
|
|
@@ -895,7 +895,7 @@ Renames props in `Table*` components.
|
|
|
895
895
|
npx @mui/codemod v5.0.0/table-props <path>
|
|
896
896
|
```
|
|
897
897
|
|
|
898
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
898
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#table).
|
|
899
899
|
|
|
900
900
|
#### `tabs-scroll-buttons`
|
|
901
901
|
|
|
@@ -914,7 +914,7 @@ Renames the `Tabs`'s `scrollButtons` prop values.
|
|
|
914
914
|
npx @mui/codemod v5.0.0/tabs-scroll-buttons <path>
|
|
915
915
|
```
|
|
916
916
|
|
|
917
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
917
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#tabs).
|
|
918
918
|
|
|
919
919
|
#### `textarea-minmax-rows`
|
|
920
920
|
|
|
@@ -935,8 +935,8 @@ npx @mui/codemod v5.0.0/textarea-minmax-rows <path>
|
|
|
935
935
|
|
|
936
936
|
You can find more details about this breaking change in the migration guide.
|
|
937
937
|
|
|
938
|
-
- [TextareaAutosize](https://mui.com/material-ui/
|
|
939
|
-
- [TextField](https://mui.com/material-ui/
|
|
938
|
+
- [TextareaAutosize](https://mui.com/material-ui/migration/v5-component-changes/#textareaautoresize)
|
|
939
|
+
- [TextField](https://mui.com/material-ui/migration/v5-component-changes/#textfield)
|
|
940
940
|
|
|
941
941
|
#### `theme-augment`
|
|
942
942
|
|
|
@@ -946,7 +946,7 @@ Adds `DefaultTheme` module augmentation to typescript projects.
|
|
|
946
946
|
npx @mui/codemod v5.0.0/theme-augment <path>
|
|
947
947
|
```
|
|
948
948
|
|
|
949
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
949
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#material-ui-styles).
|
|
950
950
|
|
|
951
951
|
#### `theme-breakpoints`
|
|
952
952
|
|
|
@@ -965,7 +965,7 @@ Updates breakpoint values to match new logic. ⚠️ This mod is not idempotent,
|
|
|
965
965
|
npx @mui/codemod v5.0.0/theme-breakpoints <path>
|
|
966
966
|
```
|
|
967
967
|
|
|
968
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
968
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#theme).
|
|
969
969
|
|
|
970
970
|
#### `theme-breakpoints-width`
|
|
971
971
|
|
|
@@ -975,7 +975,7 @@ Renames `theme.breakpoints.width('md')` to `theme.breakpoints.values.md`.
|
|
|
975
975
|
npx @mui/codemod v5.0.0/theme-breakpoints-width <path>
|
|
976
976
|
```
|
|
977
977
|
|
|
978
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
978
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#theme).
|
|
979
979
|
|
|
980
980
|
#### `theme-options`
|
|
981
981
|
|
|
@@ -1003,7 +1003,7 @@ Renames `type` to `mode`.
|
|
|
1003
1003
|
npx @mui/codemod v5.0.0/theme-palette-mode <path>
|
|
1004
1004
|
```
|
|
1005
1005
|
|
|
1006
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
1006
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#theme).
|
|
1007
1007
|
|
|
1008
1008
|
#### `theme-provider`
|
|
1009
1009
|
|
|
@@ -1013,7 +1013,7 @@ Renames `MuiThemeProvider` to `ThemeProvider`.
|
|
|
1013
1013
|
npx @mui/codemod v5.0.0/theme-provider <path>
|
|
1014
1014
|
```
|
|
1015
1015
|
|
|
1016
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
1016
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#material-ui-core-styles).
|
|
1017
1017
|
|
|
1018
1018
|
#### `theme-spacing`
|
|
1019
1019
|
|
|
@@ -1032,7 +1032,7 @@ Removes the 'px' suffix from some template strings.
|
|
|
1032
1032
|
npx @mui/codemod v5.0.0/theme-spacing <path>
|
|
1033
1033
|
```
|
|
1034
1034
|
|
|
1035
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
1035
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#theme).
|
|
1036
1036
|
|
|
1037
1037
|
#### `theme-typography-round`
|
|
1038
1038
|
|
|
@@ -1047,7 +1047,7 @@ Renames `theme.typography.round($number)` to `Math.round($number * 1e5) / 1e5`.
|
|
|
1047
1047
|
npx @mui/codemod v5.0.0/theme-typography-round <path>
|
|
1048
1048
|
```
|
|
1049
1049
|
|
|
1050
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
1050
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#theme).
|
|
1051
1051
|
|
|
1052
1052
|
#### `top-level-imports`
|
|
1053
1053
|
|
|
@@ -1117,7 +1117,7 @@ Updates Dialog, Menu, Popover, and Snackbar to use the `TransitionProps` prop to
|
|
|
1117
1117
|
npx @mui/codemod v5.0.0/use-transitionprops <path>
|
|
1118
1118
|
```
|
|
1119
1119
|
|
|
1120
|
-
You can find more details about this breaking change in [the migration guide](/material-ui/
|
|
1120
|
+
You can find more details about this breaking change in [the migration guide](/material-ui/migration/v5-component-changes/#dialog).
|
|
1121
1121
|
|
|
1122
1122
|
#### `variant-prop`
|
|
1123
1123
|
|
|
@@ -1153,7 +1153,7 @@ Removes imported `withMobileDialog`, and inserts hardcoded version to prevent ap
|
|
|
1153
1153
|
|
|
1154
1154
|
```diff
|
|
1155
1155
|
- import withMobileDialog from '@material-ui/core/withMobileDialog';
|
|
1156
|
-
+ // FIXME checkout https://mui.com/
|
|
1156
|
+
+ // FIXME checkout https://mui.com/material-ui/migration/v5-component-changes/#dialog
|
|
1157
1157
|
+ const withMobileDialog = () => (WrappedComponent) => (props) => <WrappedComponent {...props} width="lg" fullScreen={false} />;
|
|
1158
1158
|
```
|
|
1159
1159
|
|
|
@@ -1161,7 +1161,7 @@ Removes imported `withMobileDialog`, and inserts hardcoded version to prevent ap
|
|
|
1161
1161
|
npx @mui/codemod v5.0.0/with-mobile-dialog <path>
|
|
1162
1162
|
```
|
|
1163
1163
|
|
|
1164
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
1164
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#dialog).
|
|
1165
1165
|
|
|
1166
1166
|
#### `with-width`
|
|
1167
1167
|
|
|
@@ -1177,7 +1177,7 @@ Removes `withWidth` import, and inserts hardcoded version to prevent application
|
|
|
1177
1177
|
npx @mui/codemod v5.0.0/with-width <path>
|
|
1178
1178
|
```
|
|
1179
1179
|
|
|
1180
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
1180
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-style-changes/#material-ui-core-styles).
|
|
1181
1181
|
|
|
1182
1182
|
#### `mui-replace`
|
|
1183
1183
|
|
|
@@ -1238,7 +1238,7 @@ Replace every occurrence of `material-ui` related package with the new package n
|
|
|
1238
1238
|
npx @mui/codemod v5.0.0/mui-replace <path>
|
|
1239
1239
|
```
|
|
1240
1240
|
|
|
1241
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
1241
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/migration-v4/#update-material-ui-version).
|
|
1242
1242
|
|
|
1243
1243
|
### v4.0.0
|
|
1244
1244
|
|
package/codemod.js
CHANGED
|
File without changes
|
|
@@ -11,7 +11,7 @@ function transformNestedKeys(j, comments, propValueNode, ruleRegEx, nestedKeys)
|
|
|
11
11
|
var _prop$value, _prop$value2;
|
|
12
12
|
|
|
13
13
|
if (((_prop$value = prop.value) == null ? void 0 : _prop$value.type) === 'ObjectExpression') {
|
|
14
|
-
if (typeof prop.key.value === 'string') {
|
|
14
|
+
if (typeof prop.key.value === 'string' && ruleRegEx !== null) {
|
|
15
15
|
let ruleIndex = prop.key.value.search(ruleRegEx);
|
|
16
16
|
let searchStartIndex = 0;
|
|
17
17
|
const elements = [];
|
|
@@ -80,10 +80,13 @@ function transformStylesExpression(j, comments, stylesExpression, nestedKeys, se
|
|
|
80
80
|
|
|
81
81
|
if (objectExpression !== undefined) {
|
|
82
82
|
objectExpression.properties.forEach(prop => {
|
|
83
|
-
var _prop$key;
|
|
83
|
+
var _prop$key, _prop$key2;
|
|
84
84
|
|
|
85
85
|
if ((_prop$key = prop.key) != null && _prop$key.name) {
|
|
86
86
|
ruleNames.push(prop.key.name);
|
|
87
|
+
} else if (((_prop$key2 = prop.key) == null ? void 0 : _prop$key2.value) === '@global') {
|
|
88
|
+
comments.push(j.commentLine(` TODO jss-to-tss-react codemod: '@global' is not supported by tss-react.`, true));
|
|
89
|
+
comments.push(j.commentLine(` See https://mui.com/material-ui/customization/how-to-customize/#4-global-css-override for alternatives.`, true));
|
|
87
90
|
}
|
|
88
91
|
});
|
|
89
92
|
let ruleRegExString = '(';
|
|
@@ -95,7 +98,7 @@ function transformStylesExpression(j, comments, stylesExpression, nestedKeys, se
|
|
|
95
98
|
ruleRegExString += `\\$${ruleName}`;
|
|
96
99
|
});
|
|
97
100
|
ruleRegExString += ')';
|
|
98
|
-
const ruleRegEx = new RegExp(ruleRegExString, 'g');
|
|
101
|
+
const ruleRegEx = ruleNames.length === 0 ? null : new RegExp(ruleRegExString, 'g');
|
|
99
102
|
objectExpression.properties.forEach(prop => {
|
|
100
103
|
if (prop.value) {
|
|
101
104
|
if (prop.value.type !== 'ObjectExpression') {
|
|
@@ -234,11 +237,11 @@ function transformer(file, api, options) {
|
|
|
234
237
|
path.replace(j.importDeclaration(specifiersToMove, j.stringLiteral('tss-react/mui')), specifiersToStay.length > 0 ? j.importDeclaration(specifiersToStay, j.stringLiteral(importSource)) : undefined);
|
|
235
238
|
importsChanged = true;
|
|
236
239
|
}
|
|
237
|
-
} else if (importSource === '@material-ui/styles/makeStyles') {
|
|
240
|
+
} else if (importSource === '@material-ui/styles/makeStyles' || importSource === '@mui/styles/makeStyles') {
|
|
238
241
|
foundMakeStyles = true;
|
|
239
242
|
path.replace(j.importDeclaration([j.importSpecifier(j.identifier('makeStyles'))], j.stringLiteral('tss-react/mui')));
|
|
240
243
|
importsChanged = true;
|
|
241
|
-
} else if (importSource === '@material-ui/styles/withStyles') {
|
|
244
|
+
} else if (importSource === '@material-ui/styles/withStyles' || importSource === '@mui/styles/withStyles') {
|
|
242
245
|
foundWithStyles = true;
|
|
243
246
|
path.replace(j.importDeclaration([j.importSpecifier(j.identifier('withStyles'))], j.stringLiteral('tss-react/mui')));
|
|
244
247
|
importsChanged = true;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = ComponentUsingStyles;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _makeStyles = _interopRequireDefault(require("@mui/styles/makeStyles"));
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
var _InnerComponent;
|
|
17
|
+
|
|
18
|
+
const useStyles = (0, _makeStyles.default)({
|
|
19
|
+
test: {
|
|
20
|
+
backgroundColor: "purple",
|
|
21
|
+
color: "white"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const useStyles2 = (0, _makeStyles.default)({
|
|
25
|
+
test: {
|
|
26
|
+
backgroundColor: "purple",
|
|
27
|
+
color: "white",
|
|
28
|
+
"& $test2": {
|
|
29
|
+
backgroundColor: "lime",
|
|
30
|
+
color: "blue"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
test2: {
|
|
34
|
+
backgroundColor: "blue",
|
|
35
|
+
color: "lime"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
function InnerComponent() {
|
|
40
|
+
const classes = useStyles2();
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
42
|
+
className: classes.test2,
|
|
43
|
+
children: "Inner Test"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function ComponentUsingStyles(props) {
|
|
48
|
+
const classes = useStyles();
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
50
|
+
className: classes.test,
|
|
51
|
+
children: ["Test", _InnerComponent || (_InnerComponent = /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerComponent, {}))]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -48,6 +48,14 @@ const useStyles3 = (0, _core.makeStyles)({
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
+
const useGlobalStyles = (0, _core.makeStyles)(() => ({
|
|
52
|
+
'@global': {
|
|
53
|
+
'.sample': {
|
|
54
|
+
backgroundColor: "purple",
|
|
55
|
+
color: "white"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
51
59
|
|
|
52
60
|
function InnerComponent() {
|
|
53
61
|
const classes = useStyles2();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = ComponentUsingStyles;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _mui = require("tss-react/mui");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
var _InnerComponent;
|
|
17
|
+
|
|
18
|
+
const useStyles = (0, _mui.makeStyles)()({
|
|
19
|
+
test: {
|
|
20
|
+
backgroundColor: "purple",
|
|
21
|
+
color: "white"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const useStyles2 = (0, _mui.makeStyles)()((_theme, _params, classes) => ({
|
|
25
|
+
test: {
|
|
26
|
+
backgroundColor: "purple",
|
|
27
|
+
color: "white",
|
|
28
|
+
[`& .${classes.test2}`]: {
|
|
29
|
+
backgroundColor: "lime",
|
|
30
|
+
color: "blue"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
test2: {
|
|
34
|
+
backgroundColor: "blue",
|
|
35
|
+
color: "lime"
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
function InnerComponent() {
|
|
40
|
+
const {
|
|
41
|
+
classes
|
|
42
|
+
} = useStyles2();
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
44
|
+
className: classes.test2,
|
|
45
|
+
children: "Inner Test"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function ComponentUsingStyles(props) {
|
|
50
|
+
const {
|
|
51
|
+
classes
|
|
52
|
+
} = useStyles();
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
54
|
+
className: classes.test,
|
|
55
|
+
children: ["Test", _InnerComponent || (_InnerComponent = /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerComponent, {}))]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
@@ -51,7 +51,17 @@ const useStyles3 = (0, _mui.makeStyles)()({
|
|
|
51
51
|
color: "lime"
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
});
|
|
54
|
+
}); // TODO jss-to-tss-react codemod: '@global' is not supported by tss-react.
|
|
55
|
+
// See https://mui.com/material-ui/customization/how-to-customize/#4-global-css-override for alternatives.
|
|
56
|
+
|
|
57
|
+
const useGlobalStyles = (0, _mui.makeStyles)()(() => ({
|
|
58
|
+
'@global': {
|
|
59
|
+
'.sample': {
|
|
60
|
+
backgroundColor: "purple",
|
|
61
|
+
color: "white"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
55
65
|
|
|
56
66
|
function InnerComponent() {
|
|
57
67
|
const {
|
|
@@ -34,7 +34,7 @@ function transformer(file, api, options) {
|
|
|
34
34
|
}).toSource(printOptions);
|
|
35
35
|
|
|
36
36
|
if (hasDisableBackdropClick || hasDisableBackdropClick) {
|
|
37
|
-
source = source.replace(/(<Modal)([\s\S]*>)/gm, `$1// You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
37
|
+
source = source.replace(/(<Modal)([\s\S]*>)/gm, `$1// You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#modal)${_os.EOL}$2`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (hasDisableBackdropClick) {
|
|
@@ -5,7 +5,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
5
5
|
/*#__PURE__*/
|
|
6
6
|
(0, _jsxRuntime.jsx)(Modal // `handleOnEscapeKeyDown` is removed by codemod.
|
|
7
7
|
// `disableBackdropClick` is removed by codemod.
|
|
8
|
-
// You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/
|
|
8
|
+
// You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#modal)
|
|
9
9
|
, {
|
|
10
10
|
onClose: handleClose
|
|
11
11
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.4",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/traverse": "^7.17.3",
|
|
36
36
|
"jscodeshift": "^0.13.1",
|
|
37
37
|
"jscodeshift-add-imports": "^1.0.10",
|
|
38
|
-
"yargs": "^17.
|
|
38
|
+
"yargs": "^17.5.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/jscodeshift": "0.11.5"
|