I'd like to ask prettier to parse my JavaScript files recursively instead of specifying each folder in which it should check the files.
I'd like to do something like:
prettier --write "all_js_files_except_node_modules_folder"
I don't find much into their documentation. Any suggestions?
Thanks, Paul
From the directory you want to format, run Prettier with --write : prettier --write . This will format the entire directory recursively with Prettier. If you'd rather not install Prettier globally, then you can achieve the same effect with the npx command (the npm package runner):
Use the prettier command to run Prettier from the command line. To run your locally installed version of Prettier, prefix the command with npx or yarn (if you use Yarn), i.e. npx prettier --help , or yarn prettier --help . To format a file in-place, use --write . (Note: This overwrites your files!)
This issue from a few weeks back seems like it answers your question. TL;DR:
prettier "{,!(node_modules)/**/}*.js"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With