Reusable Prettier configuration to keep your code style consistent across projects.
npm install --save-dev prettier @alexevs/prettier-config
# or
yarn add -D prettier @alexevs/prettier-configCreate a prettier.config.cjs in the root of your project and re-export this configuration.
If your project relies on CommonJS, you can also name the file prettier.config.js:
// prettier.config.cjs
module.exports = require('@alexevs/prettier-config');You can extend the base options by spreading them:
module.exports = {
...require('@alexevs/prettier-config'),
printWidth: 80,
};Add a formatting script to your package.json if you haven't already:
{
"scripts": {
"format": "prettier --write ."
}
}Developers who maintain multiple JavaScript or TypeScript projects and want a single source of truth for Prettier settings.
