Is there a way to format all files in a project without formatting each one individually?
Use the extension called ”Format Files”. Here are the steps:
Source: https://marketplace.visualstudio.com/items?itemName=jbockle.jbockle-format-files
This works for me
Install prettier:
npm init
npm i prettier
Add following script in package.json:
"pretty": "prettier --write \"./**/*.{js,jsx,json}\""
In this case only, i need to format my .js .jsx and .json files.
Run script:
npm run pretty
The simplest solution that I have found is as below.
npx prettier --write "**/*.ts"(Add the file type regex as per the need)