Skip to content

Instantly share code, notes, and snippets.

@oskarrough
Last active April 16, 2017 14:35
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 oskarrough/37d16b7149acc21634d47df5e0c5f928 to your computer and use it in GitHub Desktop.
Save oskarrough/37d16b7149acc21634d47df5e0c5f928 to your computer and use it in GitHub Desktop.
Pretty JavaScript

Install prettier locally to your project:

yarn add prettier

Then, add a new script to package.json:

{
  "scripts": {
    "prettier": "prettier --write --use-tabs --single-quote --no-semi --no-bracket-spacing 'src/*/**.js'"
  }
}

Remember to change the path at the end to match where your JavaScript files are.

Now you can always run yarn prettier and it'll format and overwrite your files. Pretty and all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment