@html-eslint/eslint-plugin 0.31.1 → 0.32.0

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.
Files changed (129) hide show
  1. package/lib/rules/attrs-newline.js +3 -5
  2. package/lib/rules/element-newline.js +11 -9
  3. package/lib/rules/id-naming-convention.js +5 -5
  4. package/lib/rules/indent/indent.js +119 -69
  5. package/lib/rules/index.js +12 -0
  6. package/lib/rules/lowercase.js +7 -8
  7. package/lib/rules/no-abstract-roles.js +4 -4
  8. package/lib/rules/no-accesskey-attrs.js +4 -4
  9. package/lib/rules/no-duplicate-attrs.js +4 -4
  10. package/lib/rules/no-duplicate-id.js +7 -7
  11. package/lib/rules/no-extra-spacing-attrs.js +14 -14
  12. package/lib/rules/no-extra-spacing-text.js +9 -10
  13. package/lib/rules/no-heading-inside-button.js +54 -0
  14. package/lib/rules/no-inline-styles.js +0 -1
  15. package/lib/rules/no-invalid-role.js +287 -0
  16. package/lib/rules/no-multiple-empty-lines.js +5 -5
  17. package/lib/rules/no-multiple-h1.js +2 -2
  18. package/lib/rules/no-nested-interactive.js +120 -0
  19. package/lib/rules/no-positive-tabindex.js +4 -4
  20. package/lib/rules/no-restricted-attr-values.js +6 -6
  21. package/lib/rules/no-restricted-attrs.js +6 -6
  22. package/lib/rules/no-script-style-type.js +4 -4
  23. package/lib/rules/no-skip-heading-levels.js +2 -2
  24. package/lib/rules/no-trailing-spaces.js +3 -3
  25. package/lib/rules/prefer-https.js +106 -0
  26. package/lib/rules/quotes.js +8 -8
  27. package/lib/rules/require-attrs.js +14 -6
  28. package/lib/rules/require-closing-tags.js +4 -4
  29. package/lib/rules/require-form-method.js +81 -0
  30. package/lib/rules/require-img-alt.js +2 -3
  31. package/lib/rules/require-input-label.js +77 -0
  32. package/lib/rules/require-meta-charset.js +3 -3
  33. package/lib/rules/require-meta-description.js +3 -3
  34. package/lib/rules/require-meta-viewport.js +3 -3
  35. package/lib/rules/require-open-graph-protocol.js +3 -3
  36. package/lib/rules/require-title.js +5 -5
  37. package/lib/rules/sort-attrs.js +12 -12
  38. package/lib/rules/utils/node.js +72 -32
  39. package/lib/rules/utils/settings.js +2 -2
  40. package/lib/rules/utils/visitors.js +1 -1
  41. package/lib/types/ast.d.ts +204 -0
  42. package/lib/types/index.d.ts +3 -0
  43. package/lib/types/rule.d.ts +83 -0
  44. package/lib/types/settings.ts +13 -0
  45. package/package.json +4 -4
  46. package/types/rules/attrs-newline.d.ts +2 -3
  47. package/types/rules/attrs-newline.d.ts.map +1 -1
  48. package/types/rules/element-newline.d.ts +8 -9
  49. package/types/rules/element-newline.d.ts.map +1 -1
  50. package/types/rules/id-naming-convention.d.ts +4 -4
  51. package/types/rules/id-naming-convention.d.ts.map +1 -1
  52. package/types/rules/indent/indent.d.ts +12 -5
  53. package/types/rules/indent/indent.d.ts.map +1 -1
  54. package/types/rules/index.d.ts +6 -0
  55. package/types/rules/lowercase.d.ts +4 -5
  56. package/types/rules/lowercase.d.ts.map +1 -1
  57. package/types/rules/no-abstract-roles.d.ts +4 -4
  58. package/types/rules/no-abstract-roles.d.ts.map +1 -1
  59. package/types/rules/no-accesskey-attrs.d.ts +4 -4
  60. package/types/rules/no-accesskey-attrs.d.ts.map +1 -1
  61. package/types/rules/no-duplicate-attrs.d.ts +4 -4
  62. package/types/rules/no-duplicate-attrs.d.ts.map +1 -1
  63. package/types/rules/no-duplicate-id.d.ts +5 -5
  64. package/types/rules/no-duplicate-id.d.ts.map +1 -1
  65. package/types/rules/no-extra-spacing-attrs.d.ts +11 -11
  66. package/types/rules/no-extra-spacing-attrs.d.ts.map +1 -1
  67. package/types/rules/no-extra-spacing-text.d.ts +7 -8
  68. package/types/rules/no-extra-spacing-text.d.ts.map +1 -1
  69. package/types/rules/no-heading-inside-button.d.ts +7 -0
  70. package/types/rules/no-heading-inside-button.d.ts.map +1 -0
  71. package/types/rules/no-inline-styles.d.ts +1 -2
  72. package/types/rules/no-inline-styles.d.ts.map +1 -1
  73. package/types/rules/no-invalid-role.d.ts +7 -0
  74. package/types/rules/no-invalid-role.d.ts.map +1 -0
  75. package/types/rules/no-multiple-empty-lines.d.ts +5 -5
  76. package/types/rules/no-multiple-empty-lines.d.ts.map +1 -1
  77. package/types/rules/no-multiple-h1.d.ts +2 -2
  78. package/types/rules/no-multiple-h1.d.ts.map +1 -1
  79. package/types/rules/no-nested-interactive.d.ts +8 -0
  80. package/types/rules/no-nested-interactive.d.ts.map +1 -0
  81. package/types/rules/no-positive-tabindex.d.ts +4 -4
  82. package/types/rules/no-positive-tabindex.d.ts.map +1 -1
  83. package/types/rules/no-restricted-attr-values.d.ts +5 -5
  84. package/types/rules/no-restricted-attr-values.d.ts.map +1 -1
  85. package/types/rules/no-restricted-attrs.d.ts +5 -5
  86. package/types/rules/no-restricted-attrs.d.ts.map +1 -1
  87. package/types/rules/no-script-style-type.d.ts +4 -4
  88. package/types/rules/no-script-style-type.d.ts.map +1 -1
  89. package/types/rules/no-skip-heading-levels.d.ts +2 -2
  90. package/types/rules/no-skip-heading-levels.d.ts.map +1 -1
  91. package/types/rules/no-trailing-spaces.d.ts +3 -3
  92. package/types/rules/no-trailing-spaces.d.ts.map +1 -1
  93. package/types/rules/prefer-https.d.ts +11 -0
  94. package/types/rules/prefer-https.d.ts.map +1 -0
  95. package/types/rules/quotes.d.ts +6 -6
  96. package/types/rules/quotes.d.ts.map +1 -1
  97. package/types/rules/require-attrs.d.ts +9 -4
  98. package/types/rules/require-attrs.d.ts.map +1 -1
  99. package/types/rules/require-closing-tags.d.ts +2 -2
  100. package/types/rules/require-closing-tags.d.ts.map +1 -1
  101. package/types/rules/require-form-method.d.ts +7 -0
  102. package/types/rules/require-form-method.d.ts.map +1 -0
  103. package/types/rules/require-img-alt.d.ts +2 -2
  104. package/types/rules/require-img-alt.d.ts.map +1 -1
  105. package/types/rules/require-input-label.d.ts +8 -0
  106. package/types/rules/require-input-label.d.ts.map +1 -0
  107. package/types/rules/require-meta-charset.d.ts +3 -3
  108. package/types/rules/require-meta-charset.d.ts.map +1 -1
  109. package/types/rules/require-meta-description.d.ts +3 -3
  110. package/types/rules/require-meta-description.d.ts.map +1 -1
  111. package/types/rules/require-meta-viewport.d.ts +3 -3
  112. package/types/rules/require-meta-viewport.d.ts.map +1 -1
  113. package/types/rules/require-open-graph-protocol.d.ts +3 -3
  114. package/types/rules/require-open-graph-protocol.d.ts.map +1 -1
  115. package/types/rules/require-title.d.ts +4 -4
  116. package/types/rules/require-title.d.ts.map +1 -1
  117. package/types/rules/sort-attrs.d.ts +4 -4
  118. package/types/rules/sort-attrs.d.ts.map +1 -1
  119. package/types/rules/utils/node.d.ts +56 -37
  120. package/types/rules/utils/node.d.ts.map +1 -1
  121. package/types/rules/utils/settings.d.ts +2 -2
  122. package/types/rules/utils/settings.d.ts.map +1 -1
  123. package/types/rules/utils/source-code.d.ts +1 -1
  124. package/types/rules/utils/source-code.d.ts.map +1 -1
  125. package/types/rules/utils/visitors.d.ts +1 -1
  126. package/types/rules/utils/visitors.d.ts.map +1 -1
  127. package/types/types/settings.d.ts +13 -0
  128. package/types/types/settings.d.ts.map +1 -0
  129. package/lib/types.d.ts +0 -289
