dannielum
dannielum

Reputation: 356

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.

Upvotes: 0

Views: 953

Answers (2)

kuceb
kuceb

Reputation: 18053

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

Upvotes: 1

dannielum
dannielum

Reputation: 356

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

Upvotes: 1

Related Questions