Giter Site home page Giter Site logo

Comments (5)

LukasTy avatar LukasTy commented on June 17, 2024

Hello, could you clarify your project folder structure and in which folder are you running the codemod? 🤔
If you are running it in your project root folder, it implies that all your source code lives in the src folder, is that correct?

Quite a few codemods rely on the fact that the components are imported from the @mui/x- package. Is this the case in your project? Or do you have wrapper components that you use throughout the project?

from mui-x.

conerye avatar conerye commented on June 17, 2024

yes, I am running the codemod from the root folder and the source code is all in the src folder.
I have, for example, a file that has:

import { DataGridPremium, GridOverlay, gridClasses, useGridApiRef } from '@mui/x-data-grid-premium';
...

<DataGridPremium
components={{
// change the detail panel icons
DetailPanelExpandIcon: KeyboardArrowDownIcon,
DetailPanelCollapseIcon: KeyboardArrowUpIcon,
// allow for a custom table footer
Footer: customFooter || undefined,
// allow for a text message to be added to the grid loading overlay
LoadingOverlay: loadingMessage ? CustomGridLoadingOverlay : undefined,
// change the grid overlay text message when there are no rows to display
NoResultsOverlay: CustomGridOverlay,
NoRowsOverlay: CustomGridOverlay,
// enable the custom toolbar
Toolbar: disableToolbar ? undefined : CustomTableToolbar,
}}
componentsProps={{
footer: footerProps,
loadingOverlay: loadingMessage && { message: loadingMessage },
noResultsOverlay: { message: noFilteredDataMsg },
noRowsOverlay: { message: noDataMsg },
pagination: {
showFirstButton: true,
showLastButton: true,
},
row: onRowRightClick && {
onContextMenu: handleRowRightClick,
},
toolbar: {
actionInputs,
actionsMenu,
disableColumnSelector,
disableExport,
disableQuickFilter,
name,
onHelp,
userName,
},
}}
disableColumnSelector={disableColumnSelector}
disableRowGrouping
density="compact"
experimentalFeatures={{ newEditingApi: true }}
rows={rows}
onRowDoubleClick={onRowDoubleClick ? handleRowDoubleClick : undefined}
// keep track of rows that are selected
onSelectionModelChange={handleSelectionModelChange}
selectionModel={selectedRowIds}
// show grid lines
showCellRightBorder
showColumnRightBorder
/>

I expected to see changes in this file...

from mui-x.

LukasTy avatar LukasTy commented on June 17, 2024

I've tried running the codemod on your example in an isolated project and it successfully generated changes:
Screenshot 2023-08-30 at 18 01 01

Could you maybe provide a minimal reproduction example, where this problem happens?
Maybe you could create a repository or at least provide the full component file with sensitive and unimportant data removed?

from mui-x.

conerye avatar conerye commented on June 17, 2024

I can't provide the full component file... but the snippet above is the wrapper component, so now that I am understanding better how the codemods work, I'm realizing this would probably be the only file that would get changed and I will have to manually change the others. so, I guess I will just manually change this one too. bummer
thanks for trying to help

from mui-x.

LukasTy avatar LukasTy commented on June 17, 2024

Sorry to hear that your experience with the "codemods" wasn't good.
Yes, you are correct, if you are using a wrapper component and then reusing it in your project, part of the codemods won't work.
There are three types of codemod pre-requisite checks:

  • ones that check the imports and only run when our package imports are used;
  • ones that check the component's names (if you alias the components to anything different - it could no longer work);
  • ones that do not have any checks (these are the transformations, which we deemed safe as is because the props that they are working with are quite unique and shouldn't trigger false positives in other codebases);

In theory, if you'd change the import path and/or names of the components, before running the codemods, they should apply the respective changes. 🤔

from mui-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.