A Prettier shareable config for projects using 'Prettier' and ESLint for ReactJS projects
npm install @ewmarkets/prettier-reactjsAdds the Prettier and ESLINT format that we use for ReactJS.
If husky is added, then it will run on every new commit for the staged files
``sh`
npm i --save-dev @ewmarkets/prettier-reactjs
`shpackage.json
{
...
"prettier": "@ewmarkets/prettier-reactjs",
# to run it manually
"scripts": {
...
"prettier": "prettier --write \"./*/.{js,jsx}\""
}
}
`
`sh
package.json
{
...
"prettier": "@ewmarkets/prettier-reactjs",
"scripts": {
...
"prepare": "husky install",
"prettier": "pretty-quick --staged", # remember to modify this!
},
}`$3
`sh
$ echo "npm run prettier" > .husky/pre-commit && chmod +x .husky/pre-commit
$ npm install # this command is only to ensure the prepare script inside the package.json is run
``