Run prettier on all JS files in a directory

Recently, I was working on existing application of Node.JS. It has lot of JS files which were not formatted and pretty difficult to read.

I have prettier installed on my VS Code for code formatting. Run prettier individually on each JS file is time taking process and not practically doable for large projects. I found a solution of this problem to run prettier via CLI on all JS files in a directory.

prettier --print-width 80 --no-semi --single-quote --trailing-comma es5 --write src/**/*.js

Please, if you find something to improve or any suggestion, don’t hesitate to contact me, I’ll try to do my best to answer any question or improve this tutorial.

Happy Coding!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.