Lotterywest Prettier Config
See the Confluence styleguide page for more information.
Setting up a new project
This will work with ECMAScript, including Typescript, Flow and in React.
Install
$ npm i -D prettier git+https://{team}:{password}@bitbucket.org/lotterywest/prettier-config.git
Edit package.json
{
// ...
"scripts": {
// ...
"lint": "npm run lint:format && ...",
"lint:format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
// ...
},
// ...
"prettier": "@binaryben/prettier-config"
}
Set up VSCode
- Install the extension for VScode
- Open settings (⌘ + ,) and set
prettier.requireConfig
and editor.formatOnSave
to true
Usage
npm run lint
Note: It is highly recommended to use this with eslint as well
References
https://prettier.io/docs/en/configuration.html#sharing-configurations