I want to add prettier into scripts in package.json
.
Reading at the docs, it suggests doing the following using the cli
In practice, this may look something like:
prettier --single-quote --trailing-comma es5 --write "{app,__{tests,mocks}__}/**/*.js"
It works on mac / ubuntu but getting the following error message on windows.
[error] No matching files. Patterns tried: 'src/*.js' !**/node_modules/** !./node_modules/**
error Command failed with exit code 2.
For Windows you have to escape the "
, in the package.json
will look like this:
"scripts": {
"prettier": "prettier --single-quote --trailing-comma es5 --write \"{app,__{tests,mocks}__}/**/*.js\"",
},
I encountered this issue most recently myself.
Here's what I did:
in my package.json file i added this to the scripts section:
"scripts": {
"format": "prettier --write src/**/*.js",
}
Note that the path does not have its own set of quotes. That solved it for me
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