-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from codemod-com/issue_1400_codemod_repo
fix(codemods/react/19/replace-default-props): fix support for JSX files and Property jscodeshift type in react/19/replace-default-props codemod
- Loading branch information
Showing
7 changed files
with
63 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
codemods/react/19/replace-default-props/__testfixtures__/button-jsx-example-input.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const Button = ({ size, color }) => { | ||
return <button style={{ color, fontSize: size }}>Click me</button>; | ||
}; | ||
|
||
Button.defaultProps = { | ||
size: "16px", | ||
color: "blue", | ||
}; |
3 changes: 3 additions & 0 deletions
3
codemods/react/19/replace-default-props/__testfixtures__/button-jsx-example-output.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const Button = ({ size = "16px", color = "blue" }) => { | ||
return <button style={{ color, fontSize: size }}>Click me</button>; | ||
}; |
10 changes: 4 additions & 6 deletions
10
codemods/react/19/replace-default-props/__testfixtures__/nested-destructuring.output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
codemods/react/19/replace-default-props/__testfixtures__/with-functions.output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
const List = ({ | ||
items = [], | ||
renderItem = (item) => <li key={item}>{item}</li>, | ||
}) => { | ||
const List = ({ items = [], renderItem = (item) => <li key={item}>{item}</li> }) => { | ||
return <ul>{items.map(renderItem)}</ul>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters