DEV Community

Discussion on: 4 Spaces or 2?

Collapse
 
temujins profile image
Sifatul Rabbi

@avalander
You can use prettier cli to format the files. Install prettier dependency and add this script in package.json of any javascript/typescript projects
{
"scripts" : {
"format:two": "prettier --tab-width 2 --write \"src//*.ts\" \"test//.ts\",
"format:four": "prettier --tab-width 2 --write \"src/
/.ts\" \"test/*/.ts\"
}
}

then run:
$ npm run format:two
or
$ yarn run format:two

for more info you can checkout prettier official website