mon-jai / style-attribute-to-styled-component-codemod

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

style-attribute-to-styled-component-codemod

A jscodeshift codemod for migrating from style attributes to styled-components.

Prerequisites

jscodeshift installed globally.

npm install -g jscodeshift

Usage

To migrate all jsx files within the src directory:

jscodeshift src/**/*.jsx [--similar-components-minimum-common-declarations COUNT] -t https://raw.githubusercontent.com/mon-jai/style-attribute-to-styled-component-codemod/main/codemod.ts

--similar-components-minimum-common-declarations
  Specifies the minimum number of common declarations required to determine whether components should be extended from a common base.

You should reformat your code after running the codemod.

Known Limitations

  • Dynamically computed CSS properties and values are skipped.

License

MIT

About

License:MIT License


Languages

Language:TypeScript 87.4%Language:JavaScript 12.6%