Skip to content

Commit

Permalink
Update codemod readme and remove unused color scheme mod
Browse files Browse the repository at this point in the history
  • Loading branch information
csandman committed Oct 20, 2023
1 parent 5cea232 commit 988bf8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 13 additions & 0 deletions codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ npx crs-codemod v5 .
npx crs-codemod v5 ./src
```

> **NOTE:** This codemod currently has a side effect where it removes any
> [TypeScript generics](https://www.typescriptlang.org/docs/handbook/2/generics.html)
> you pass into your `Select` components. This appears to be a shortcoming of
> `jscodeshift`, as it appears not to recognize generics used in JSX. While in
> most cases you shouldn't need generics in order for your component to be typed
> properly, there are some edge cases where they are necessary. If you have a
> need for them, you should either add them back in after the codemod is run, or
> manually make the following transformations.
This codemod runs on all versions of the `Select` component (`Select`,
`AsyncSelect`, `AsyncCreatableSelect`, `CreatableSelect`), and performs the
following modifications to your every instance of them:
Expand All @@ -53,3 +62,7 @@ following modifications to your every instance of them:
as well due to it not working properly with keyboard navigation, and being
outside the scope of the intentions for this project. It has also been fully
removed in `v5.0.0`.

This codemod will only work for props that are added directly to a `Select`
instance. If you have a shared props object, you will have to make these changes
manually.
14 changes: 0 additions & 14 deletions codemod/transforms/v5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,6 @@ export default function transformer(file: FileInfo, api: API) {
)
)
);

// TODO: Decide if I want to rename this one
// Replace `colorScheme` prop with `tagColorScheme`
// $select
// .find(j.JSXAttribute)
// .filter((nodePath) => nodePath.node.name.name === "colorScheme")
// .forEach((attribute) =>
// j(attribute).replaceWith(
// j.jsxAttribute(
// j.jsxIdentifier("tagColorScheme"),
// attribute.node.value
// )
// )
// );
});
});
})
Expand Down

0 comments on commit 988bf8c

Please sign in to comment.