How can I tell Prettier to ignore a package.json file?

Mdd picture Mdd · Sep 25, 2017 · Viewed 9.9k times · Source

I am using prettier-standard because the project uses the standard for linting.

Following the prettier pre-commit hook example I am running prettier on commits. However I would like to ignore the package.json file. I tried adding package.json to a .prettierignore file but this did not work.

Code from the prettier pre-commit hook example that I am using in my package.json

{
  "scripts": {
    "precommit": "lint-staged"
  },
  "lint-staged": {
     "*.{js,json,css}": [
       "prettier --write",
       "git add"
     ]
  }
}

```

Answer

xiphe picture xiphe · Nov 21, 2017

you can also use a .prettierignore file.

See the prettier project itself for a reference.