Created
April 19, 2017 03:02
-
-
Save aminmarashi/0e4cbed807b2d016733da2c644001c18 to your computer and use it in GitHub Desktop.
Convert require to import using prettier
This file contains hidden or 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