Skip to content

Use Prettier

Madalin Ignisca edited this page Feb 23, 2021 · 1 revision

Follow everything here to get Prettier working, and cover JavaScript, TypeScript, Json and GraphQL.

Make sure you follow Prettier Resolution and make your project have Prettier as development dependency. This will make sure everybody will use exactly same Prettier and all plugins you'd add extra. This will also allow the project to control Prettier when using a multi project workspace (I do this when working with separate API on Laravel and separate PWA/SPA app with VueJS for dashboard, front-facing website for visitors etc.)

For PHP follow instructions from the official plugin.

For a Laravel project as example I do this:

npm install --save-dev prettier @prettier/plugin-php

Than follow any customization for configuration using the information from the extension on the Visual Studio Code Marketplace.

If you use EditorConfig and have a configuration file in the root of the project, it will be used by Prettier, so you are pretty much covered if you know how to tweak it.

Clone this wiki locally