-
-
Save sandalsoft/2c23f9abe1251dc9e837bea65c050e17 to your computer and use it in GitHub Desktop.
Convert require to import using prettier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find . -name '*.js' -exec gsed -i "s/const \(.*\) = require(\(.*\))\.\(.*\);/import { \3 as \1 } from \2;/g" '{}' ';' | |
prettier-eslint --write '**/*.js' | |
find . -name '*.js' -exec gsed -i "s/const \(.*\) = require(\(.*\));/import \1 from \2;/g" '{}' ';' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment