@html-eslint/eslint-plugin 0.35.0 → 0.35.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/lib/rules/attrs-newline.js +11 -7
- package/lib/rules/element-newline.js +25 -18
- package/lib/rules/id-naming-convention.js +10 -4
- package/lib/rules/indent/indent-level.js +1 -1
- package/lib/rules/indent/indent.js +26 -15
- package/lib/rules/lowercase.js +4 -4
- package/lib/rules/max-element-depth.js +8 -5
- package/lib/rules/no-abstract-roles.js +4 -4
- package/lib/rules/no-accesskey-attrs.js +4 -4
- package/lib/rules/no-aria-hidden-body.js +1 -1
- package/lib/rules/no-duplicate-attrs.js +4 -4
- package/lib/rules/no-duplicate-id.js +5 -5
- package/lib/rules/no-extra-spacing-attrs.js +18 -12
- package/lib/rules/no-extra-spacing-text.js +8 -5
- package/lib/rules/no-heading-inside-button.js +1 -1
- package/lib/rules/no-inline-styles.js +1 -1
- package/lib/rules/no-invalid-role.js +1 -1
- package/lib/rules/no-multiple-empty-lines.js +8 -5
- package/lib/rules/no-multiple-h1.js +2 -2
- package/lib/rules/no-nested-interactive.js +2 -2
- package/lib/rules/no-non-scalable-viewport.js +1 -1
- package/lib/rules/no-obsolete-tags.js +1 -1
- package/lib/rules/no-positive-tabindex.js +4 -4
- package/lib/rules/no-restricted-attr-values.js +5 -5
- package/lib/rules/no-restricted-attrs.js +8 -7
- package/lib/rules/no-script-style-type.js +4 -4
- package/lib/rules/no-skip-heading-levels.js +2 -2
- package/lib/rules/no-target-blank.js +1 -1
- package/lib/rules/no-trailing-spaces.js +3 -3
- package/lib/rules/prefer-https.js +5 -5
- package/lib/rules/quotes.js +7 -5
- package/lib/rules/require-attrs.js +7 -5
- package/lib/rules/require-button-type.js +1 -1
- package/lib/rules/require-closing-tags.js +6 -2
- package/lib/rules/require-doctype.js +1 -1
- package/lib/rules/require-explicit-size.js +8 -3
- package/lib/rules/require-form-method.js +1 -1
- package/lib/rules/require-frame-title.js +1 -1
- package/lib/rules/require-img-alt.js +9 -8
- package/lib/rules/require-input-label.js +2 -2
- package/lib/rules/require-lang.js +4 -7
- package/lib/rules/require-li-container.js +1 -1
- package/lib/rules/require-meta-charset.js +3 -3
- package/lib/rules/require-meta-description.js +3 -3
- package/lib/rules/require-meta-viewport.js +3 -3
- package/lib/rules/require-open-graph-protocol.js +6 -3
- package/lib/rules/require-title.js +4 -4
- package/lib/rules/sort-attrs.js +11 -11
- package/lib/rules/utils/node.js +23 -23
- package/lib/rules/utils/settings.js +3 -3
- package/lib/rules/utils/source-code.js +1 -1
- package/lib/rules/utils/visitors.js +1 -1
- package/lib/types/ast.d.ts +4 -200
- package/lib/types/index.d.ts +1 -1
- package/lib/types/rule.d.ts +41 -10
- package/package.json +11 -20
- package/types/configs/recommended.d.ts +0 -20
- package/types/configs/recommended.d.ts.map +0 -1
- package/types/constants/index.d.ts +0 -5
- package/types/constants/index.d.ts.map +0 -1
- package/types/constants/obsolete-tags.d.ts +0 -3
- package/types/constants/obsolete-tags.d.ts.map +0 -1
- package/types/constants/rule-category.d.ts +0 -5
- package/types/constants/rule-category.d.ts.map +0 -1
- package/types/constants/svg-camel-case-attributes.d.ts +0 -3
- package/types/constants/svg-camel-case-attributes.d.ts.map +0 -1
- package/types/constants/void-elements.d.ts +0 -3
- package/types/constants/void-elements.d.ts.map +0 -1
- package/types/index.d.ts +0 -14
- package/types/index.d.ts.map +0 -1
- package/types/rules/attrs-newline.d.ts +0 -13
- package/types/rules/attrs-newline.d.ts.map +0 -1
- package/types/rules/element-newline.d.ts +0 -16
- package/types/rules/element-newline.d.ts.map +0 -1
- package/types/rules/id-naming-convention.d.ts +0 -10
- package/types/rules/id-naming-convention.d.ts.map +0 -1
- package/types/rules/indent/indent-level.d.ts +0 -55
- package/types/rules/indent/indent-level.d.ts.map +0 -1
- package/types/rules/indent/indent.d.ts +0 -32
- package/types/rules/indent/indent.d.ts.map +0 -1
- package/types/rules/indent/index.d.ts +0 -3
- package/types/rules/indent/index.d.ts.map +0 -1
- package/types/rules/index.d.ts +0 -51
- package/types/rules/index.d.ts.map +0 -1
- package/types/rules/lowercase.d.ts +0 -10
- package/types/rules/lowercase.d.ts.map +0 -1
- package/types/rules/max-element-depth.d.ts +0 -10
- package/types/rules/max-element-depth.d.ts.map +0 -1
- package/types/rules/no-abstract-roles.d.ts +0 -10
- package/types/rules/no-abstract-roles.d.ts.map +0 -1
- package/types/rules/no-accesskey-attrs.d.ts +0 -10
- package/types/rules/no-accesskey-attrs.d.ts.map +0 -1
- package/types/rules/no-aria-hidden-body.d.ts +0 -7
- package/types/rules/no-aria-hidden-body.d.ts.map +0 -1
- package/types/rules/no-duplicate-attrs.d.ts +0 -10
- package/types/rules/no-duplicate-attrs.d.ts.map +0 -1
- package/types/rules/no-duplicate-id.d.ts +0 -11
- package/types/rules/no-duplicate-id.d.ts.map +0 -1
- package/types/rules/no-extra-spacing-attrs.d.ts +0 -18
- package/types/rules/no-extra-spacing-attrs.d.ts.map +0 -1
- package/types/rules/no-extra-spacing-text.d.ts +0 -13
- package/types/rules/no-extra-spacing-text.d.ts.map +0 -1
- package/types/rules/no-heading-inside-button.d.ts +0 -7
- package/types/rules/no-heading-inside-button.d.ts.map +0 -1
- package/types/rules/no-inline-styles.d.ts +0 -7
- package/types/rules/no-inline-styles.d.ts.map +0 -1
- package/types/rules/no-invalid-role.d.ts +0 -7
- package/types/rules/no-invalid-role.d.ts.map +0 -1
- package/types/rules/no-multiple-empty-lines.d.ts +0 -11
- package/types/rules/no-multiple-empty-lines.d.ts.map +0 -1
- package/types/rules/no-multiple-h1.d.ts +0 -8
- package/types/rules/no-multiple-h1.d.ts.map +0 -1
- package/types/rules/no-nested-interactive.d.ts +0 -8
- package/types/rules/no-nested-interactive.d.ts.map +0 -1
- package/types/rules/no-non-scalable-viewport.d.ts +0 -7
- package/types/rules/no-non-scalable-viewport.d.ts.map +0 -1
- package/types/rules/no-obsolete-tags.d.ts +0 -7
- package/types/rules/no-obsolete-tags.d.ts.map +0 -1
- package/types/rules/no-positive-tabindex.d.ts +0 -10
- package/types/rules/no-positive-tabindex.d.ts.map +0 -1
- package/types/rules/no-restricted-attr-values.d.ts +0 -16
- package/types/rules/no-restricted-attr-values.d.ts.map +0 -1
- package/types/rules/no-restricted-attrs.d.ts +0 -16
- package/types/rules/no-restricted-attrs.d.ts.map +0 -1
- package/types/rules/no-script-style-type.d.ts +0 -10
- package/types/rules/no-script-style-type.d.ts.map +0 -1
- package/types/rules/no-skip-heading-levels.d.ts +0 -8
- package/types/rules/no-skip-heading-levels.d.ts.map +0 -1
- package/types/rules/no-target-blank.d.ts +0 -7
- package/types/rules/no-target-blank.d.ts.map +0 -1
- package/types/rules/no-trailing-spaces.d.ts +0 -9
- package/types/rules/no-trailing-spaces.d.ts.map +0 -1
- package/types/rules/prefer-https.d.ts +0 -11
- package/types/rules/prefer-https.d.ts.map +0 -1
- package/types/rules/quotes.d.ts +0 -12
- package/types/rules/quotes.d.ts.map +0 -1
- package/types/rules/require-attrs.d.ts +0 -15
- package/types/rules/require-attrs.d.ts.map +0 -1
- package/types/rules/require-button-type.d.ts +0 -7
- package/types/rules/require-button-type.d.ts.map +0 -1
- package/types/rules/require-closing-tags.d.ts +0 -8
- package/types/rules/require-closing-tags.d.ts.map +0 -1
- package/types/rules/require-doctype.d.ts +0 -7
- package/types/rules/require-doctype.d.ts.map +0 -1
- package/types/rules/require-explicit-size.d.ts +0 -9
- package/types/rules/require-explicit-size.d.ts.map +0 -1
- package/types/rules/require-form-method.d.ts +0 -7
- package/types/rules/require-form-method.d.ts.map +0 -1
- package/types/rules/require-frame-title.d.ts +0 -7
- package/types/rules/require-frame-title.d.ts.map +0 -1
- package/types/rules/require-img-alt.d.ts +0 -8
- package/types/rules/require-img-alt.d.ts.map +0 -1
- package/types/rules/require-input-label.d.ts +0 -8
- package/types/rules/require-input-label.d.ts.map +0 -1
- package/types/rules/require-lang.d.ts +0 -7
- package/types/rules/require-lang.d.ts.map +0 -1
- package/types/rules/require-li-container.d.ts +0 -7
- package/types/rules/require-li-container.d.ts.map +0 -1
- package/types/rules/require-meta-charset.d.ts +0 -9
- package/types/rules/require-meta-charset.d.ts.map +0 -1
- package/types/rules/require-meta-description.d.ts +0 -9
- package/types/rules/require-meta-description.d.ts.map +0 -1
- package/types/rules/require-meta-viewport.d.ts +0 -9
- package/types/rules/require-meta-viewport.d.ts.map +0 -1
- package/types/rules/require-open-graph-protocol.d.ts +0 -9
- package/types/rules/require-open-graph-protocol.d.ts.map +0 -1
- package/types/rules/require-title.d.ts +0 -10
- package/types/rules/require-title.d.ts.map +0 -1
- package/types/rules/sort-attrs.d.ts +0 -10
- package/types/rules/sort-attrs.d.ts.map +0 -1
- package/types/rules/utils/array.d.ts +0 -17
- package/types/rules/utils/array.d.ts.map +0 -1
- package/types/rules/utils/naming.d.ts +0 -25
- package/types/rules/utils/naming.d.ts.map +0 -1
- package/types/rules/utils/node.d.ts +0 -119
- package/types/rules/utils/node.d.ts.map +0 -1
- package/types/rules/utils/settings.d.ts +0 -19
- package/types/rules/utils/settings.d.ts.map +0 -1
- package/types/rules/utils/source-code.d.ts +0 -9
- package/types/rules/utils/source-code.d.ts.map +0 -1
- package/types/rules/utils/visitors.d.ts +0 -10
- package/types/rules/utils/visitors.d.ts.map +0 -1
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
2
|
+
* @typedef { import("../types").RuleFixer } RuleFixer
|
|
4
3
|
*
|
|
5
|
-
* @typedef {Object
|
|
4
|
+
* @typedef {Object} MessageId
|
|
6
5
|
* @property {"closeStyleWrong"} CLOSE_STYLE_WRONG
|
|
7
6
|
* @property {"newlineMissing"} NEWLINE_MISSING
|
|
8
7
|
* @property {"newlineUnexpected"} NEWLINE_UNEXPECTED
|
|
8
|
+
*
|
|
9
|
+
* @typedef {Object} Option
|
|
10
|
+
* @property {"sameline" | "newline"} [option.closeStyle]
|
|
11
|
+
* @property {number} [options.ifAttrsMoreThan]
|
|
12
|
+
*
|
|
13
|
+
* @typedef { import("../types").RuleModule<[Option]> } RuleModule
|
|
9
14
|
*/
|
|
10
15
|
|
|
11
16
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -58,9 +63,8 @@ module.exports = {
|
|
|
58
63
|
|
|
59
64
|
create(context) {
|
|
60
65
|
const options = context.options[0] || {};
|
|
61
|
-
const attrMin =
|
|
62
|
-
? 2
|
|
63
|
-
: options.ifAttrsMoreThan;
|
|
66
|
+
const attrMin =
|
|
67
|
+
typeof options.ifAttrsMoreThan !== "number" ? 2 : options.ifAttrsMoreThan;
|
|
64
68
|
const closeStyle = options.closeStyle || "newline";
|
|
65
69
|
|
|
66
70
|
return createVisitors(context, {
|
|
@@ -147,7 +151,7 @@ module.exports = {
|
|
|
147
151
|
return context.report({
|
|
148
152
|
node,
|
|
149
153
|
data: {
|
|
150
|
-
attrMin
|
|
154
|
+
attrMin: `${attrMin}`,
|
|
151
155
|
},
|
|
152
156
|
fix,
|
|
153
157
|
messageId: MESSAGE_ID.NEWLINE_UNEXPECTED,
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("
|
|
7
|
-
* @typedef { import("
|
|
8
|
-
* @typedef { import("
|
|
9
|
-
* @typedef { import("
|
|
10
|
-
* @typedef { import("
|
|
11
|
-
* @typedef { import("../types").
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").Comment } Comment
|
|
4
|
+
* @typedef { import("@html-eslint/types").Doctype } Doctype
|
|
5
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
6
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
7
|
+
* @typedef { import("@html-eslint/types").Text } Text
|
|
8
|
+
* @typedef { import("@html-eslint/types").AnyNode } AnyNode
|
|
9
|
+
* @typedef { import("@html-eslint/types").OpenTagEnd } OpenTagEnd
|
|
10
|
+
* @typedef { import("@html-eslint/types").CloseTag } CloseTag
|
|
11
|
+
* @typedef { import("../types").Line } Line
|
|
12
|
+
* @typedef { AnyNode | Line } AnyNodeOrLine
|
|
13
|
+
*
|
|
14
|
+
* @typedef {Object} Option
|
|
15
|
+
* @property {string[]} [Option.skip]
|
|
16
|
+
* @property {string[]} [Option.inline]
|
|
17
|
+
*
|
|
18
|
+
* @typedef { import("../types").RuleModule<[Option]> } RuleModule
|
|
12
19
|
*/
|
|
13
20
|
|
|
14
21
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -115,12 +122,12 @@ module.exports = {
|
|
|
115
122
|
const inlineTags = optionsOrPresets(option.inline || []);
|
|
116
123
|
|
|
117
124
|
/**
|
|
118
|
-
* @param {
|
|
119
|
-
* @returns {Exclude<
|
|
125
|
+
* @param {AnyNodeOrLine[]} children
|
|
126
|
+
* @returns {Exclude<AnyNodeOrLine, Text>[]}
|
|
120
127
|
*/
|
|
121
128
|
function getChildrenToCheck(children) {
|
|
122
129
|
/**
|
|
123
|
-
* @type {Exclude<
|
|
130
|
+
* @type {Exclude<AnyNodeOrLine, Text>[]}
|
|
124
131
|
*/
|
|
125
132
|
const childrenToCheck = [];
|
|
126
133
|
|
|
@@ -136,8 +143,8 @@ module.exports = {
|
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
/**
|
|
139
|
-
* @param {
|
|
140
|
-
* @param {
|
|
146
|
+
* @param {AnyNodeOrLine} before
|
|
147
|
+
* @param {AnyNodeOrLine} after
|
|
141
148
|
* @returns {boolean}
|
|
142
149
|
*/
|
|
143
150
|
function isOnTheSameLine(before, after) {
|
|
@@ -156,7 +163,7 @@ module.exports = {
|
|
|
156
163
|
}
|
|
157
164
|
|
|
158
165
|
/**
|
|
159
|
-
* @param {
|
|
166
|
+
* @param {AnyNodeOrLine} node
|
|
160
167
|
* @returns {boolean}
|
|
161
168
|
*/
|
|
162
169
|
function isInline(node) {
|
|
@@ -250,7 +257,7 @@ module.exports = {
|
|
|
250
257
|
}
|
|
251
258
|
|
|
252
259
|
/**
|
|
253
|
-
* @param {
|
|
260
|
+
* @param {AnyNodeOrLine} node
|
|
254
261
|
* @returns {boolean}
|
|
255
262
|
*/
|
|
256
263
|
function isEmptyText(node) {
|
|
@@ -261,7 +268,7 @@ module.exports = {
|
|
|
261
268
|
}
|
|
262
269
|
|
|
263
270
|
/**
|
|
264
|
-
* @param {
|
|
271
|
+
* @param {AnyNodeOrLine} node
|
|
265
272
|
* @param {{ isClose?: boolean }} options
|
|
266
273
|
*/
|
|
267
274
|
function getName(node, options = {}) {
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
*
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
5
|
+
*
|
|
6
|
+
* @typedef {"camelCase" | "snake_case" | "PascalCase" | "kebab-case" | "regex"} Option1
|
|
7
|
+
* @typedef {Object} Option2
|
|
8
|
+
* @property {string} pattern
|
|
9
|
+
* @property {string} [flags]
|
|
10
|
+
*
|
|
11
|
+
* @typedef { import("../types").RuleModule<[Option1, Option2]> } RuleModule
|
|
6
12
|
*/
|
|
7
13
|
|
|
8
14
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("../../types").AnyNode } AnyNode
|
|
2
|
+
* @typedef { import("@html-eslint/types").AnyNode } AnyNode
|
|
4
3
|
* @typedef { import("../../types").Line } Line
|
|
5
|
-
* @typedef { import("
|
|
4
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
6
5
|
* @typedef { import("../../types").RuleListener } RuleListener
|
|
7
|
-
* @typedef { import("../../types").Context } Context
|
|
8
|
-
* @typedef { import("
|
|
6
|
+
* @typedef { import("../../types").Context<any[]> } Context
|
|
7
|
+
* @typedef { import("@html-eslint/types").TemplateText } TemplateText
|
|
9
8
|
* @typedef { import("eslint").AST.Token } Token
|
|
10
9
|
* @typedef { import("eslint").SourceCode } SourceCode
|
|
11
10
|
* @typedef { import("eslint").AST.Range } Range
|
|
12
11
|
* @typedef { import("eslint").AST.SourceLocation } SourceLocation
|
|
13
|
-
* @typedef { import("
|
|
14
|
-
* @typedef { import("
|
|
15
|
-
* @typedef { import("
|
|
16
|
-
*
|
|
12
|
+
* @typedef { import("@html-eslint/types").TemplateLiteral } TemplateLiteral
|
|
13
|
+
* @typedef { import("@html-eslint/types").OpenTemplate } OpenTemplate
|
|
14
|
+
* @typedef { import("@html-eslint/types").CloseTemplate } CloseTemplate
|
|
17
15
|
*
|
|
16
|
+
* @typedef {AnyNode | Line} AnyNodeOrLine
|
|
18
17
|
* @typedef {Object} IndentType
|
|
19
18
|
* @property {"tab"} TAB
|
|
20
19
|
* @property {"space"} SPACE
|
|
@@ -24,6 +23,13 @@
|
|
|
24
23
|
* @property {IndentType["TAB"] | IndentType["SPACE"]} indentType
|
|
25
24
|
* @property {number} indentSize
|
|
26
25
|
* @property {string} indentChar
|
|
26
|
+
*
|
|
27
|
+
* @typedef {"tab" | number} Option1
|
|
28
|
+
* @typedef {Object} Option2
|
|
29
|
+
* @property {number} [Option2.Attribute]
|
|
30
|
+
* @property {Record<string, number>} [Option2.tagChildrenIndent]
|
|
31
|
+
*
|
|
32
|
+
* @typedef { import("../../types").RuleModule<[Option1, Option2]> } RuleModule
|
|
27
33
|
*/
|
|
28
34
|
|
|
29
35
|
const { parse } = require("@html-eslint/template-parser");
|
|
@@ -147,9 +153,14 @@ module.exports = {
|
|
|
147
153
|
if (isTag(node)) {
|
|
148
154
|
return getTagIncreasingLevel(node);
|
|
149
155
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
const type = node.type;
|
|
157
|
+
if (type === NodeTypes.Attribute) {
|
|
158
|
+
const optionIndent = indentLevelOptions[type];
|
|
159
|
+
if (typeof optionIndent === "number") {
|
|
160
|
+
return optionIndent;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return 1;
|
|
153
164
|
}
|
|
154
165
|
|
|
155
166
|
/**
|
|
@@ -252,11 +263,11 @@ module.exports = {
|
|
|
252
263
|
if (actualIndent !== expectedIndent) {
|
|
253
264
|
const targetNode = getIndentNodeToReport(node, actualIndent);
|
|
254
265
|
context.report({
|
|
255
|
-
|
|
266
|
+
loc: targetNode.loc,
|
|
256
267
|
messageId: MESSAGE_ID.WRONG_INDENT,
|
|
257
268
|
data: getMessageData(actualIndent, indentLevel.value()),
|
|
258
269
|
fix(fixer) {
|
|
259
|
-
return fixer.
|
|
270
|
+
return fixer.replaceTextRange(targetNode.range, expectedIndent);
|
|
260
271
|
},
|
|
261
272
|
});
|
|
262
273
|
}
|
|
@@ -398,7 +409,7 @@ module.exports = {
|
|
|
398
409
|
};
|
|
399
410
|
|
|
400
411
|
/**
|
|
401
|
-
* @param {
|
|
412
|
+
* @param {AnyNodeOrLine | TemplateText | OpenTemplate | CloseTemplate} node
|
|
402
413
|
* @param {string} actualIndent
|
|
403
414
|
* @return {{range: Range; loc: SourceLocation}}
|
|
404
415
|
*/
|
package/lib/rules/lowercase.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("../types").
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { NODE_TYPES } = require("@html-eslint/parser");
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
*
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
*
|
|
6
|
+
* @typedef {Object} Option
|
|
7
|
+
* @property {number} [Option.max]
|
|
8
|
+
* @typedef { import("../types").RuleModule<[Option]> } RuleModule
|
|
6
9
|
*/
|
|
7
10
|
|
|
8
11
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -71,7 +74,7 @@ module.exports = {
|
|
|
71
74
|
node,
|
|
72
75
|
messageId: MESSAGE_IDS.MAX_DEPTH_EXCEEDED,
|
|
73
76
|
data: {
|
|
74
|
-
needed: maxDepth
|
|
77
|
+
needed: `${maxDepth}`,
|
|
75
78
|
found: String(depth),
|
|
76
79
|
},
|
|
77
80
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("../types").
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("../types").
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("../types").
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("../types").
|
|
2
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
* @typedef { import("@html-eslint/types").AttributeValue } AttributeValue
|
|
6
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const { parse } = require("@html-eslint/template-parser");
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("
|
|
7
|
-
* @typedef { import("
|
|
8
|
-
* @typedef { import("
|
|
9
|
-
* @typedef { import("
|
|
10
|
-
* @typedef { import("
|
|
11
|
-
* @typedef { import("
|
|
12
|
-
* @typedef { import("
|
|
13
|
-
*
|
|
2
|
+
* @typedef { import("@html-eslint/types").Attribute } Attribute
|
|
3
|
+
* @typedef { import("@html-eslint/types").OpenTagEnd } OpenTagEnd
|
|
4
|
+
* @typedef { import("@html-eslint/types").OpenScriptTagEnd } OpenScriptTagEnd
|
|
5
|
+
* @typedef { import("@html-eslint/types").OpenStyleTagEnd } OpenStyleTagEnd
|
|
6
|
+
* @typedef { import("@html-eslint/types").OpenScriptTagStart } OpenScriptTagStart
|
|
7
|
+
* @typedef { import("@html-eslint/types").OpenTagStart } OpenTagStart
|
|
8
|
+
* @typedef { import("@html-eslint/types").OpenStyleTagStart } OpenStyleTagStart
|
|
9
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
10
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
11
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
12
|
+
* @typedef { import("@html-eslint/types").AnyNode } AnyNode
|
|
13
|
+
*
|
|
14
|
+
* @typedef {Object} Option
|
|
15
|
+
* @property {boolean} [Option.disallowInAssignment]
|
|
16
|
+
* @property {boolean} [Option.disallowMissing]
|
|
17
|
+
* @property {boolean} [Option.disallowTabs]
|
|
18
|
+
* @property {boolean} [Option.enforceBeforeSelfClose]
|
|
19
|
+
* @typedef { import("../types").RuleModule<[Option]> } RuleModule
|
|
14
20
|
*/
|
|
15
21
|
|
|
16
22
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("../types").Text } Text
|
|
2
|
+
* @typedef { import("@html-eslint/types").CommentContent } CommentContent
|
|
3
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
4
|
+
* @typedef { import("@html-eslint/types").Comment } Comment
|
|
5
|
+
* @typedef { import("@html-eslint/types").Text } Text
|
|
7
6
|
* @typedef { import("../types").Line } Line
|
|
8
7
|
* @typedef { import("eslint").AST.Range } Range
|
|
8
|
+
*
|
|
9
|
+
* @typedef {Object} Option
|
|
10
|
+
* @property {string[]} [Option.skip]
|
|
11
|
+
* @typedef { import("../types").RuleModule<[Option]> } RuleModule
|
|
9
12
|
*/
|
|
10
13
|
|
|
11
14
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef { import("es-html-parser").AnyToken } AnyToken
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
*
|
|
3
|
+
* @typedef { import("@html-eslint/types").Document } Document
|
|
4
|
+
* @typedef { import("@html-eslint/types").CommentContent } CommentContent
|
|
5
|
+
* @typedef { import("@html-eslint/types").Text } Text
|
|
6
|
+
*
|
|
7
|
+
* @typedef {Object} Option
|
|
8
|
+
* @property {number} Option.max
|
|
9
|
+
* @typedef { import("../types").RuleModule<[Option]> } RuleModule
|
|
7
10
|
*/
|
|
8
11
|
|
|
9
12
|
const { parse } = require("@html-eslint/template-parser");
|
|
@@ -99,7 +102,7 @@ module.exports = {
|
|
|
99
102
|
},
|
|
100
103
|
messageId: MESSAGE_IDS.UNEXPECTED,
|
|
101
104
|
data: {
|
|
102
|
-
max
|
|
105
|
+
max: `${max}`,
|
|
103
106
|
},
|
|
104
107
|
fix(fixer) {
|
|
105
108
|
return fixer.removeRange([start, end]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
|
-
* @typedef { import("
|
|
2
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
3
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
|
-
* @typedef { import("
|
|
2
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
3
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
2
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
3
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
4
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
5
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("../types").ScriptTag } ScriptTag
|
|
2
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
3
|
+
* @typedef { import("@html-eslint/types").Attribute } Attribute
|
|
4
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
5
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
7
6
|
* @typedef {{attrPatterns: string[], attrValuePatterns: string[], message?: string}[]} Options
|
|
7
|
+
* @typedef { import("../types").RuleModule<Options> } RuleModule
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("../types").ScriptTag } ScriptTag
|
|
2
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
3
|
+
* @typedef { import("@html-eslint/types").Attribute } Attribute
|
|
4
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
5
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
7
6
|
* @typedef {{tagPatterns: string[], attrPatterns: string[], message?: string}[]} Options
|
|
7
|
+
*
|
|
8
|
+
* @typedef { import("../types").RuleModule<Options> } RuleModule
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
const { NODE_TYPES } = require("@html-eslint/parser");
|
|
@@ -74,8 +75,8 @@ module.exports = {
|
|
|
74
75
|
node.type === NODE_TYPES.Tag
|
|
75
76
|
? node.name
|
|
76
77
|
: node.type === NODE_TYPES.ScriptTag
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
? "script"
|
|
79
|
+
: "style";
|
|
79
80
|
node.attributes.forEach((attr) => {
|
|
80
81
|
if (!attr.key || !attr.key.value) {
|
|
81
82
|
return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
2
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
3
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
4
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
5
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
|
-
* @typedef { import("
|
|
2
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
3
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { RULE_CATEGORY } = require("../constants");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
2
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
3
|
+
* @typedef { import("@html-eslint/types").CommentContent } CommentContent
|
|
4
|
+
* @typedef { import("@html-eslint/types").Text } Text
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const { parse } = require("@html-eslint/template-parser");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("
|
|
2
|
+
* @typedef { import("../types").RuleModule<[]> } RuleModule
|
|
3
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
4
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
5
|
+
* @typedef { import("@html-eslint/types").Attribute } Attribute
|
|
6
|
+
* @typedef { import("@html-eslint/types").AttributeValue } AttributeValue
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const { RULE_CATEGORY } = require("../constants");
|
package/lib/rules/quotes.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef { import("eslint").AST.Range } Range
|
|
3
|
-
* @typedef { import("
|
|
4
|
-
* @typedef { import("
|
|
5
|
-
* @typedef { import("
|
|
6
|
-
* @typedef { import("
|
|
7
|
-
*
|
|
3
|
+
* @typedef { import("@html-eslint/types").Attribute } Attribute
|
|
4
|
+
* @typedef { import("@html-eslint/types").Tag } Tag
|
|
5
|
+
* @typedef { import("@html-eslint/types").ScriptTag } ScriptTag
|
|
6
|
+
* @typedef { import("@html-eslint/types").StyleTag } StyleTag
|
|
7
|
+
*
|
|
8
|
+
* @typedef {"single" | "double"} Option
|
|
9
|
+
* @typedef { import("../types").RuleModule<[Option]> } RuleModule
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
12
|
const { RULE_CATEGORY } = require("../constants");
|