Skip to content

Instantly share code, notes, and snippets.

@mocanew
mocanew / classnames-to-clsx-transform.js
Last active February 9, 2022 12:02
Simple codemod that replaces classnames npm module with the more performant yet very stable clsx
export default (fileInfo, api) => {
const j = api.jscodeshift;
const root = j(fileInfo.source);
// find import $x from 'classnames'
const importDeclaration = root.find(j.ImportDeclaration, {
source: {
type: 'Literal',
value: 'classnames',