Given an invocation of prettier in package.json like this:
"scripts": {
"prettier": "prettier --write --single-quote --no-semi --trailing-comma es5 --print-width 80 \"*.js\""
},
Move the options to a config variable like this:
"scripts": {
"prettier": "prettier --write $npm_package_config_prettier \"*.js\""
},
"config": {
"prettier": "--single-quote --no-semi --trailing-comma es5 --print-width 80"
},
Then create a shell script called prettier-emacs
that pulls the config variable
and invokes prettier, and customize prettier-js-command
in emacs to invoke the new script.