
Now format all files with Prettier by running - npm run format in your terminal. The example above is from a project on a mac os. You can either set it to all languages or by a specific language of your choosing. If you have a pre-installed formatter in your IDE, to ensure this extension is used over other extensions, set Prettier as the default formatter in your IDE settings. Prettier can also be installed in VS Code by launching VS Code Quick Open (Ctrl + P), and paste the following command and hit enter.

You can also download it via visual studio code marketplace. When it is opened, you can review it and click the install button. Prettier can be installed through VS Code IDE extensions by searching for “Prettier - code formatter” in visual studio code marketplace and clicking on it. It boosts up developer’s accuracy level, knowing that Prettier got you! No matter how messy the code is, prettier properly configured in your IDE will format all messy code in a blink. Prettier have helped to speed up code writing where an individual does not have to worry about code formatting which used to be a developer’s nightmare, it is customizable, runs offline and is completely free.

This is made possible by its ability to parse away original styling and re-print the parsed AST (Abstract Syntax Tree) with its own rules that take the maximum line length into account and wrap codes when it is necessary. It is Eslint on steroids, fully automatic, it enforces code styling consistency across the code base. Prettier is an opinionated code formatter with support for some programming languages, frontend frameworks and CSS frameworks. Currently, based on Visual Studio code IDE, there are over 30 million users around the globe and over 420 companies utilizing this tool according to stackshare and the increase in utility is still counting. Prettier has become the household name for code formatting and it's gaining much publicity over the years and millions of developers around the world utilize this powerful tool to format code base for production ready.
