Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adamdicarlo
Last active February 22, 2017 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamdicarlo/99652d2b588c4a5c3ed7f93253ecdcbf to your computer and use it in GitHub Desktop.
Save adamdicarlo/99652d2b588c4a5c3ed7f93253ecdcbf to your computer and use it in GitHub Desktop.
Convert tab-indented JS & JSX to standard
#!/bin/bash
# assumes you have gnu find installed via homebrew (`brew install findutils --with-default-names`)
# if you installed without `--with-default-names` then use `gfind`
for f in $(/usr/local/bin/find . -regex ".*\\.jsx?" -o -path ./node_modules -prune -a -type f); do
sed -e '/\/\/ NPM/d' -i "" $f
sed -e 's/ / /g' -i "" $f
sed -e "s/return ('')/return ''/g" -i "" $f
standard --fix $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment