Skip to content

Commit

Permalink
[codemod] Bump jscodeshift to 0.15.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi committed Mar 27, 2024
1 parent 783d7ed commit 433071f
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 605 deletions.
2 changes: 1 addition & 1 deletion packages/x-codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@babel/core": "^7.24.0",
"@babel/runtime": "^7.24.0",
"@babel/traverse": "^7.24.0",
"jscodeshift": "0.13.1",
"jscodeshift": "0.15.2",
"jscodeshift-add-imports": "^1.0.10",
"yargs": "^17.7.2"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
// @ts-nocheck
import * as React from 'react';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
import { DataGrid } from '@mui/x-data-grid/DataGrid';
import { DataGrid, GridColDef } from '@mui/x-data-grid';

const theme = createTheme({});

const columns = [
{ field: 'id', headerName: 'ID', width: 90 } satisfies GridColDef,
];

function App() {
return (
<ThemeProvider theme={theme}>
<DataGrid
columns={columns}
componentsProps={{
toolbar: {
color: 'primary',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
// @ts-nocheck
import * as React from 'react';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
import { DataGrid } from '@mui/x-data-grid/DataGrid';
import { DataGrid, GridColDef } from '@mui/x-data-grid';

const theme = createTheme({});

const columns = [
{ field: 'id', headerName: 'ID', width: 90 } satisfies GridColDef,
];

function App() {
return (
<ThemeProvider theme={theme}>
(<ThemeProvider theme={theme}>
<DataGrid
columns={columns}
slotProps={{
toolbar: {
color: 'primary',
Expand All @@ -22,7 +28,7 @@ function App() {
textField: { variant: 'filled' }
}} />
</LocalizationProvider>
</ThemeProvider>
</ThemeProvider>)
);
}

Expand Down
16 changes: 12 additions & 4 deletions packages/x-codemod/src/v7.0.0/preset-safe/preset-safe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,24 @@ function read(fileName) {
describe('v7.0.0', () => {
describe('preset-safe', () => {
it('transforms code as needed', () => {
const actual = transform({ source: read('./actual.spec.js') }, { jscodeshift }, {});
const actual = transform(
{ source: read('./actual.spec.tsx') },
{ jscodeshift: jscodeshift.withParser('tsx') },
{},
);

const expected = read('./expected.spec.js');
const expected = read('./expected.spec.tsx');
expect(actual).to.equal(expected, 'The transformed version should be correct');
});

it('should be idempotent', () => {
const actual = transform({ source: read('./expected.spec.js') }, { jscodeshift }, {});
const actual = transform(
{ source: read('./expected.spec.tsx') },
{ jscodeshift: jscodeshift.withParser('tsx') },
{},
);

const expected = read('./expected.spec.js');
const expected = read('./expected.spec.tsx');
expect(actual).to.equal(expected, 'The transformed version should be correct');
});
});
Expand Down

0 comments on commit 433071f

Please sign in to comment.