1.5.0 • Published 2 years ago
@giotramu/prettier-config v1.5.0
Prettier Config
Prettier is an excellent tool, and it's focused on doing what it does best: handle the code formatting styles. :sparkles: I bundled my configuration to share it between different projects.
Getting started
Install Prettier and the related configuration as a devDependencies
:
# NPM
npm add --save-dev prettier @giotramu/prettier-config
# PNPM
pnpm add --save-dev prettier @giotramu/prettier-config
# Yarn
yarn add --dev prettier @giotramu/prettier-config
Reference it in your package.json
:
{
"name": "my-cool-library",
"version": "1.0.0",
"prettier": "@giotramu/prettier-config"
}
If you don’t want to use package.json
, you can choose any of the supported extensions to export a string, e.g. .prettierrc.json
:
"@giotramu/prettier-config"
Note: This method doesn't offer a way to extend the configuration and override some properties. If you need to do that, import the file in a
.prettierrc.js
file and export the modifications:
module.exports = {
...require('@giotramu/prettier-config'),
semi: true
};
Use the --write
flag to format a file in place.
npx prettier --write .
Config
Check the .prettierrc.json
file if you want to inspect the configuration.