Prettier code formatter configuration.
-
Install dependencies:
npm install --save-dev github:boar-network/prettier-config prettier
-
Configure prettier:
The easiest way to configure prettier to use this configuration is to define
prettier
property in the project’spackage.json
:"prettier": "@boar-network/prettier-config"
For more sophisticated configuration instead of adding this entry add a configuration file (see: Plugins section).
-
Define
scripts
property inpackage.json
, e.g.:"scripts": { "format": "prettier --check .", "format:fix": "prettier --write ." }
-
Run
npm run format
ornpm run format:fix
To handle .sh
or .toml
files you need to install dedicated plugins:
-
for
sh
:npm install --save-dev prettier-plugin-sh
-
for
toml
:npm install --save-dev prettier-plugin-toml
And configure the plugins usage in .prettierrc.js
, e.g.:
module.exports = {
...require("@boar-network/prettier-config"),
plugins: ["prettier-plugin-sh", "prettier-plugin-toml"],
}