@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/loader.js
CHANGED
|
@@ -165,7 +165,7 @@ class Token {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
168
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
168
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/errors.ts.erb
|
|
169
169
|
class HerbError {
|
|
170
170
|
type;
|
|
171
171
|
message;
|
|
@@ -695,7 +695,7 @@ function convertToUTF8(string) {
|
|
|
695
695
|
}
|
|
696
696
|
|
|
697
697
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
698
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
698
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/nodes.ts.erb
|
|
699
699
|
class Node {
|
|
700
700
|
type;
|
|
701
701
|
location;
|
|
@@ -2929,7 +2929,7 @@ class ParseResult extends Result {
|
|
|
2929
2929
|
}
|
|
2930
2930
|
|
|
2931
2931
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2932
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
2932
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
2933
2933
|
/**
|
|
2934
2934
|
* Type guard functions for AST nodes.
|
|
2935
2935
|
* These functions provide type checking by combining both instanceof
|
|
@@ -3628,7 +3628,7 @@ function didyoumean(input, list, threshold) {
|
|
|
3628
3628
|
}
|
|
3629
3629
|
|
|
3630
3630
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3631
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3631
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3632
3632
|
class Visitor {
|
|
3633
3633
|
visit(node) {
|
|
3634
3634
|
if (!node)
|
|
@@ -6843,6 +6843,8 @@ function findAttributeByName(attributes, attributeName) {
|
|
|
6843
6843
|
* Checks if a tag has a specific attribute
|
|
6844
6844
|
*/
|
|
6845
6845
|
function hasAttribute(node, attributeName) {
|
|
6846
|
+
if (!node)
|
|
6847
|
+
return false;
|
|
6846
6848
|
return getAttribute(node, attributeName) !== null;
|
|
6847
6849
|
}
|
|
6848
6850
|
/**
|
|
@@ -8942,8 +8944,13 @@ class HeadOnlyElementsVisitor extends BaseRuleVisitor {
|
|
|
8942
8944
|
return;
|
|
8943
8945
|
if (tagName === "title" && this.insideSVG)
|
|
8944
8946
|
return;
|
|
8947
|
+
if (tagName === "meta" && this.hasItempropAttribute(node))
|
|
8948
|
+
return;
|
|
8945
8949
|
this.addOffense(`Element \`<${tagName}>\` must be placed inside the \`<head>\` tag.`, node.location);
|
|
8946
8950
|
}
|
|
8951
|
+
hasItempropAttribute(node) {
|
|
8952
|
+
return hasAttribute(node.open_tag, "itemprop");
|
|
8953
|
+
}
|
|
8947
8954
|
get insideHead() {
|
|
8948
8955
|
return this.elementStack.includes("head");
|
|
8949
8956
|
}
|