If you want to have a general introduction how to write such a codemod have a look at this Gist from me.
Place the usage.js and prettiermod.js in the root of the project. Run:
$ pnpm add globby@^11.0.0 @babel/traverse
$ node usage.js
$ pnpm lintNow remove usage.js and prettiermod.js again and reset package.json and pnpm-lock.yaml.
(FYI: $ pnpm lint never finished for me, because of ESLint. Not sure why - seems to be fine in CI. I ran $ pnpm eslint --no-eslintrc --parser "@typescript-eslint/parser" --parser-options "{ecmaVersion: 6,sourceType: 'module',ecmaFeatures: {modules: true, jsx: true}}" --plugin "import" --plugin "react-hooks" --rule "{'import/order': ['error', { alphabetize: { order: 'asc' } }]}" --fix "src/**/*.{ts,tsx}" which only runs the 'import/order' rule in the code base. That one worked fine and fast.)