{"id":16149118,"url":"https://github.com/zardoy/codemod-scripts","last_synced_at":"2026-01-19T06:32:22.284Z","repository":{"id":103299654,"uuid":"374339605","full_name":"zardoy/codemod-scripts","owner":"zardoy","description":"Trying to create codemod scripts for every possible case","archived":false,"fork":false,"pushed_at":"2021-06-06T13:22:27.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T21:41:49.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zardoy.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-06T11:12:40.000Z","updated_at":"2021-06-06T13:22:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f2cad3a-1575-4777-878a-729bc4e858ca","html_url":"https://github.com/zardoy/codemod-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zardoy/codemod-scripts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Fcodemod-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Fcodemod-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Fcodemod-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Fcodemod-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zardoy","download_url":"https://codeload.github.com/zardoy/codemod-scripts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zardoy%2Fcodemod-scripts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T00:36:47.295Z","updated_at":"2026-01-19T06:32:22.266Z","avatar_url":"https://github.com/zardoy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codemod Scripts\n\nRefactor scripts for the web.\n\nThe most probably this repo will move to something like https://codeshiftcommunity.com/\n\n## Scripts (planned)\n\n#### `process.env` → `import.meta.env`\n\n\u003c!-- Used in combination with ... --\u003e\n\nModes: `snowpack`, `vite`, `raw`\n\nIf neither snowpack nor vite config file is present and `--mode` option isn't specified - it throws.\n\n`raw` mode just replaces\n\n- Mode: `snowpack` or `vite`\n\n```diff\n- process.env.NODE_ENV\n+ process.env.MODE\n\n// Vite\n- process.env.REACT_APP_NAME\n+ process.env.VITE_NAME\n\n// Snowpack\n- process.env.REACT_APP_NAME\n+ process.env.SNOWPACK_PUBLIC_NAME\n\n```\n\n### React\n\n#### [fix] useState setter name\n\n```diff\n- const [name, setNewName] = useState(\"Alex\");\n+ const [name, setName] = useState(\"Alex\");\n```\n\n### React Styles\n\n#### Material-UI createStyle → emotion className css\n\nOld code:\n\n```tsx\nimport { useStyles, Theme } from \"@material-ui/core\"\ntype Props = {\n    size: number\n};\n\nconst useStyles = makeStyles\u003cTheme, Props\u003e(theme =\u003e ({\n    content: {\n        paddingBottom: ({ size }) =\u003e theme.spacing(4) + size\n    }\n}));\n\nconst Component: React.FC\u003cComponentProps\u003e = () =\u003e {\n    const [size, setSize] = useState(5);\n    const classes = useStyles({ size });\n    return \u003cdiv className={classes.content} /\u003e;\n};\n```\n\nNew code:\n\n\u003e Note 1: [vscode-styled-components extension](https://marketplace.visualstudio.com/items?itemName=jpoissonnier.vscode-styled-components) must be installed to get intellisense support.\n\u003e Note 2: That's not ideal solution because you need to handle `px` yourself (see code below)\n\n```tsx\nimport { useTheme } from \"@material-ui/core\"\nimport { css } from \"@emotion/css\"\n\nconst Component: React.FC\u003cComponentProps\u003e = () =\u003e {\n    const theme = useTheme();\n    \n    const [size, setSize] = useState(5);\n    return \u003cdiv className={css`\n        padding-bottom: ${theme.spacing(4) + size}px;\n    `} /\u003e;\n};\n```\n\nThe ideal solution is `css` prop (or css injection at compilation-time).\n\nBut at least with the approach above you'll get better performance (because its actually native VSCode's *css* language provider, not TypeScript)\n\n\u003c!-- SCRIPTS AUTOGENERATED START --\u003e\n\n\u003c!-- SCRIPTS AUTOGENERATED END --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzardoy%2Fcodemod-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzardoy%2Fcodemod-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzardoy%2Fcodemod-scripts/lists"}