instantsearch-codemods
v0.2.2
Published
Codemods for Algolia InstantSearch libraries
Readme
Codemods
These codemods (code transformers) can be ran with jscodeshift.
rish-to-ris
This will replace all imports from react-instantsearch-hooks to their react-instantsearch equivalent.
npx @codeshift/cli --packages 'instantsearch-codemods#rish-to-ris' <path>ris-v6-to-v7
This will:
- Replace
react-instantsearch-domimports toreact-instantsearch - Replace prop names to their new equivalent
- Replace
translationskeys to their new equivalent if they are defined inline, otherwise it will add a TODO comment - Add some TODO comments to help you migrate
npx @codeshift/cli --packages 'instantsearch-codemods#ris-v6-to-v7' <path>addWidget-to-addWidgets
This will replace all addWidget calls to addWidgets and removeWidget calls to removeWidgets.
npx @codeshift/cli --packages 'instantsearch-codemods#addWidget-to-addWidgets' <path>Notes
If you are using a formatter or a linter, make sure to run its autofixing after this transformation, since code can be formatted differently after it has been transformed. In our repository, that would be:
yarn format