如何告诉Prettier忽略package.json文件?

时间:2021-10-24 20:34:17

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

我使用更漂亮的标准,因为该项目使用标签的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.

在更漂亮的预提交钩子示例之后,我在提交时运行得更漂亮。但是我想忽略package.json文件。我尝试将package.json添加到.prettierignore文件中,但这不起作用。

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

来自我在package.json中使用的更漂亮的预提交钩子示例中的代码

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

```

```

1 个解决方案

#1


3  

you can also use a .prettierignore file.

你也可以使用.prettierignore文件。

See the prettier project itself for a reference.

查看更漂亮的项目本身作为参考。

#1


3  

you can also use a .prettierignore file.

你也可以使用.prettierignore文件。

See the prettier project itself for a reference.

查看更漂亮的项目本身作为参考。