[英]Eslint fix throw error even on json file?
so I am using eslint to fix my file formats and here are my dependencies.所以我使用 eslint 来修复我的文件格式,这是我的依赖项。
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"husky": "^4.3.0",
"lint-staged": "^10.4.0",
"prettier": "^2.1.1"
},
and here are my lint staged这是我的 lint 上演
"lint-staged": {
"!(node_modules|build)/**/*.{js,tsx,json,css,scss,html}": [
"prettier --write",
"eslint --fix"
]
}
However it throws error on my json file saying that但是它在我的 json 文件上抛出错误说
1:1 error Expected an assignment or function call and instead saw an expression no-unused-
expressions
while my JSON file is this而我的 JSON 文件是这个
{
"homeTitle": "Hello <br/> <strong>World</strong>"
}
May I know what is wrong with my JSON file?我可以知道我的 JSON 文件有什么问题吗?
如果你想 lint json 文件,你需要使用 eslint-plugin-json。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.