Skip to content

Commit

Permalink
Add codemod explanation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardobelchior committed Feb 7, 2025
1 parent ecf0834 commit e25f08c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/x-codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ Remove the `<ChartsOnAxisClickHandler />` and move the associated `onAxisClick`
</ChartContainer>
```

#### `rename-sparkline-colors-to-color`

Renames the `colors` prop of a `SparkLineChart` to `color` and accesses its first element.

```diff
<SparkLineChart
- colors={['red']}
+ color={['red'][0]}
/>
```

If `colors` is a function, it will be wrapped in another function that returns its first element.

Check warning on line 270 in packages/x-codemod/README.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "packages/x-codemod/README.md", "range": {"start": {"line": 270, "column": 31}}}, "severity": "WARNING"}

```diff
<SparkLineChart
- colors={fn}
+ color={typeof fn === 'function' ? mode => fn(mode)[0] : fn[0]}
/>
```

### Data Grid codemods

#### `preset-safe` for Data Grid v8.0.0
Expand Down

0 comments on commit e25f08c

Please sign in to comment.