Skip to content

Instantly share code, notes, and snippets.

@unameit10000000
Created April 10, 2025 22:33
Show Gist options
  • Save unameit10000000/6bb490ebc88d513c5fbe7ec977470046 to your computer and use it in GitHub Desktop.
Save unameit10000000/6bb490ebc88d513c5fbe7ec977470046 to your computer and use it in GitHub Desktop.
Using prettier in vscode

1. Install Prettier Extension

Install “Prettier – Code formatter” by esbenp.


⚙️ 2. Set Prettier as the Default Formatter

Hit Ctrl+Shift+P to open the Command Palette. Than type “Preferences: Open Settings (JSON)” and select it

Add this:

"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
  "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true

📄 3. Add a .prettierrc File (Optional but Nice)

Create a .prettierrc in your project root with your preferences, like:

{
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5",
  "printWidth": 100
}

🧪 4. Test It

Just save any JS file, if it auto-formats, you’re golden.

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