@mui/x-codemod 6.0.0-alpha.15 → 6.0.0-beta.0

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 CHANGED
@@ -209,6 +209,7 @@ npx @mui/x-codemod v6.0.0/data-grid/preset-safe <path|folder>
209
209
  The list includes these transformers
210
210
 
211
211
  - [`column-menu-components-rename`](#column-menu-components-rename)
212
+ - [`remove-disableExtendRowFullWidth-prop`](#remove-disableExtendRowFullWidth-prop)
212
213
 
213
214
  #### `column-menu-components-rename`
214
215
 
@@ -235,4 +236,18 @@ npx @mui/x-codemod v6.0.0/data-grid/column-menu-components-rename <path>
235
236
 
236
237
  If you are using `GridRowGroupingColumnMenuItems` and `GridRowGroupableColumnMenuItems` for grouping, consider fixing them manually as these imports are replaced by `GridColumnMenuGroupingItem` and may require some extra work to port.
237
238
 
239
+ #### `remove-disableExtendRowFullWidth-prop`
240
+
241
+ Remove `disableExtendRowFullWidth` prop which is no longer supported.
242
+
243
+ ```diff
244
+ <DataGrid
245
+ - disableExtendRowFullWidth
246
+ />
247
+ ```
248
+
249
+ ```sh
250
+ npx @mui/x-codemod v6.0.0/data-grid/remove-disableExtendRowFullWidth-prop <path>
251
+ ```
252
+
238
253
  You can find more details about Data Grid breaking change in [the migration guide](https://next.mui.com/x/migration/migration-data-grid-v5/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-codemod",
3
- "version": "6.0.0-alpha.15",
3
+ "version": "6.0.0-beta.0",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = removeProps;
7
+ function removeProps({
8
+ root,
9
+ componentNames,
10
+ props,
11
+ j
12
+ }) {
13
+ return root.find(j.JSXElement).filter(path => {
14
+ return componentNames.includes(path.value.openingElement.name.name);
15
+ }).find(j.JSXAttribute).filter(attribute => props.includes(attribute.node.name.name)).forEach(attribute => {
16
+ j(attribute).remove();
17
+ });
18
+ }
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = transformer;
8
8
  var _columnMenuComponentsRename = _interopRequireDefault(require("../column-menu-components-rename"));
9
+ var _removeDisableExtendRowFullWidthProp = _interopRequireDefault(require("../remove-disableExtendRowFullWidth-prop"));
9
10
  function transformer(file, api, options) {
10
11
  file.source = (0, _columnMenuComponentsRename.default)(file, api, options);
12
+ file.source = (0, _removeDisableExtendRowFullWidthProp.default)(file, api, options);
11
13
  return file.source;
12
14
  }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _removeProps = _interopRequireDefault(require("packages/x-codemod/src/util/removeProps"));
9
+ const componentNames = ['DataGrid', 'DataGridPro', 'DataGridPremium'];
10
+ const props = ['disableExtendRowFullWidth'];
11
+ function transformer(file, api, options) {
12
+ const j = api.jscodeshift;
13
+ const root = j(file.source);
14
+ const printOptions = options.printOptions || {
15
+ quote: 'single',
16
+ trailingComma: true
17
+ };
18
+ return (0, _removeProps.default)({
19
+ root,
20
+ j,
21
+ props,
22
+ componentNames
23
+ }).toSource(printOptions);
24
+ }