简体   繁体   中英

package.json webpack linting json file with eslint

I am trying to lint json files with eslint. Is there a way to do that with esline or is there a plugin I can use for that purpose? Thanks.

I solved it by installing the eslint-plugin-json module, then add 'json' type to the plugins section in .eslintrc

I can then lint json files like this

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.

So I made eslint-plugin-json-format , which has auto-fixing built-in.

It will also (optionally) sort your package.json for you

eslint --ext .json . --fix

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM