- Notifications
You must be signed in to change notification settings - Fork1
Codemod scripts for SolidJS JavaScript library
License
solidjs-community/solid-codemod
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Codemod scripts for upgradingSolidJS APIs and code,powered byJSCodeshift.
npx solid-codemod <transforms> <paths> --write
transforms- transforms namespaths- directories or files to transform--writeor-w- write changes (it defaults to dry run)
NOTES:
- It doesnt accept or use globs.
- Many
transformsorpathscan be provided separated by spaces - When
pathsis not provided it runs tests on the selectedtransforms - Once its done it will display a green
DONE - Transforms should modify code when "reliable possible"
solid-codemod- run all transforms internal tests.solid-codemod solid@v2/jsx-properties-to-attributes- run internaltests for selected transform.solid-codemod solid@v2/jsx-properties-to-attributes .- dry runtransform on current directory.solid-codemod solid@v2/jsx-properties-to-attributes . -w- runtransform on current directory and write changes to files.
Used to update JSX properties vs attributes, from Solid 1.x to Solid2.x.
- CamelCase attributes to lowercase on known tags (not in components)
- Unwrap
attr:for known attributes onsubmit="return false"->attr:onsubmit="return false"- Ensure
booleanattributes values (for static/conditional values) - Ensure
pseudo-booleanattributes values (for static/conditionalvalues) - Warn of unknown attributes
Warning: Do not use in already established Solid 2.x code as itassumes the code is Solid 1.x. For examplefalse is a valid way toremove an attribute in Solid 2.x, while in Solid 1.x it means to havean attribute with that value.
Used to renameclassList attribute toclasshttps://docs.solidjs.com/concepts/components/class-style
Used to changearray.map into the<For/> Solid componenthttps://docs.solidjs.com/reference/components/for
- Look at the
transformsfolder, duplicate and edit a transform. - Test your transform with
solid-codemod solid@v2/your-transform-name - Add the transform to the readme with a description
- May use
src/transforms/shared.jsfor shared code
Some shared code exits for helping author transforms.
src/transforms/shared.js- helpers for parsing and logging changesto console.src/data- data helpers for specific Solid versions
We're currently looking for transformations which SolidJS community isinterested in. Please create afeature request orupvote/comment onexisting featurerequests which have the input and outputcode of the transformation you are looking for.
For example, here is a feature request totransformuseState/useEffect of ReactJS to createSignal/onCleanup ofSolidJS for your reference.
- transfer npm to the solid project
- figure out how to autopublish to npm
MIT
About
Codemod scripts for SolidJS JavaScript library
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.