Skip to content

Instantly share code, notes, and snippets.

@spences10
Last active April 30, 2018 13:05
Show Gist options
  • Save spences10/6fa39a905fa38c65560366cc002a169b to your computer and use it in GitHub Desktop.
Save spences10/6fa39a905fa38c65560366cc002a169b to your computer and use it in GitHub Desktop.
Prettier formatting for files
{
"bracketSpacing": true,
"jsxBracketSameLine": true,
"parser": "babylon",
"printWidth": 70,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"proseWrap": "always",
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
},
{
"files": ".eslintrc.json",
"options": { "parser": "json" }
},
{
"files": "*.json",
"options": { "parser": "json" }
},
{
"files": "*.md",
"options": { "parser": "markdown" }
}
]
}
{
"format": "pretty-quick",
"precommit": "pretty-quick --staged",
}

Prettier config

I have found using pretty-quick along with Prettier to be a really good combo.

Add pretty-quick and Prettier as dev deps

npm i -D prettier pretty-quick

Then add the scipts to your package.json

  "format": "pretty-quick",
  "precommit": "pretty-quick --staged",

Then configure your .prettierrc to your liking

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