@@ -0,0 +1 @@
1
+ {"version":3,"file":"require-input-label.d.ts","sourceRoot":"","sources":["../../lib/rules/require-input-label.js"],"names":[],"mappings":";;;wBAkBU,UAAU;;kBAjBN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG"}
@@ -1,9 +1,9 @@
1
1
  declare namespace _exports {
2
- export { RuleModule, TagNode, AnyNode };
2
+ export { RuleModule, Tag, AnyNode };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
6
6
  type RuleModule = import("../types").RuleModule;
7
- type TagNode = import("es-html-parser").TagNode;
8
- type AnyNode = import("es-html-parser").AnyNode;
7
+ type Tag = import("../types").Tag;
8
+ type AnyNode = import("../types").AnyNode;
9
9
  //# sourceMappingURL=require-meta-charset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"require-meta-charset.d.ts","sourceRoot":"","sources":["../../lib/rules/require-meta-charset.js"],"names":[],"mappings":";;;wBAwBU,UAAU;;kBAvBN,OAAO,UAAU,EAAE,UAAU;eAC7B,OAAO,gBAAgB,EAAE,OAAO;eAChC,OAAO,gBAAgB,EAAE,OAAO"}
1
+ {"version":3,"file":"require-meta-charset.d.ts","sourceRoot":"","sources":["../../lib/rules/require-meta-charset.js"],"names":[],"mappings":";;;wBAwBU,UAAU;;kBAvBN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;eACtB,OAAO,UAAU,EAAE,OAAO"}
@@ -1,9 +1,9 @@
1
1
  declare namespace _exports {
2
- export { RuleModule, TagNode, AnyNode };
2
+ export { RuleModule, Tag, AnyNode };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
6
6
  type RuleModule = import("../types").RuleModule;
7
- type TagNode = import("es-html-parser").TagNode;
8
- type AnyNode = import("es-html-parser").AnyNode;
7
+ type Tag = import("../types").Tag;
8
+ type AnyNode = import("../types").AnyNode;
9
9
  //# sourceMappingURL=require-meta-description.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"require-meta-description.d.ts","sourceRoot":"","sources":["../../lib/rules/require-meta-description.js"],"names":[],"mappings":";;;wBAuBU,UAAU;;kBAtBN,OAAO,UAAU,EAAE,UAAU;eAC7B,OAAO,gBAAgB,EAAE,OAAO;eAChC,OAAO,gBAAgB,EAAE,OAAO"}
1
+ {"version":3,"file":"require-meta-description.d.ts","sourceRoot":"","sources":["../../lib/rules/require-meta-description.js"],"names":[],"mappings":";;;wBAuBU,UAAU;;kBAtBN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;eACtB,OAAO,UAAU,EAAE,OAAO"}
@@ -1,9 +1,9 @@
1
1
  declare namespace _exports {
2
- export { RuleModule, TagNode, AnyNode };
2
+ export { RuleModule, Tag, AnyNode };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
6
6
  type RuleModule = import("../types").RuleModule;
7
- type TagNode = import("es-html-parser").TagNode;
8
- type AnyNode = import("es-html-parser").AnyNode;
7
+ type Tag = import("../types").Tag;
8
+ type AnyNode = import("../types").AnyNode;
9
9
  //# sourceMappingURL=require-meta-viewport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"require-meta-viewport.d.ts","sourceRoot":"","sources":["../../lib/rules/require-meta-viewport.js"],"names":[],"mappings":";;;wBAgCU,UAAU;;kBA/BN,OAAO,UAAU,EAAE,UAAU;eAC7B,OAAO,gBAAgB,EAAE,OAAO;eAChC,OAAO,gBAAgB,EAAE,OAAO"}
1
+ {"version":3,"file":"require-meta-viewport.d.ts","sourceRoot":"","sources":["../../lib/rules/require-meta-viewport.js"],"names":[],"mappings":";;;wBAgCU,UAAU;;kBA/BN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;eACtB,OAAO,UAAU,EAAE,OAAO"}
@@ -1,9 +1,9 @@
1
1
  declare namespace _exports {
2
- export { RuleModule, TagNode, AnyNode };
2
+ export { RuleModule, Tag, AnyNode };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
6
6
  type RuleModule = import("../types").RuleModule;
7
- type TagNode = import("es-html-parser").TagNode;
8
- type AnyNode = import("es-html-parser").AnyNode;
7
+ type Tag = import("../types").Tag;
8
+ type AnyNode = import("../types").AnyNode;
9
9
  //# sourceMappingURL=require-open-graph-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"require-open-graph-protocol.d.ts","sourceRoot":"","sources":["../../lib/rules/require-open-graph-protocol.js"],"names":[],"mappings":";;;wBAkCU,UAAU;;kBAjCN,OAAO,UAAU,EAAE,UAAU;eAC7B,OAAO,gBAAgB,EAAE,OAAO;eAC/B,OAAO,gBAAgB,EAAE,OAAO"}
1
+ {"version":3,"file":"require-open-graph-protocol.d.ts","sourceRoot":"","sources":["../../lib/rules/require-open-graph-protocol.js"],"names":[],"mappings":";;;wBAkCU,UAAU;;kBAjCN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;eACrB,OAAO,UAAU,EAAE,OAAO"}
@@ -1,10 +1,10 @@
1
1
  declare namespace _exports {
2
- export { RuleModule, TagNode, TextNode, AnyNode };
2
+ export { RuleModule, Tag, Text, AnyNode };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
6
6
  type RuleModule = import("../types").RuleModule;
7
- type TagNode = import("es-html-parser").TagNode;
8
- type TextNode = import("es-html-parser").TextNode;
9
- type AnyNode = import("es-html-parser").AnyNode;
7
+ type Tag = import("../types").Tag;
8
+ type Text = import("../types").Text;
9
+ type AnyNode = import("../types").AnyNode;
10
10
  //# sourceMappingURL=require-title.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"require-title.d.ts","sourceRoot":"","sources":["../../lib/rules/require-title.js"],"names":[],"mappings":";;;wBAiCU,UAAU;;kBAhCN,OAAO,UAAU,EAAE,UAAU;eAC7B,OAAO,gBAAgB,EAAE,OAAO;gBAChC,OAAO,gBAAgB,EAAE,QAAQ;eACjC,OAAO,gBAAgB,EAAE,OAAO"}
1
+ {"version":3,"file":"require-title.d.ts","sourceRoot":"","sources":["../../lib/rules/require-title.js"],"names":[],"mappings":";;;wBAiCU,UAAU;;kBAhCN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;YACtB,OAAO,UAAU,EAAE,IAAI;eACvB,OAAO,UAAU,EAAE,OAAO"}
@@ -1,10 +1,10 @@
1
1
  declare namespace _exports {
2
- export { RuleModule, AttributeNode, TextNode, RuleFixer };
2
+ export { RuleFixer, RuleModule, Attribute, Text };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
6
+ type RuleFixer = import("eslint").Rule.RuleFixer;
6
7
  type RuleModule = import("../types").RuleModule;
7
- type AttributeNode = import("../types").AttributeNode;
8
- type TextNode = import("../types").TextNode;
9
- type RuleFixer = import("../types").RuleFixer;
8
+ type Attribute = import("../types").Attribute;
9
+ type Text = import("../types").Text;
10
10
  //# sourceMappingURL=sort-attrs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sort-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/sort-attrs.js"],"names":[],"mappings":";;;wBAgBU,UAAU;;kBAfN,OAAO,UAAU,EAAE,UAAU;qBAC7B,OAAO,UAAU,EAAE,aAAa;gBAChC,OAAO,UAAU,EAAE,QAAQ;iBAC3B,OAAO,UAAU,EAAE,SAAS"}
1
+ {"version":3,"file":"sort-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/sort-attrs.js"],"names":[],"mappings":";;;wBAgBU,UAAU;;iBAfN,OAAO,QAAQ,EAAE,IAAI,CAAC,SAAS;kBAC/B,OAAO,UAAU,EAAE,UAAU;iBAC7B,OAAO,UAAU,EAAE,SAAS;YAC5B,OAAO,UAAU,EAAE,IAAI"}
@@ -1,29 +1,28 @@
1
- export type TagNode = import("es-html-parser").TagNode;
2
- export type ScriptTagNode = import("es-html-parser").ScriptTagNode;
3
- export type StyleTagNode = import("es-html-parser").StyleTagNode;
4
- export type AttributeNode = import("es-html-parser").AttributeNode;
5
- export type AttributeValueNode = import("es-html-parser").AttributeValueNode;
6
- export type AnyNode = import("es-html-parser").AnyNode;
7
- export type TextNode = import("es-html-parser").TextNode;
8
- export type CommentContentNode = import("es-html-parser").CommentContentNode;
9
- export type CommentNode = import("es-html-parser").CommentNode;
1
+ export type Attribute = import("../../types").Attribute;
2
+ export type Tag = import("../../types").Tag;
3
+ export type ScriptTag = import("../../types").ScriptTag;
4
+ export type StyleTag = import("../../types").StyleTag;
5
+ export type Line = import("../../types").Line;
6
+ export type Text = import("../../types").Text;
7
+ export type CommentContent = import("../../types").CommentContent;
8
+ export type Comment = import("../../types").Comment;
9
+ export type AnyNode = import("../../types").AnyNode;
10
+ export type AttributeValue = import("../../types").AttributeValue;
11
+ export type Range = import("eslint").AST.Range;
12
+ export type SourceLocation = import("eslint").AST.SourceLocation;
10
13
  export type AnyToken = import("es-html-parser").AnyToken;
11
- export type LineNode = import("../../types").LineNode;
12
- export type BaseNode = import("../../types").BaseNode;
13
- export type Location = import("../../types").Location;
14
- export type Range = import("../../types").Range;
15
14
  /**
16
- * @param {TagNode | ScriptTagNode | StyleTagNode} node
15
+ * @param {Tag | ScriptTag | StyleTag} node
17
16
  * @param {string} key
18
- * @returns {AttributeNode | undefined}
17
+ * @returns {Attribute | undefined}
19
18
  */
20
- export function findAttr(node: TagNode | ScriptTagNode | StyleTagNode, key: string): AttributeNode | undefined;
19
+ export function findAttr(node: Tag | ScriptTag | StyleTag, key: string): Attribute | undefined;
21
20
  /**
22
21
  * Checks whether a node's attributes is empty or not.
23
- * @param {TagNode | ScriptTagNode | StyleTagNode} node
22
+ * @param {Tag | ScriptTag | StyleTag} node
24
23
  * @returns {boolean}
25
24
  */
26
- export function isAttributesEmpty(node: TagNode | ScriptTagNode | StyleTagNode): boolean;
25
+ export function isAttributesEmpty(node: Tag | ScriptTag | StyleTag): boolean;
27
26
  /**
28
27
  * Checks whether a node's all tokens are on the same line or not.
29
28
  * @param {AnyNode} node A node to check
@@ -32,43 +31,63 @@ export function isAttributesEmpty(node: TagNode | ScriptTagNode | StyleTagNode):
32
31
  export function isNodeTokensOnSameLine(node: AnyNode): boolean;
33
32
  /**
34
33
  *
35
- * @param {TextNode | CommentContentNode} node
36
- * @returns {LineNode[]}
34
+ * @param {Text | CommentContent} node
35
+ * @returns {Line[]}
37
36
  */
38
- export function splitToLineNodes(node: TextNode | CommentContentNode): LineNode[];
37
+ export function splitToLineNodes(node: Text | CommentContent): Line[];
39
38
  /**
40
39
  * Get location between two nodes.
41
- * @param {BaseNode} before A node placed in before
42
- * @param {BaseNode} after A node placed in after
43
- * @returns {Location} location between two nodes.
40
+ * @param {{loc: SourceLocation}} before A node placed in before
41
+ * @param {{loc: SourceLocation}} after A node placed in after
42
+ * @returns {SourceLocation} location between two nodes.
44
43
  */
45
- export function getLocBetween(before: BaseNode, after: BaseNode): Location;
44
+ export function getLocBetween(before: {
45
+ loc: SourceLocation;
46
+ }, after: {
47
+ loc: SourceLocation;
48
+ }): SourceLocation;
46
49
  /**
47
- * @param {AttributeValueNode} node
50
+ * @param {Exclude<AnyNode, Line>} node
51
+ * @param {(node: AnyNode) => boolean} predicate
52
+ * @returns {null | AnyNode}
53
+ */
54
+ export function findParent(node: Exclude<AnyNode, Line>, predicate: (node: AnyNode) => boolean): null | AnyNode;
55
+ /**
56
+ * @param {AttributeValue} node
48
57
  * @return {boolean}
49
58
  */
50
- export function isExpressionInTemplate(node: AttributeValueNode): boolean;
59
+ export function isExpressionInTemplate(node: AttributeValue): boolean;
51
60
  /**
52
61
  * @param {AnyNode} node
53
- * @returns {node is TagNode}
62
+ * @returns {node is Tag}
54
63
  */
55
- export function isTag(node: AnyNode): node is TagNode;
64
+ export function isTag(node: AnyNode): node is Tag;
56
65
  /**
57
66
  * @param {AnyNode} node
58
- * @returns {node is CommentNode}
67
+ * @returns {node is Comment}
68
+ */
69
+ export function isComment(node: AnyNode): node is Comment;
70
+ /**
71
+ * @param {AnyNode} node
72
+ * @returns {node is Text}
73
+ */
74
+ export function isText(node: AnyNode): node is Text;
75
+ /**
76
+ * @param {AnyNode | Line} node
77
+ * @returns {node is Line}
59
78
  */
60
- export function isComment(node: AnyNode): node is CommentNode;
79
+ export function isLine(node: AnyNode | Line): node is Line;
61
80
  /**
62
81
  * @param {AnyNode} node
63
- * @returns {node is TextNode}
82
+ * @returns {node is ScriptTag}
64
83
  */
65
- export function isText(node: AnyNode): node is TextNode;
84
+ export function isScript(node: AnyNode): node is ScriptTag;
66
85
  /**
67
- * @param {(TextNode | CommentContentNode)['templates']} templates
86
+ * @param {(Text | CommentContent)['templates']} templates
68
87
  * @param {Range} range
69
88
  * @returns {boolean}
70
89
  */
71
- export function isOverlapWithTemplates(templates: (TextNode | CommentContentNode)["templates"], range: Range): boolean;
90
+ export function isOverlapWithTemplates(templates: (Text | CommentContent)["templates"], range: Range): boolean;
72
91
  /**
73
92
  * @param {string} source
74
93
  * @returns {string[]}
@@ -84,7 +103,7 @@ export function isRangesOverlap(rangeA: Range, rangeB: Range): boolean;
84
103
  /**
85
104
  *
86
105
  * @param {AnyToken[]} tokens
87
- * @returns {((CommentContentNode | TextNode)['templates'][number])[]}
106
+ * @returns {((CommentContent | Text)['templates'][number])[]}
88
107
  */
89
- export function getTemplateTokens(tokens: AnyToken[]): ((CommentContentNode | TextNode)["templates"][number])[];
108
+ export function getTemplateTokens(tokens: AnyToken[]): ((CommentContent | Text)["templates"][number])[];
90
109
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/node.js"],"names":[],"mappings":"sBACc,OAAO,gBAAgB,EAAE,OAAO;4BAChC,OAAO,gBAAgB,EAAE,aAAa;2BACtC,OAAO,gBAAgB,EAAE,YAAY;4BACrC,OAAO,gBAAgB,EAAE,aAAa;iCACtC,OAAO,gBAAgB,EAAE,kBAAkB;sBAC3C,OAAO,gBAAgB,EAAE,OAAO;uBAChC,OAAO,gBAAgB,EAAE,QAAQ;iCACjC,OAAO,gBAAgB,EAAE,kBAAkB;0BAC3C,OAAO,gBAAgB,EAAE,WAAW;uBACpC,OAAO,gBAAgB,EAAE,QAAQ;uBACjC,OAAO,aAAa,EAAE,QAAQ;uBAC9B,OAAO,aAAa,EAAE,QAAQ;uBAC9B,OAAO,aAAa,EAAE,QAAQ;oBAC9B,OAAO,aAAa,EAAE,KAAK;AAKzC;;;;GAIG;AACH,+BAJW,OAAO,GAAG,aAAa,GAAG,YAAY,OACtC,MAAM,GACJ,aAAa,GAAG,SAAS,CAMrC;AAED;;;;GAIG;AACH,wCAHW,OAAO,GAAG,aAAa,GAAG,YAAY,GACpC,OAAO,CAInB;AAED;;;;GAIG;AACH,6CAHW,OAAO,GACL,OAAO,CAInB;AA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IG;AACH,0CAHW,QAAQ,EAAE,GACR,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAa5D"}
@@ -1,8 +1,8 @@
1
1
  export type MaybeHTMLSettings = import("../../types").MaybeHTMLSettings;
2
2
  export type HTMLSettings = import("../../types").HTMLSettings;
3
3
  export type Context = import("../../types").Context;
4
- export type TaggedTemplateExpression = import("estree").TaggedTemplateExpression;
5
- export type TemplateLiteral = import("estree").TemplateLiteral;
4
+ export type TaggedTemplateExpression = import("../../types").TaggedTemplateExpression;
5
+ export type TemplateLiteral = import("../../types").TemplateLiteral;
6
6
  /**
7
7
  *
8
8
  * @param {TemplateLiteral} node
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/settings.js"],"names":[],"mappings":"gCACa,OAAO,aAAa,EAAE,iBAAiB;2BACvC,OAAO,aAAa,EAAE,YAAY;sBAClC,OAAO,aAAa,EAAE,OAAO;uCAC7B,OAAO,QAAQ,EAAE,wBAAwB;8BACzC,OAAO,QAAQ,EAAE,eAAe;AA8D7C;;;;;GAKG;AACH,iDAJW,eAAe,WACf,OAAO,GACL,OAAO,CAWnB;AA7BD;;;;GAIG;AACH,0DAJW,wBAAwB,WACxB,OAAO,GACL,OAAO,CASnB"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/settings.js"],"names":[],"mappings":"gCACa,OAAO,aAAa,EAAE,iBAAiB;2BACvC,OAAO,aAAa,EAAE,YAAY;sBAClC,OAAO,aAAa,EAAE,OAAO;uCAC7B,OAAO,aAAa,EAAE,wBAAwB;8BAC9C,OAAO,aAAa,EAAE,eAAe;AA8DlD;;;;;GAKG;AACH,iDAJW,eAAe,WACf,OAAO,GACL,OAAO,CAWnB;AA7BD;;;;GAIG;AACH,0DAJW,wBAAwB,WACxB,OAAO,GACL,OAAO,CASnB"}
@@ -5,5 +5,5 @@ export type Context = import("../../types").Context;
5
5
  /**
6
6
  * @param {Context} context
7
7
  */
8
- export function getSourceCode(context: Context): import("eslint").SourceCode;
8
+ export function getSourceCode(context: Context): any;
9
9
  //# sourceMappingURL=source-code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-code.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/source-code.js"],"names":[],"mappings":"sBACa,OAAO,aAAa,EAAE,OAAO;AAD1C;;GAEG;AAEH;;GAEG;AACH,uCAFW,OAAO,+BAIjB"}
1
+ {"version":3,"file":"source-code.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/source-code.js"],"names":[],"mappings":"sBACa,OAAO,aAAa,EAAE,OAAO;AAD1C;;GAEG;AAEH;;GAEG;AACH,uCAFW,OAAO,OAIjB"}
@@ -1,5 +1,5 @@
1
- export type RuleListener = import("../../types").RuleListener;
2
1
  export type Context = import("../../types").Context;
2
+ export type RuleListener = import("../../types").RuleListener;
3
3
  /**
4
4
  * @param {Context} context
5
5
  * @param {RuleListener} visitors
@@ -1 +1 @@
1
- {"version":3,"file":"visitors.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/visitors.js"],"names":[],"mappings":"2BACc,OAAO,aAAa,EAAE,YAAY;sBAClC,OAAO,aAAa,EAAE,OAAO;AA8B3C;;;;;GAKG;AACH,wCALW,OAAO,YACP,YAAY,qBACZ,GAAG,GACD,YAAY,CAWxB"}
1
+ {"version":3,"file":"visitors.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/visitors.js"],"names":[],"mappings":"sBACc,OAAO,aAAa,EAAE,OAAO;2BAC7B,OAAO,aAAa,EAAE,YAAY;AA8BhD;;;;;GAKG;AACH,wCALW,OAAO,YACP,YAAY,qBACZ,GAAG,GACD,YAAY,CAWxB"}
@@ -0,0 +1,13 @@
1
+ export type MaybeHTMLSettings = {
2
+ templateLiterals?: {
3
+ tags?: string[];
4
+ comments?: string[];
5
+ };
6
+ };
7
+ export type HTMLSettings = {
8
+ templateLiterals: {
9
+ tags: RegExp[];
10
+ comments: RegExp[];
11
+ };
12
+ };
13
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../lib/types/settings.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gBAAgB,CAAC,EAAE;QACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,gBAAgB,EAAE;QAChB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH,CAAC"}
package/lib/types.d.ts DELETED
@@ -1,289 +0,0 @@
1
- import ESTree, { TaggedTemplateExpression, TemplateLiteral } from "estree";
2
- import ESLint from "eslint";
3
- import * as ESHtml from "es-html-parser";
4
-
5
- type Fix = ESLint.Rule.Fix;
6
- type Token = ESLint.AST.Token;
7
-
8
- type AnyNode = ESHtml.AnyNode | LineNode;
9
-
10
- export type Range = ESLint.AST.Range;
11
-
12
- type Location = ESLint.AST.SourceLocation;
13
-
14
- export interface BaseNode {
15
- range: [number, number];
16
- loc: {
17
- start: ESTree.Position;
18
- end: ESTree.Position;
19
- };
20
- }
21
-
22
- interface AttributeKeyNode extends ESHtml.AttributeKeyNode {
23
- parent: AttributeNode;
24
- }
25
-
26
- interface TextNode extends ESHtml.TextNode {
27
- parent: TagNode;
28
- }
29
-
30
- export interface TagNode extends ESHtml.TagNode {
31
- attributes: AttributeNode[];
32
- parent: TagNode | HTMLNode;
33
- openStart: OpenTagStartNode;
34
- openEnd: OpenTagEndNode;
35
- close: CloseTagNode;
36
- children: Array<
37
- TextNode | TagNode | ScriptTagNode | StyleTagNode | CommentNode
38
- >;
39
- }
40
-
41
- interface OpenTagStartNode extends ESHtml.OpenTagStartNode {
42
- parent: TagNode;
43
- }
44
-
45
- interface OpenTagEndNode extends ESHtml.OpenTagEndNode {
46
- parent: TagNode;
47
- }
48
-
49
- interface CloseTagNode extends ESHtml.CloseTagNode {
50
- parent: TagNode;
51
- }
52
-
53
- interface AttributeNode extends ESHtml.AttributeNode {
54
- key: AttributeKeyNode;
55
- value?: AttributeValueNode;
56
- parent: TagNode | StyleTagNode | ScriptTagNode;
57
- }
58
-
59
- interface AttributeValueNode extends ESHtml.AttributeValueNode {
60
- parent: AttributeNode;
61
- }
62
-
63
- interface AttributeValueWrapperEndNode
64
- extends ESHtml.AttributeValueWrapperEndNode {
65
- parent: AttributeNode;
66
- }
67
-
68
- interface AttributeValueWrapperStartNode
69
- extends ESHtml.AttributeValueWrapperStartNode {
70
- parent: AttributeNode;
71
- }
72
-
73
- export interface ScriptTagNode extends ESHtml.ScriptTagNode {
74
- attributes: AttributeNode[];
75
- parent: HTMLNode | TagNode;
76
- openStart: OpenScriptTagStartNode;
77
- openEnd: OpenScriptTagEndNode;
78
- }
79
-
80
- interface OpenScriptTagStartNode extends ESHtml.OpenScriptTagStartNode {
81
- parent: ScriptTagNode;
82
- }
83
-
84
- interface CloseScriptTagNode extends ESHtml.CloseScriptTagNode {
85
- parent: ScriptTagNode;
86
- }
87
-
88
- interface OpenScriptTagEndNode extends ESHtml.OpenScriptTagEndNode {
89
- parent: ScriptTagNode;
90
- }
91
-
92
- interface ScriptTagContentNode extends ESHtml.ScriptTagContentNode {
93
- parent: ScriptTagNode;
94
- }
95
-
96
- export interface StyleTagNode extends ESHtml.StyleTagNode {
97
- attributes: AttributeNode[];
98
- parent: TagNode | HTMLNode;
99
- openStart: OpenStyleTagStartNode;
100
- openEnd: OpenStyleTagEndNode;
101
- }
102
-
103
- interface OpenStyleTagStartNode extends ESHtml.OpenStyleTagStartNode {
104
- parent: StyleTagNode;
105
- }
106
-
107
- interface OpenStyleTagEndNode extends ESHtml.OpenStyleTagEndNode {
108
- parent: StyleTagNode;
109
- }
110
-
111
- interface StyleTagContentNode extends ESHtml.StyleTagContentNode {
112
- parent: StyleTagNode;
113
- }
114
-
115
- interface CloseStyleTagNode extends ESHtml.CloseStyleTagNode {
116
- parent: StyleTagNode;
117
- }
118
-
119
- interface CommentNode extends ESHtml.CommentNode {
120
- parent: HTMLNode | TagNode;
121
- }
122
-
123
- interface CommentOpenNode extends ESHtml.CommentOpenNode {
124
- parent: CommentNode;
125
- }
126
-
127
- interface CommentCloseNode extends ESHtml.CommentCloseNode {
128
- parent: CommentNode;
129
- }
130
-
131
- interface CommentContentNode extends ESHtml.CommentContentNode {
132
- parent: CommentNode;
133
- }
134
-
135
- interface DoctypeNode extends ESHtml.DoctypeNode {
136
- parent: HTMLNode;
137
- }
138
-
139
- interface DoctypeOpenNode extends ESHtml.DoctypeOpenNode {
140
- parent: DoctypeNode;
141
- }
142
-
143
- interface DoctypeCloseNode extends ESHtml.DoctypeCloseNode {
144
- parent: DoctypeNode;
145
- }
146
-
147
- interface DoctypeAttributeNode extends ESHtml.DoctypeAttributeNode {
148
- parent: DoctypeNode;
149
- }
150
-
151
- interface DoctypeAttributeValueNode extends ESHtml.DoctypeAttributeValueNode {
152
- parent: DoctypeNode;
153
- }
154
-
155
- interface DoctypeAttributeWrapperStart
156
- extends ESHtml.DoctypeAttributeWrapperStartNode {
157
- parent: DoctypeNode;
158
- }
159
-
160
- interface DoctypeAttributeWrapperEnd
161
- extends ESHtml.DoctypeAttributeWrapperEndNode {
162
- parent: DoctypeNode;
163
- }
164
-
165
- interface LineNode extends BaseNode {
166
- type: "Line";
167
- value: string;
168
- skipIndentCheck: boolean;
169
- }
170
-
171
- type PostFix<T, S extends string> = {
172
- [K in keyof T as `${K & string}${S}`]: T[K];
173
- };
174
-
175
- export type RuleListener = BaseRuleListener &
176
- PostFix<BaseRuleListener, ":exit">;
177
-
178
- interface BaseRuleListener {
179
- Document?: (node: ESHtml.DocumentNode) => void;
180
- AttributeKey?: (node: AttributeKeyNode) => void;
181
- Text?: (node: TextNode) => void;
182
- Tag?: (node: TagNode) => void;
183
- OpenTagStart?: (node: OpenTagStartNode) => void;
184
- OpenTagEnd?: (node: OpenTagEndNode) => void;
185
- CloseTag?: (node: CloseTagNode) => void;
186
- Attribute?: (node: AttributeNode) => void;
187
- AttributeValue?: (node: AttributeValueNode) => void;
188
- AttributeValueWrapperEnd?: (node: AttributeValueWrapperEndNode) => void;
189
- AttributeValueWrapperStart?: (node: AttributeValueWrapperStartNode) => void;
190
- ScriptTag?: (node: ScriptTagNode) => void;
191
- OpenScriptTagStart?: (node: OpenScriptTagStartNode) => void;
192
- CloseScriptTag?: (node: CloseScriptTagNode) => void;
193
- OpenScriptTagEnd?: (node: OpenScriptTagEndNode) => void;
194
- ScriptTagContent?: (node: ScriptTagContentNode) => void;
195
- StyleTag?: (node: StyleTagNode) => void;
196
- OpenStyleTagStart?: (node: OpenStyleTagStartNode) => void;
197
- OpenStyleTagEnd?: (node: OpenStyleTagEndNode) => void;
198
- StyleTagContent?: (node: StyleTagContentNode) => void;
199
- CloseStyleTag?: (node: CloseStyleTagNode) => void;
200
- Comment?: (node: CommentNode) => void;
201
- CommentOpen?: (node: CommentOpenNode) => void;
202
- CommentClose?: (node: CommentCloseNode) => void;
203
- CommentContent?: (node: CommentContentNode) => void;
204
- Doctype?: (node: DoctypeNode) => void;
205
- DoctypeOpen?: (node: DoctypeOpenNode) => void;
206
- DoctypeClose?: (node: DoctypeCloseNode) => void;
207
- DoctypeAttribute?: (node: DoctypeAttributeNode) => void;
208
- DoctypeAttributeValue?: (node: DoctypeAttributeValueNode) => void;
209
- DoctypeAttributeWrapperStart?: (node: DoctypeAttributeWrapperStart) => void;
210
- DoctypeAttributeWrapperEnd?: (node: DoctypeAttributeWrapperEnd) => void;
211
- TaggedTemplateExpression?: (node: TaggedTemplateExpression) => void;
212
- TemplateLiteral?: (node: TemplateLiteral) => void;
213
- }
214
-
215
- export interface RuleModule extends ESLint.Rule.RuleModule {
216
- create(context: Context): RuleListener;
217
- meta?: ESLint.Rule.RuleMetaData;
218
- }
219
-
220
- export interface RuleFixer {
221
- insertTextAfter(nodeOrToken: BaseNode | Token, text: string): Fix;
222
-
223
- insertTextAfterRange(range: Range, text: string): Fix;
224
-
225
- insertTextBefore(nodeOrToken: BaseNode | Token, text: string): Fix;
226
-
227
- insertTextBeforeRange(range: Range, text: string): Fix;
228
-
229
- remove(nodeOrToken: BaseNode | Token): Fix;
230
-
231
- removeRange(range: Range): Fix;
232
-
233
- replaceText(nodeOrToken: BaseNode | Token, text: string): Fix;
234
-
235
- replaceTextRange(range: Range, text: string): Fix;
236
- }
237
-
238
- interface ReportDescriptorOptionsBase {
239
- data?: { [key: string]: string };
240
-
241
- fix?:
242
- | null
243
- | ((fixer: RuleFixer) => null | Fix | IterableIterator<Fix> | Fix[]);
244
- }
245
-
246
- type SuggestionDescriptorMessage = { desc: string } | { messageId: string };
247
- type SuggestionReportDescriptor = SuggestionDescriptorMessage &
248
- ReportDescriptorOptionsBase;
249
-
250
- interface ReportDescriptorOptions extends ReportDescriptorOptionsBase {
251
- suggest?: SuggestionReportDescriptor[] | null;
252
- }
253
-
254
- type ReportDescriptor = ReportDescriptorMessage &
255
- ReportDescriptorLocation &
256
- ReportDescriptorOptions;
257
- type ReportDescriptorMessage = { message: string } | { messageId: string };
258
- type ReportDescriptorLocation = {
259
- node?: BaseNode;
260
- loc?: ESLint.AST.SourceLocation;
261
- line?: number;
262
- column?: number;
263
- };
264
-
265
- export interface Context extends Omit<ESLint.Rule.RuleContext, "report"> {
266
- report(descriptor: ReportDescriptor): void;
267
- }
268
-
269
- export type ContentNode =
270
- | CommentNode
271
- | DoctypeNode
272
- | ScriptTagNode
273
- | StyleTagNode
274
- | TagNode
275
- | TextNode;
276
-
277
- export type MaybeHTMLSettings = {
278
- templateLiterals?: {
279
- tags?: string[];
280
- comments?: string[];
281
- };
282
- };
283
-
284
- export type HTMLSettings = {
285
- templateLiterals: {
286
- tags: RegExp[];
287
- comments: RegExp[];
288
- };
289
- };