@herb-tools/linter 0.8.0 → 0.8.1
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/README.md +2 -2
- package/dist/herb-lint.js +20 -13
- package/dist/herb-lint.js.map +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/loader.cjs +11 -4
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.js +11 -4
- package/dist/loader.js.map +1 -1
- package/dist/package.json +7 -7
- package/dist/src/rules/html-head-only-elements.js +6 -1
- package/dist/src/rules/html-head-only-elements.js.map +1 -1
- package/dist/src/rules/rule-utils.js +2 -0
- package/dist/src/rules/rule-utils.js.map +1 -1
- package/dist/types/rules/rule-utils.d.ts +1 -1
- package/dist/types/src/rules/rule-utils.d.ts +1 -1
- package/docs/rules/html-head-only-elements.md +24 -2
- package/package.json +7 -7
- package/src/rules/html-head-only-elements.ts +6 -1
- package/src/rules/rule-utils.ts +3 -1
package/dist/index.cjs
CHANGED
|
@@ -3055,6 +3055,8 @@ function findAttributeByName(attributes, attributeName) {
|
|
|
3055
3055
|
* Checks if a tag has a specific attribute
|
|
3056
3056
|
*/
|
|
3057
3057
|
function hasAttribute(node, attributeName) {
|
|
3058
|
+
if (!node)
|
|
3059
|
+
return false;
|
|
3058
3060
|
return getAttribute(node, attributeName) !== null;
|
|
3059
3061
|
}
|
|
3060
3062
|
/**
|
|
@@ -5154,8 +5156,13 @@ class HeadOnlyElementsVisitor extends BaseRuleVisitor {
|
|
|
5154
5156
|
return;
|
|
5155
5157
|
if (tagName === "title" && this.insideSVG)
|
|
5156
5158
|
return;
|
|
5159
|
+
if (tagName === "meta" && this.hasItempropAttribute(node))
|
|
5160
|
+
return;
|
|
5157
5161
|
this.addOffense(`Element \`<${tagName}>\` must be placed inside the \`<head>\` tag.`, node.location);
|
|
5158
5162
|
}
|
|
5163
|
+
hasItempropAttribute(node) {
|
|
5164
|
+
return hasAttribute(node.open_tag, "itemprop");
|
|
5165
|
+
}
|
|
5159
5166
|
get insideHead() {
|
|
5160
5167
|
return this.elementStack.includes("head");
|
|
5161
5168
|
}
|