Introduction

Formatting code consistently is a pain, especially when working on a team. The beauty of modern-day web development is that the tooling has gotten so much better! In this article, we will look at setting up Prettier to automatically format your code in Visual Studio Code.

Sample Code

For demo purposes, here’s the sample code we will be formatting. If you’re picky about code formatting, you’ll pick up on some obvious misteps immediately.

  • mix of single vs double quotes
  • the first property of the person object should be on it’s own line
  • the console statement inside of the function should be indented
  • you may or may not like the optional parenthesis surrounding the parameter of the arrow function

Image for post

#programming #programming-tips #code #javascript #coding

Code Formatting with Prettier in Visual Studio Code
2.25 GEEK