@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.cjs
CHANGED
|
@@ -186,7 +186,7 @@ class Token {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
189
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
189
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/errors.ts.erb
|
|
190
190
|
class HerbError {
|
|
191
191
|
type;
|
|
192
192
|
message;
|
|
@@ -716,7 +716,7 @@ function convertToUTF8(string) {
|
|
|
716
716
|
}
|
|
717
717
|
|
|
718
718
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
719
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
719
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/nodes.ts.erb
|
|
720
720
|
class Node {
|
|
721
721
|
type;
|
|
722
722
|
location;
|
|
@@ -2950,7 +2950,7 @@ class ParseResult extends Result {
|
|
|
2950
2950
|
}
|
|
2951
2951
|
|
|
2952
2952
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2953
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
2953
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
2954
2954
|
/**
|
|
2955
2955
|
* Type guard functions for AST nodes.
|
|
2956
2956
|
* These functions provide type checking by combining both instanceof
|
|
@@ -3649,7 +3649,7 @@ function didyoumean(input, list, threshold) {
|
|
|
3649
3649
|
}
|
|
3650
3650
|
|
|
3651
3651
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3652
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3652
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.1/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3653
3653
|
class Visitor {
|
|
3654
3654
|
visit(node) {
|
|
3655
3655
|
if (!node)
|
|
@@ -6864,6 +6864,8 @@ function findAttributeByName(attributes, attributeName) {
|
|
|
6864
6864
|
* Checks if a tag has a specific attribute
|
|
6865
6865
|
*/
|
|
6866
6866
|
function hasAttribute(node, attributeName) {
|
|
6867
|
+
if (!node)
|
|
6868
|
+
return false;
|
|
6867
6869
|
return getAttribute(node, attributeName) !== null;
|
|
6868
6870
|
}
|
|
6869
6871
|
/**
|
|
@@ -8963,8 +8965,13 @@ class HeadOnlyElementsVisitor extends BaseRuleVisitor {
|
|
|
8963
8965
|
return;
|
|
8964
8966
|
if (tagName === "title" && this.insideSVG)
|
|
8965
8967
|
return;
|
|
8968
|
+
if (tagName === "meta" && this.hasItempropAttribute(node))
|
|
8969
|
+
return;
|
|
8966
8970
|
this.addOffense(`Element \`<${tagName}>\` must be placed inside the \`<head>\` tag.`, node.location);
|
|
8967
8971
|
}
|
|
8972
|
+
hasItempropAttribute(node) {
|
|
8973
|
+
return hasAttribute(node.open_tag, "itemprop");
|
|
8974
|
+
}
|
|
8968
8975
|
get insideHead() {
|
|
8969
8976
|
return this.elementStack.includes("head");
|
|
8970
8977
|
}
|