1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-14 01:32:11 +00:00
seirdy.one/linter-configs/vnu_filter.jq
Rohan Kumar 6c9a8a9b20
Run Nu HTML Checker with both HTML and XML parsers
Requires silencing an HTML-only error that isn't actually an error, but
a hint that doesn't apply to polygot markup (warns against trailing
slashes which aren't a problem if you always use quotes).
2023-11-25 13:32:55 -08:00

28 lines
1.2 KiB
Text

# Filter false positives from the .messages entry of Nu Validator output
.messages |= map(
. | select(
.type == "info" and (
.message == "Trailing slash on void elements has no effect and interacts badly with unquoted attribute values."
and (.url | test(".html"))
) or
.type == "error" and (
( # See https://github.com/validator/validator/issues/1166
# This false-positive has been fixed; will remove once validator.nu updates
# validator.w3.org/nu is up-to-date.
.message == "Attribute “media” not allowed on element “meta” at this point."
and (.extract | test(" name=\"theme-color\""))
) or
( # see https://github.com/w3c/css-validator/issues/369
.message == "CSS: “contain-intrinsic-size”: Property “contain-intrinsic-size” doesn't exist."
) or
( # see https://github.com/w3c/css-validator/issues/370
.message == "CSS: “contain”: “inline-size” is not a “contain” value."
) or
( # See https://github.com/w3c/css-validator/issues/361
.message == "CSS: Parse Error."
and .extract == "){outline:none}}@media(prefers"
and .hiliteLength == 1
)
) | not
)
) | del(..|select(. == [])) | del(..|select(. == {})) | select(. != null)