eslint-config-hardcore icon indicating copy to clipboard operation
eslint-config-hardcore copied to clipboard

Add eslint-plugin-json-format

Open EvgenyOrekhov opened this issue 4 years ago • 10 comments

https://github.com/bkucera/eslint-plugin-json-format

  • [ ] Wait for https://github.com/Bkucera/eslint-plugin-json-format/issues/14
  • [ ] Wait for a new release

EvgenyOrekhov avatar Dec 04 '19 10:12 EvgenyOrekhov

It's too buggy. It doesn't work with the json-files plugin, it gives Unexpected end of JSON input for every JSON file, and it gives warnings about skipping files.

EvgenyOrekhov avatar Dec 04 '19 10:12 EvgenyOrekhov

I really like the sort-package-json feature, hope the plugin will get better soon. Waiting for https://github.com/Bkucera/eslint-plugin-json-format/issues/14.

EvgenyOrekhov avatar Jun 08 '20 13:06 EvgenyOrekhov

If you use Prettier, I guess one option for sorting package.json keys would be https://github.com/matzkoh/prettier-plugin-packagejson

karlhorky avatar Jan 22 '22 14:01 karlhorky

@karlhorky Yeah I use that plugin with Prettier in my projects! Do you think it will automagically work if I add it to eslint-config-hardcore's dependencies? I guess I'll have to try it to know for sure :)

EvgenyOrekhov avatar Jan 22 '22 15:01 EvgenyOrekhov

I'm not sure, I think the plugins are loaded based on entries in package.json. However, you could recommend installing this config using install-peerdeps or similar and then specify it as a peer dependency... We take this approach with our config: https://github.com/upleveled/eslint-config-upleveled

karlhorky avatar Jan 22 '22 15:01 karlhorky

@karlhorky I tried different options, can't make eslint-plugin-prettier work on *.json files :(

EvgenyOrekhov avatar Jan 23 '22 20:01 EvgenyOrekhov

Oh, I don't use eslint-plugin-prettier - I'm just using Prettier via the Prettier VS Code extension. But if you want to use that plugin, maybe something with ESLint file extensions or something...

karlhorky avatar Jan 23 '22 20:01 karlhorky

@karlhorky I see. Yeah I wish we could use eslint-plugin-prettier with all Prettier plugins, so we could use ESLint to format any file supported by Prettier.

What's interesting is that I discovered that @html-eslint/parser and eslint-plugin-prettier play nicely together, and I managed to set up formatting of *.html files with eslint-plugin-prettier :)

https://github.com/EvgenyOrekhov/eslint-config-hardcore/blob/5166075ede3738a70c0581cb9cdc1c6dd6486106/base.json#L834

https://github.com/EvgenyOrekhov/eslint-config-hardcore/blob/5166075ede3738a70c0581cb9cdc1c6dd6486106/prettier.json#L38-L43

But I couldn't do the same with JSON, unfortunately.

EvgenyOrekhov avatar Jan 23 '22 21:01 EvgenyOrekhov

Please don’t add eslint-plugin-prettier, the error messages don’t render correctly on Windows machines.

RedGuy12 avatar Jan 24 '22 00:01 RedGuy12

@RedGuy12 eslint-plugin-prettier was added to eslint-config-hardcore a long time ago.

EvgenyOrekhov avatar Jan 24 '22 07:01 EvgenyOrekhov

This is no longer relevant.

I recommend using Prettier separately from ESLint, with this config: https://github.com/EvgenyOrekhov/prettier-config

EvgenyOrekhov avatar Nov 23 '23 19:11 EvgenyOrekhov