5/21/2023 0 Comments Auto format visual studio code![]() The second project uses more modern style without semi-colons and with trailing commas. Here are settings I am using in the first project to make it look "traditional" ES5 projectA/.prettierrc.json 1 Prettier tries to enforce the same code style without 100s of options, thus there are just a few settings you can change. So when I edit projectA/.prettierrc.json file, I get intelligent tooltips. In fact, VSCode understands the Prettier configuration file format via the built-in json schema. I like using JSON configuration format so my code editor helps me. In my example I have two subfolders, and there is a configuration file in each subfolder: 1 Npm install -save-dev -save-exact prettierĪt the root of the project create the Prettier configuration file. I assume you are using NPM and have package.json file inside the repository. ![]() In reality, each of your repos will have its style I am using subfolders in order to keep the example simple. The demo repo bahmutov/prettier-config-example has two subfolders, each with its distinct code style, enforced by Prettier. Not every project uses the same code style, thus it is important to respect the style of whatever project you are currently working in. When setting up Prettier it is important to configure it per-project.
0 Comments
Leave a Reply. |