@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.js
CHANGED
|
@@ -3053,6 +3053,8 @@ function findAttributeByName(attributes, attributeName) {
|
|
|
3053
3053
|
* Checks if a tag has a specific attribute
|
|
3054
3054
|
*/
|
|
3055
3055
|
function hasAttribute(node, attributeName) {
|
|
3056
|
+
if (!node)
|
|
3057
|
+
return false;
|
|
3056
3058
|
return getAttribute(node, attributeName) !== null;
|
|
3057
3059
|
}
|
|
3058
3060
|
/**
|
|
@@ -5152,8 +5154,13 @@ class HeadOnlyElementsVisitor extends BaseRuleVisitor {
|
|
|
5152
5154
|
return;
|
|
5153
5155
|
if (tagName === "title" && this.insideSVG)
|
|
5154
5156
|
return;
|
|
5157
|
+
if (tagName === "meta" && this.hasItempropAttribute(node))
|
|
5158
|
+
return;
|
|
5155
5159
|
this.addOffense(`Element \`<${tagName}>\` must be placed inside the \`<head>\` tag.`, node.location);
|
|
5156
5160
|
}
|
|
5161
|
+
hasItempropAttribute(node) {
|
|
5162
|
+
return hasAttribute(node.open_tag, "itemprop");
|
|
5163
|
+
}
|
|
5157
5164
|
get insideHead() {
|
|
5158
5165
|
return this.elementStack.includes("head");
|
|
5159
5166
|
}
|