You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// prettier.config.cjsmodule.exports={cache: true,cacheLocation: '.cache/prettier/.prettier-cache',cacheStrategy: CI ? 'content' : 'metadata',}
This way the caching strategy can be set dynamically for CI vs local, and my package.json can be a lot cleaner:
From this:
{
"scripts": {
"format": "prettier --cache --cache-location=.cache/prettier/.prettier-cache",
"format:ci": "npm run format -- --cache-strategy=content",
"format:local": "npm run format -- --cache-strategy=metadata",
}
}
To this:
{
"scripts": {
"format": "prettier"
}
}
I wanted to get some thoughts and opinions from the maintainers and community first. I would be happy to write up an issue, and possibly a PR, if there is a positive consensus about this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The CLI cache settings are really nice.
I'd love to be able to configure these from a Prettier configuration file instead of from the CLI.
--cache
--cache-location
--cache-strategy
Like this:
This way the caching strategy can be set dynamically for CI vs local, and my
package.json
can be a lot cleaner:From this:
To this:
I wanted to get some thoughts and opinions from the maintainers and community first. I would be happy to write up an issue, and possibly a PR, if there is a positive consensus about this.
Beta Was this translation helpful? Give feedback.
All reactions