Skip to content

Ag 13133 codemod #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# `transform-grid-options-v33-0`

> _Transform deprecated Grid options_

See the [`transform-grid-options`](../../plugins/transform-grid-options/) plugin for usage instructions.

## Common tasks

### Add a test case

Create a new unit test scenario for this transform:

```
pnpm run task:create-test --type transform --target transform-grid-options-v33-0
```

### Add a new rule

Replacement rules are specified in [`replacements.ts`](./replacements.ts)

### Add to a codemod release

Add this source code transformation to a codemod release:

```
pnpm run task:include-transform --transform transform-grid-options-v33-0
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { createGrid } from '@ag-grid-community/core';

createGrid(document.body, {
columnDefs: [],
rowData: [],
unSortIcon: true,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
unSortIcon: false,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {},
unSortIcon: true,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {},
unSortIcon: false,
});

createGrid(document.body, {
columnDefs: [
{ field: 'y', unSortIcon: false },
{ field: 'z' },
],
rowData: [],
defaultColDef: {
field: 'a',
unSortIcon: false,
},
unSortIcon: true,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
field: 'a',
unSortIcon: true,
},
unSortIcon: false,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
field: 'a',
unSortIcon: false,
},
unSortIcon: true,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
field: 'a',
unSortIcon: true,
},
unSortIcon: false,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
sortingOrder: ['asc', 'desc'],
});


createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
sortingOrder: ['asc', 'desc'],
},
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {},
sortingOrder: ['asc', 'desc'],
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
sortingOrder: ['asc', 'desc'],
},
sortingOrder: ['asc', 'desc'],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import { createGrid } from '@ag-grid-community/core';

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
unSortIcon: true
},
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
unSortIcon: false
},
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

defaultColDef: {
unSortIcon: true
}
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

defaultColDef: {
unSortIcon: false
}
});

createGrid(document.body, {
columnDefs: [
{ field: 'y', unSortIcon: false },
{ field: 'z' },
],

rowData: [],

defaultColDef: {
field: 'a',
unSortIcon: true,
}
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

defaultColDef: {
field: 'a',
unSortIcon: false,
}
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

defaultColDef: {
field: 'a',
unSortIcon: true,
}
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

defaultColDef: {
field: 'a',
unSortIcon: false,
}
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
sortingOrder: ['asc', 'desc']
},
});


createGrid(document.body, {
columnDefs: [],
rowData: [],
defaultColDef: {
sortingOrder: ['asc', 'desc'],
},
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

defaultColDef: {
sortingOrder: ['asc', 'desc']
}
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

defaultColDef: {
sortingOrder: ['asc', 'desc'],
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"scenario": {
"input": "input.js",
"output": "output.js"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { createGrid } from '@ag-grid-community/core';

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveSingleChildren: true,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveSingleChildren: false,
});

const opt1 = true;
createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveSingleChildren: opt1,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveSingleChildren: true ? false : false,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveLowestSingleChildren: true,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveLowestSingleChildren: false,
});

const opt2 = true;
createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveLowestSingleChildren: opt2,
});

const opt3 = true;
const opt4 = true;
createGrid(document.body, {
columnDefs: [],
rowData: [],
groupRemoveSingleChildren: opt3,
groupRemoveLowestSingleChildren: opt4,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { createGrid } from '@ag-grid-community/core';

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupHideParentOfSingleChild: true,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

});

const opt1 = true;
createGrid(document.body, {
columnDefs: [],
rowData: [],
groupHideParentOfSingleChild: opt1,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupHideParentOfSingleChild: true ? false : false,
});

createGrid(document.body, {
columnDefs: [],
rowData: [],
groupHideParentOfSingleChild: 'leafGroupsOnly',
});

createGrid(document.body, {
columnDefs: [],
rowData: [],

});

const opt2 = true;
createGrid(document.body, {
columnDefs: [],
rowData: [],
groupHideParentOfSingleChild: opt2 ? 'leafGroupsOnly' : false,
});

const opt3 = true;
const opt4 = true;
createGrid(document.body, {
columnDefs: [],
rowData: [],
groupHideParentOfSingleChild: opt3 || (opt4 ? 'leafGroupsOnly' : false)
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"scenario": {
"input": "input.js",
"output": "output.js"
}
}
Loading
Loading