I have a script defined in package.json:
"scripts": {
"prettierCheck": "./node_modules/.bin/prettier --check ./app/javascript/**/*.js"
}
If I run this script using yarn run prettierCheck, Prettier does not find any formatting issues with my files. However, if I run the Prettier command directly, it finds violating files.
Output of yarn run prettierCheck:
~/Projects/tome $ yarn run prettierCheck
yarn run v1.19.0
$ ./node_modules/.bin/prettier --check ./app/javascript/**/*.js
Checking formatting...
All matched files use Prettier code style!
Done in 0.20s
Output of ./node_modules/.bin/prettier --check ./app/javascript/**/*.js:
~/Projects/tome $ ./node_modules/.bin/prettier --check ./app/javascript/**/*.js
Checking formatting...
{... several files listed here ...}
Code style issues found in the above file(s). Forgot to run Prettier?
Why does this happen? What is the difference between running the command directly vs. through a Yarn script?