mskelton / ratchet

Codemod to convert React PropTypes to TypeScript types.
https://mskelton.dev/ratchet
ISC License
138 stars 14 forks source link

Error when running Ratchet #46

Closed LandonSchropp closed 2 years ago

LandonSchropp commented 2 years ago

I'm trying to run the Ratchet codemod on my local project, but I'm running into an error:

npx jscodeshift -t https://mskelton.dev/ratchet.ts src/components/shared/modal.jsx
Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
/private/var/folders/mt/4fyz36kj69l0j5fffrwlsvdh0000gn/T/jscodeshift2022729-65619-1oipzsm.fzej:1
import type { NodePath } from "ast-types/lib/node-path"
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at compileFunction (<anonymous>)
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.newLoader [as .js] (/Users/landon/Development/chessercise/chessercise/node_modules/pirates/lib/index.js:141:7)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at setup (/Users/landon/Development/chessercise/chessercise/node_modules/jscodeshift/src/Worker.js:80:18)
All done.
Results:
0 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 1.651seconds

Any ideas?

LandonSchropp commented 2 years ago

Never mind. Installing jscodeshift fixed it.