Skip to content

Instantly share code, notes, and snippets.

@alfredoreduarte
Last active February 8, 2019 15:53
Show Gist options
  • Select an option

  • Save alfredoreduarte/b8ebb7ab28a0bb98dcdc2759024dc75c to your computer and use it in GitHub Desktop.

Select an option

Save alfredoreduarte/b8ebb7ab28a0bb98dcdc2759024dc75c to your computer and use it in GitHub Desktop.
Prettier JS

Run:

yarn global add prettier
yarn install onchange --dev
echo '{
  "tabWidth": 4,
  "useTabs": true,
  "semi": false,
  "trailingComma": "es5",
  "insertPragma": true,
  "printWidth": 110,
  "requirePragma": true
}' > .prettierrc

Inside package.json:

"scripts": {
	"prettier-watch": "onchange '**/*.js' -- prettier --write {{changed}}"
},

Insert at the top of any any JS file

/**
 * @prettier
 */

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