[英]Prettier format a json file
I have a unformatted json
file that gets stored in my application with the following structure我有一个未格式化的json
文件,该文件存储在我的应用程序中,结构如下
src
/forms
/test
- abc.json
I am using husky
and lint-staged
to make use of prettier and linting on pre-commit.我正在使用husky
和lint-staged
在预提交时使用更漂亮和 lint。 The configuration resides in my package.json
as following配置位于我的package.json
中,如下所示
"husky": {
"hooks": {
"pre-commit": "lint-staged --relative",
"pre-push": "tsc"
}
},
"lint-staged": {
"src/**/*.{ts, json}": [
"prettier --write",
"eslint --fix"
]
},
....
..
But for some reason the abc.json
file never gets formatted when I push my code to github.但是由于某种原因,当我将代码推送到 github 时, abc.json
文件永远不会被格式化。 What am I missing?我错过了什么?
There's an error in your glob pattern.您的 glob 模式存在错误。 Patterns within curly braces should only be delimited by a comma花括号内的模式只能用逗号分隔
You have:你有:
"src/**/*.{ts, json}"
\ "src/**/*.{ts, json}"
\
It should be:它应该是:
"src/**/*.{ts,json}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.