diff --git a/README.md b/README.md index 6c7cc4b..b09657e 100644 --- a/README.md +++ b/README.md @@ -68,12 +68,15 @@ npm install --save-dev html-w3c-validator start-server-and-test ```json { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/main/schema/html-w3c-validatorrc-schema.json", + + // URLs to validate. "urls": ["http://127.0.0.1:3000/", "http://127.0.0.1:3000/about"], - // You can also specify HTML files instead of URLs + // Files to validate. "files": ["./index.html", "./about.html"], - // Specify the severities of the validator (default: ["warning", "error"]) + // Specify the severities of the validator messages to report. (default: ["warning", "error"]) "severities": ["info", "warning", "error"] } ``` diff --git a/example/.html-w3c-validatorrc.json b/example/.html-w3c-validatorrc.json index 17ac9ce..1568aa3 100644 --- a/example/.html-w3c-validatorrc.json +++ b/example/.html-w3c-validatorrc.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "urls": ["http://127.0.0.1:3000/", "http://127.0.0.1:3000/about"], "files": ["./build/index.html", "./build/about.html"] } diff --git a/schema/html-w3c-validatorrc-schema.json b/schema/html-w3c-validatorrc-schema.json new file mode 100644 index 0000000..15f7394 --- /dev/null +++ b/schema/html-w3c-validatorrc-schema.json @@ -0,0 +1,47 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/main/schema/html-w3c-validatorrc-schema.json", + "title": "html-w3c-validator configuration schema", + "type": "object", + "properties": { + "$schema": { + "description": "JSON Schema URI", + "type": "string", + "default": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/main/schema/html-w3c-validatorrc-schema.json" + }, + "urls": { + "description": "URLs to validate.", + "type": "array", + "default": [], + "minItems": 1, + "items": { + "description": "URL to validate.", + "type": "string", + "minLength": 1 + } + }, + "files": { + "description": "Files to validate.", + "type": "array", + "minItems": 1, + "default": [], + "items": { + "description": "File to validate.", + "type": "string", + "minLength": 1 + } + }, + "severities": { + "description": "Specify the severities of the validator messages to report.", + "type": "array", + "minItems": 1, + "default": ["warning", "error"], + "items": { + "description": "Severity to report.", + "type": "string", + "enum": ["error", "warning", "info"] + } + } + }, + "additionalProperties": false +} diff --git a/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json index bc3240a..2473aa3 100644 --- a/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "urls": [], "files": [] } diff --git a/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json index 4895148..ff4f33c 100644 --- a/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json @@ -1,3 +1,4 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "files": "Invalid" } diff --git a/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json index 698033e..119db2b 100644 --- a/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "files": ["./index.html"], "severities": [] } diff --git a/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json index 4d31b58..309f6fb 100644 --- a/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "files": ["./index.html"], "severities": ["errors-invalid"] } diff --git a/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json index ae90f38..9354c6b 100644 --- a/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json @@ -1,3 +1,4 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "urls": "Invalid" } diff --git a/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json index 9e21d03..4dcd737 100644 --- a/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json @@ -1,3 +1,4 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "files": ["./index.html"] } diff --git a/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json index a4a2392..4d035b7 100644 --- a/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json @@ -1,3 +1,4 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "files": ["./build/index.html", "./build/about.html"] } diff --git a/src/__test__/fixtures/success/.html-w3c-validatorrc.json b/src/__test__/fixtures/success/.html-w3c-validatorrc.json index a4a2392..4d035b7 100644 --- a/src/__test__/fixtures/success/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/success/.html-w3c-validatorrc.json @@ -1,3 +1,4 @@ { + "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", "files": ["./build/index.html", "./build/about.html"] }