Threespot’s shareable config for Prettier
Using yarn:
$ yarn add --dev @threespot/prettier-configUsing npm:
$ npm install --save-dev @threespot/prettier-configTo enable rules you will have to add the key/value pair "prettier": "@threespot/prettier-config" to your root level package.json file.
If you don't want to add it to your package.json file, visit prettier's documentation on shareable configuration for other options
Instead of using prettier's CLI to format your code, you can integrate prettier into your text editor to format your code on save. (recommended)
Instructions for integrating prettier to your specific text editor.
To use the CLI batch script you will have to install prettier as a devDependency.
Note: The batching process formats EVERYTHING except for JavaScript files located in node_modules. We recommend whitelisting the files you want prettier to format via .prettierignore. You can view an example of the whitelisting pattern in this repo: .example.prettierignore.
-
Check your git history to ensure that it is clean
-
Install
@threespot/prettier-config -
Whitelist the files you want the format to alter in your
.prettierignorefile. -
Add this script to your
package.json:prettier-format-all: npx prettier --config-precedence prefer-file --write \"**/*.js\"Alternatively you can run:
yarn run prettier-format-allornpm run prettier-format-allin the CLI. -
Commit all the formatted files into a single commit