Skip to content

Instantly share code, notes, and snippets.

@mischah
Last active May 4, 2018 09:45
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 mischah/081740aeb44815c2830e8a9e93425671 to your computer and use it in GitHub Desktop.
Save mischah/081740aeb44815c2830e8a9e93425671 to your computer and use it in GitHub Desktop.
VSCode Settings for formatting using Prettier

How to setup Prettier to manually format your code

  1. Install Prettier
  2. Update User Settings
    {
      "editor.formatOnPaste": false,
      "editor.formatOnSave": false,
    }
  3. Use it with:
    • CMD + Shift + P -> Format Document
    • CMD + Shift + P -> Format Selection
  4. Search for prettier in the Default User Settings in case you would like to adapt some formatting rules.

Alternatively you can set up the main formatting rules per project or in your user directory ~/ in a .prettierrc file like the following:

# See https://prettier.io/docs/en/options.html for available options
printWidth: 100
useTabs: true
singleQuote: true
bracketSpacing: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment