eslint-plugin-package-json icon indicating copy to clipboard operation
eslint-plugin-package-json copied to clipboard

feat: privacy rules. Closes #1.

Open zetlen opened this issue 4 years ago • 8 comments

Add rules for required-properties, namespaced-requires-public, and public-requires-namespaced.

Proposed to close #1.

zetlen avatar Aug 02 '19 17:08 zetlen

Hi! I finally found the time to try it, but it seems I'm doing something wrong.

My test repo: https://github.com/mk-pmb/try-eslint-plugin-package-json-privacy-mgmt-js Travis CI error log: https://travis-ci.org/mk-pmb/try-eslint-plugin-package-json-privacy-mgmt-js/jobs/571072367

What could be the problem? Edit: Sorry I forgot it have to let CI install from the PR branch. I'll try that.

mk-pmb avatar Aug 12 '19 22:08 mk-pmb

Ok now with installing from the PR branch it seems to somewhat work, albeit package-json/valid-package-def doesn't like the branch dep. https://travis-ci.org/mk-pmb/try-eslint-plugin-package-json-privacy-mgmt-js/jobs/571078638 How do I tell it to not apply regular JS style rules?

mk-pmb avatar Aug 12 '19 23:08 mk-pmb

@mk-pmb You're running @mk-pmb You can use an overrides config to do that, but oddly enough, that doesn't happen with any preset I've tried but yours. If you remove your preset in that sample repo, it lints just fine.

zetlen avatar Aug 15 '19 22:08 zetlen

@mk-pmb Are you still having trouble with configuration overrides? Are they specific to this config, or do they happen whenever you add .json files to the lint target glob?

zetlen avatar Sep 07 '19 15:09 zetlen

I'm not sure I understand the question. In the other thread I wrote which rules conflict. If I remove those rules, both JSON files are accepted.

Feel free to clone my test repo and try to make it work. :-)

Update: I think I know now, you probably meant whether the errors occur even without your plugin. I'll check.

mk-pmb avatar Sep 07 '19 16:09 mk-pmb

Without your plugin, eslint fails with Parsing error: Unexpected token : because JSON objects aren't a valid script. At least not in node.js:

$ <<<'{ "foo": 123 }' nodejs; echo node rv=$?
[stdin]:1
{ "foo": 123 }
       ^

SyntaxError: Unexpected token :

mk-pmb avatar Sep 07 '19 18:09 mk-pmb

That sounds like the preprocessor isn't working. It's possible that this is not an ideal use of ESLint :)

Thanks for your patience with the turnaround; this project is a minor module spun off from magento/pwa-studio and I don't have a lot of time to maintain it.

Are you still using it? I thought that ESLint preprocessors were global, which would mean that our preprocessor comments converts the JSON to valid JavaScript for all linter plugins. Sounds like that doesn't happen for you. Can you give me all the relevant versions (node, npm, eslint)?

zetlen avatar Oct 29 '19 15:10 zetlen

Are you still using it?

Nope. I'm still waiting for a version that works for my test repo. Then, hopefully, I'll be able to use it with my exttended linter configs as well. :-)

Can you give me all the relevant versions (node, npm, eslint)?

eslint v6.6.0, Node.js v12.13.0, npm v6.12.0, Ubuntu 16.04.6 LTS xenial, kernel: 4.15.0-62-lowlatency, machine/CPU/platform: x86_64 x86_64 x86_64

mk-pmb avatar Oct 29 '19 16:10 mk-pmb

Is there still hope?

mk-pmb avatar Jul 09 '23 16:07 mk-pmb

😄 There is hope! https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1#issuecomment-1716807880

JoshuaKGoldberg avatar Sep 13 '23 01:09 JoshuaKGoldberg