Validator fails on unhandled parse error when parsing invalid directive
When a directive fails to parse it throws an exception which isn't handled thus causing the validator to crash
Reduced test-case
<!-- [html-validate-disable-next foo -- bar -->
Configuration
N/A
Expected result
A regular parser error or a user exception.
Actual result
Internal error causing validator to crash on unhandled exception.
Validator crashed when parsing "test.html"
Caught exception:
Error: Missing end bracket "]" on directive "<!-- [html-validate-disable-next foo -- bar -->"
at Parser.consumeDirective (node_modules\html-validate\dist\cjs\core.js:11425:19)
at Parser.consume (node_modules\html-validate\dist\cjs\core.js:11164:22)
at Parser.parseHtml (node_modules\html-validate\dist\cjs\core.js:11100:18)
at Engine.lint (node_modules\html-validate\dist\cjs\core.js:11773:24)
at HtmlValidate.validateFile (node_modules\html-validate\dist\cjs\core.js:12164:23)
at node_modules\html-validate\dist\cjs\html-validate.js:94:33
at Array.map (<anonymous>)
at lint (node_modules\html-validate\dist\cjs\html-validate.js:92:27)
at Object.<anonymous> (node_modules\html-validate\dist\cjs\html-validate.js:286:24)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
This is a bug in html-validate-7.1.1.
Please file a bug at https://gitlab.com/html-validate/html-validate/issues/new?issuable_template=Bug
and include this message in full and if possible the content of the
file being parsed (or a reduced testcase).
Version
-
html-validate
: 7.1.1