dcutting
dcutting

Reputation: 41

undefined does not match field "name": string of type Identifier when running @mui/x-codemod v6.0.0/preset-safe

I'm attempting to migrate from v5 to v6 for mui-x and I'm getting the following on 27 files when I run npx @mui/x-codemod v6.0.0/preset-safe .:

Error: undefined does not match field "name": string of type Identifier at addParam (/home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/ast-types/lib/types.js:446:27) at /home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/ast-types/lib/types.js:469:25 at Array.forEach (<anonymous>) at Function.identifier (/home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/ast-types/lib/types.js:467:35) at NodePath.<anonymous> (/home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/@mui/x-codemod/v6.0.0/pickers/view-components-rename/index.js:81:93) at NodePath.<anonymous> (/home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/@mui/x-codemod/node_modules/jscodeshift/src/collections/Node.js:142:47) at /home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/@mui/x-codemod/node_modules/jscodeshift/src/Collection.js:75:36 at Array.forEach (<anonymous>) at Collection.forEach (/home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/@mui/x-codemod/node_modules/jscodeshift/src/Collection.js:74:18) at Collection.replaceWith (/home/dcutting/.npm/_npx/a9b616de167a2c5b/node_modules/@mui/x-codemod/node_modules/jscodeshift/src/collections/Node.js:140:17)

I set my package.json version for @mui/x-date-pickers to 6.0.0 and ran the command to run the codemod scripts. The errors don't appear to reference anything specific regarding my code. For example, here is the code file for one of the errors:

import React from 'react'
import { Table } from '@devexpress/dx-react-grid-material-ui'
import { DateTime } from 'luxon'

const DeliveryTimeCell = ({ value, ...props }) => {
  const formattedDate = DateTime.fromISO(value, { zone: 'utc' }).toLocaleString(
    DateTime.DATETIME_MED_WITH_SECONDS
  )

  return (
    <Table.Cell title={formattedDate} {...props}>
      {formattedDate}
    </Table.Cell>
  )
}

export default DeliveryTimeCell

Upvotes: 2

Views: 235

Answers (1)

jeet.m
jeet.m

Reputation: 593

Update for anyone else facing this: it is now fixed - see this Github issue and related PR for details. Will be released on April 20th, 2023.

Upvotes: 1

Related Questions