@hyperframes/lint 0.8.34 → 0.8.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +30 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -75,6 +75,21 @@ function findRootTag(source, parsedTags) {
|
|
|
75
75
|
}
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
|
+
function hasUnquotedLessThan(attrs) {
|
|
79
|
+
let quote = null;
|
|
80
|
+
for (const ch of attrs) {
|
|
81
|
+
if (quote) {
|
|
82
|
+
if (ch === quote) quote = null;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (ch === '"' || ch === "'") {
|
|
86
|
+
quote = ch;
|
|
87
|
+
} else if (ch === "<") {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
78
93
|
function readAttr(tagSource, attr) {
|
|
79
94
|
if (!tagSource) return null;
|
|
80
95
|
const escaped = attr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -929,6 +944,21 @@ var coreRules = [
|
|
|
929
944
|
}
|
|
930
945
|
return findings;
|
|
931
946
|
},
|
|
947
|
+
// unclosed_tag_swallowed_element
|
|
948
|
+
({ tags }) => {
|
|
949
|
+
const findings = [];
|
|
950
|
+
for (const tag of tags) {
|
|
951
|
+
if (!hasUnquotedLessThan(tag.attrs)) continue;
|
|
952
|
+
findings.push({
|
|
953
|
+
code: "unclosed_tag_swallowed_element",
|
|
954
|
+
severity: "error",
|
|
955
|
+
message: `<${tag.name}> is missing its closing \`>\` before the next \`<\` \u2014 the following element is swallowed as bogus attribute text and never becomes a real node.`,
|
|
956
|
+
fixHint: "Close the previous tag's `>` before opening the next element.",
|
|
957
|
+
snippet: truncateSnippet(tag.raw)
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
return findings;
|
|
961
|
+
},
|
|
932
962
|
// invalid_inline_script_syntax (malformed close tag)
|
|
933
963
|
({ source }) => {
|
|
934
964
|
if (!INVALID_SCRIPT_CLOSE_PATTERN.test(source)) return [];
|