-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
Faulty codemod
react/19/replace-default-props- https://github.com/codemod-com/commons/tree/main/codemods/react/19/replace-default-props
Trivial tested code sample with functional component and implicit return
export const Card = ({ className, children }) => (
<div className={className}>{children}</div>
);
Card.propTypes = {
className: PropTypes.string,
children: PropTypes.node.isRequired,
};
Card.defaultProps = {
className: "",
};Expected
export const Card = ({ className = "", children }) => (
<div className={className}>{children}</div>
);
Card.propTypes = {
className: PropTypes.string,
children: PropTypes.node.isRequired,
};Actual
Change does not happen on this file: No changes were made during the codemod run.
Estimated impact
It's pretty common to use the implicit return when there are no hooks used in the component. Not sure if this is complicated to fix since I am not very familiar with the AST analysis and modifications. If this case can be fixed that would better utilize this codemod.
Thank you for making this tool ❤ It is very helpful refactoring sidekick :)
Logs:
╭─────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ Codemod: react/19/[email protected] │
│ Target: /Users/user123/projects/ui/src/ui │
│ │
│ Using default include patterns based on the engine │
│ Included patterns: **/*.js, **/*.jsx, **/*.ts, **/*.tsx, **/*.mjs, **/*.cjs, │
│ **/*.mts, **/*.cts, **/*.vue, **/*.svelte │
│ Patterns excluded by default: **/*.d.ts, **/node_modules/**/*.*, **/.next/**/*.*, │
│ **/dist/**/*.*, **/build/**/*.*, **/.git/**/*.*, │
│ **/.svn/**/*.*, **/.hg/**/*.*, **/.bzr/**/*.*, │
│ **/_darcs/**/*.*, **/_MTN/**/*.*, **/_FOSSIL_, **/.fslckout, │
│ **/.view/**/*.* │
│ Patterns excluded from gitignore: /.idea, /.vscode, /node_modules, /.pnp, **/.pnp.js, │
│ /coverage, /build, /public/static, /.storybook/cache, │
│ /storybook-static, **/.DS_Store, **/.env.local, │
│ **/.env.development.local, **/.env.test.local, │
│ **/.env.production.local, **/npm-debug.log*, │
│ **/yarn-debug.log*, **/yarn-error.log*, **/*.swp, **/*.swo, │
│ **/dist/**/*.*, **/.eslintcache, │
│ **/__image_snapshots__/__diff_output__ │
│ │
│ Running in 4 threads │
│ File formatting disabled │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────╯
Execution progress | ████████████████████████████████████████ | 100% || 1/1 files || Current: Card.jsx
No changes were made during the codemod run.
Additional context
Using the latest version as of now (0.18.4)
mohab-sameh