eslint-plugin-json-schema-validator
eslint-plugin-json-schema-validator copied to clipboard
feat: provide config options for schemastore cache
Would it be possible to provide options for json-schema-validator/no-invalid
:
-
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 telljson-schema-validator
to use that location. -
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.
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
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.
Please consider opening a pull request if you want that feature sooner.
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.