Skip to content

Commit c972e1a

Browse files
committed
Install referenced schema in "eslint:validate" task
The "eslint:validate" task validates the repository's ESLint configuration file against its JSON schema to catch any problems with its data format. In order to avoid duplication of content, JSON schemas may reference other schemas via the `$ref` keyword. The ESLint configuration file schema was recently updated to share resources with a separate ESLint plugins configuration schema, which caused the validation to start failing: schema /tmp/eslintrc-schema-usLlcKrt8g.json is invalid error: can't resolve reference https://json.schemastore.org/partial-eslint-plugins.json from id https://json.schemastore.org/eslintrc.json# task: Failed to run task "eslint:validate": exit status 1 The solution is to configure the task to download that schema as well and also to provide its path to the avj-cli validator via a `-r` flag.
1 parent cc6f87c commit c972e1a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Taskfile.yml

+6
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ tasks:
397397
SCHEMA_URL: https://json.schemastore.org/eslintrc.json
398398
SCHEMA_PATH:
399399
sh: task utility:mktemp-file TEMPLATE="eslintrc-schema-XXXXXXXXXX.json"
400+
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/partial-eslint-plugins.json
401+
PARTIAL_ESLINT_PLUGINS_SCHEMA_URL: https://json.schemastore.org/partial-eslint-plugins.json
402+
PARTIAL_ESLINT_PLUGINS_PATH:
403+
sh: task utility:mktemp-file TEMPLATE="partial-eslint-plugins-schema-XXXXXXXXXX.json"
400404
DATA_PATH: workflow-templates/assets/check-javascript/.eslintrc.yml
401405
# ajv-cli identifies YAML-format data files by their file extension, so renaming is required:
402406
# https://github.com/ajv-validator/ajv-cli/issues/117
@@ -406,11 +410,13 @@ tasks:
406410
sh: task utility:mktemp-folder TEMPLATE="eslintrc-validate-XXXXXXXXXX"
407411
cmds:
408412
- wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}}
413+
- wget --quiet --output-document="{{.PARTIAL_ESLINT_PLUGINS_PATH}}" {{.PARTIAL_ESLINT_PLUGINS_SCHEMA_URL}}
409414
- |
410415
cd "{{.WORKING_FOLDER}}" # Workaround for https://github.com/npm/cli/issues/3210
411416
npx ajv-cli@{{.SCHEMA_DRAFT_4_AJV_CLI_VERSION}} validate \
412417
--all-errors \
413418
-s "{{.SCHEMA_PATH}}" \
419+
-r "{{.PARTIAL_ESLINT_PLUGINS_PATH}}" \
414420
-d "{{.PROJECT_FOLDER}}/{{.DATA_PATH}}"
415421
416422
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-files-task/Taskfile.yml

0 commit comments

Comments
 (0)