2.0.0 • Published 3 years ago

@ewmarkets/prettier-reactjs v2.0.0

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

Prettier ReactJS

Adds 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

npm i --save-dev @ewmarkets/prettier-reactjs

Prettier

# package.json
{
  ...
  "prettier": "@ewmarkets/prettier-reactjs",
  # to run it manually
  "scripts": {
    ...
    "prettier": "prettier --write \"./**/*.{js,jsx}\""
  }
}

Husky Configuration

To run on every commit, you can modify the current package.json

# package.json
{
  ...
  "prettier": "@ewmarkets/prettier-reactjs",
  "scripts": {
    ...
    "prepare": "husky install",
    "prettier": "pretty-quick --staged", # remember to modify this!
  },
}

Create a new file for running the husky hooks

$ 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