[英]package.json webpack linting json file with eslint
I am trying to lint json files with eslint.我正在尝试使用 eslint lint json 文件。 Is there a way to do that with esline or is there a plugin I can use for that purpose?有没有办法用 esline 做到这一点,或者有没有我可以为此目的使用的插件? Thanks.谢谢。
I solved it by installing the eslint-plugin-json
module, then add 'json'
type to the plugins
section in .eslintrc
我通过安装eslint-plugin-json
模块解决了这个问题,然后将'json'
类型添加到.eslintrc
的plugins
部分
I can then lint json files like this然后我可以像这样 lint json 文件
eslint . --ext .json
I tried eslint-plugin-json
, but it won't auto-fix your json for you, meaning you have to manually fix the lint issues.我试过eslint-plugin-json
,但它不会为你自动修复你的 json,这意味着你必须手动修复 lint 问题。
So I made eslint-plugin-json-format
, which has auto-fixing built-in.所以我制作了eslint-plugin-json-format
,它内置了自动修复功能。
It will also (optionally) sort your package.json for you它还将(可选)为您对 package.json 进行排序
eslint --ext .json . --fix
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.