@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/browser.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, "\\$&");
|
|
@@ -926,6 +941,21 @@ var coreRules = [
|
|
|
926
941
|
}
|
|
927
942
|
return findings;
|
|
928
943
|
},
|
|
944
|
+
// unclosed_tag_swallowed_element
|
|
945
|
+
({ tags }) => {
|
|
946
|
+
const findings = [];
|
|
947
|
+
for (const tag of tags) {
|
|
948
|
+
if (!hasUnquotedLessThan(tag.attrs)) continue;
|
|
949
|
+
findings.push({
|
|
950
|
+
code: "unclosed_tag_swallowed_element",
|
|
951
|
+
severity: "error",
|
|
952
|
+
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.`,
|
|
953
|
+
fixHint: "Close the previous tag's `>` before opening the next element.",
|
|
954
|
+
snippet: truncateSnippet(tag.raw)
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
return findings;
|
|
958
|
+
},
|
|
929
959
|
// invalid_inline_script_syntax (malformed close tag)
|
|
930
960
|
({ source }) => {
|
|
931
961
|
if (!INVALID_SCRIPT_CLOSE_PATTERN.test(source)) return [];
|