eslint-plugin-json-schema-validator icon indicating copy to clipboard operation
eslint-plugin-json-schema-validator copied to clipboard

feat: provide config options for schemastore cache

Open twelvelabs opened this issue 2 years ago • 4 comments

Would it be possible to provide options for json-schema-validator/no-invalid:

  1. Cache location. It seems to currently be hard coded to ./.cached_schemastore, but I'm using it in a docker container and that location isn't persisted between runs. I already have a persistent volume setup and I'd like to tell json-schema-validator to use that location.

  2. Cache TTL. Once I have json-schema-validator caching to a persistent location, I would like to tell it when to re-fetch the cached schema files.

twelvelabs avatar Oct 16 '22 21:10 twelvelabs

Thank you for posting issue!

I think it makes sense to add your suggested options. However, we might be better off using settings rather than rule options. https://eslint.org/docs/latest/user-guide/configuring/configuration-files#adding-shared-settings

ota-meshi avatar Oct 16 '22 22:10 ota-meshi

The lack of configuration raises an error with Yarn 2:

EROFS: read-only filesystem, mkdir '/node_modules/eslint-plugin-json-schema-validator/.cached_schemastore

It can be worked around with the following addition to package.json:

  "dependenciesMeta": {
    "eslint-plugin-json-schema-validator": {
      "unplugged": true
    }
  }

This makes it an unplugged package in .yarn/unplugged where it can write files. This isn't ideal for yarn zero-installs, so having options to configure it would be nice.

anothermh avatar Feb 08 '23 21:02 anothermh

Please consider opening a pull request if you want that feature sooner.

ota-meshi avatar Feb 10 '23 01:02 ota-meshi

I've chosen instead to use your other package eslint-plugin-jsonc. I don't strictly require the schema validation and can work with just JSON validation.

Thank you for your continued development of your packages. Your plugins and parsers are high quality and provide a wonderful developer experience.

anothermh avatar Feb 12 '23 18:02 anothermh