@html-eslint/eslint-plugin 0.34.0-alpha.0 → 0.35.0-alpha.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.
- package/lib/rules/id-naming-convention.js +8 -7
- package/lib/rules/indent/indent.js +39 -6
- package/lib/rules/no-aria-hidden-body.js +1 -1
- package/lib/rules/no-duplicate-attrs.js +2 -2
- package/lib/rules/no-extra-spacing-attrs.js +2 -1
- package/lib/rules/no-extra-spacing-text.js +1 -2
- package/lib/rules/no-multiple-empty-lines.js +1 -1
- package/lib/rules/no-positive-tabindex.js +1 -1
- package/lib/rules/no-target-blank.js +1 -1
- package/lib/rules/no-trailing-spaces.js +1 -1
- package/lib/rules/prefer-https.js +3 -2
- package/lib/rules/quotes.js +2 -1
- package/lib/rules/require-button-type.js +1 -1
- package/lib/rules/require-form-method.js +3 -2
- package/lib/rules/utils/node.js +19 -29
- package/lib/types/ast.d.ts +5 -2
- package/package.json +8 -8
- package/types/rules/id-naming-convention.d.ts.map +1 -1
- package/types/rules/indent/indent.d.ts +2 -1
- package/types/rules/indent/indent.d.ts.map +1 -1
- package/types/rules/no-extra-spacing-attrs.d.ts.map +1 -1
- package/types/rules/prefer-https.d.ts.map +1 -1
- package/types/rules/quotes.d.ts.map +1 -1
- package/types/rules/require-form-method.d.ts.map +1 -1
- package/types/rules/utils/node.d.ts +9 -13
- package/types/rules/utils/node.d.ts.map +1 -1
- package/types/rules/indent.d.ts +0 -22
- package/types/rules/indent.d.ts.map +0 -1
- package/types/types/settings.d.ts +0 -13
- package/types/types/settings.d.ts.map +0 -1
|
@@ -12,11 +12,7 @@ const {
|
|
|
12
12
|
isPascalCase,
|
|
13
13
|
isKebabCase,
|
|
14
14
|
} = require("./utils/naming");
|
|
15
|
-
const {
|
|
16
|
-
findAttr,
|
|
17
|
-
isAttributesEmpty,
|
|
18
|
-
isExpressionInTemplate,
|
|
19
|
-
} = require("./utils/node");
|
|
15
|
+
const { findAttr, isAttributesEmpty, hasTemplate } = require("./utils/node");
|
|
20
16
|
const { createVisitors } = require("./utils/visitors");
|
|
21
17
|
|
|
22
18
|
const MESSAGE_IDS = {
|
|
@@ -94,7 +90,12 @@ module.exports = {
|
|
|
94
90
|
return;
|
|
95
91
|
}
|
|
96
92
|
const idAttr = findAttr(node, "id");
|
|
97
|
-
if (
|
|
93
|
+
if (
|
|
94
|
+
idAttr &&
|
|
95
|
+
idAttr.value &&
|
|
96
|
+
!hasTemplate(idAttr.value) &&
|
|
97
|
+
!checkNaming(idAttr.value.value)
|
|
98
|
+
) {
|
|
98
99
|
context.report({
|
|
99
100
|
node: idAttr,
|
|
100
101
|
data: {
|
|
@@ -117,7 +118,7 @@ module.exports = {
|
|
|
117
118
|
if (
|
|
118
119
|
idAttr &&
|
|
119
120
|
idAttr.value &&
|
|
120
|
-
!
|
|
121
|
+
!hasTemplate(idAttr.value) &&
|
|
121
122
|
!checkNaming(idAttr.value.value)
|
|
122
123
|
) {
|
|
123
124
|
context.report({
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @typedef { import("../../types").Tag } Tag
|
|
6
6
|
* @typedef { import("../../types").RuleListener } RuleListener
|
|
7
7
|
* @typedef { import("../../types").Context } Context
|
|
8
|
+
* @typedef { import("../../types").TemplateText } TemplateText
|
|
8
9
|
* @typedef { import("eslint").AST.Token } Token
|
|
9
10
|
* @typedef { import("eslint").SourceCode } SourceCode
|
|
10
11
|
* @typedef { import("eslint").AST.Range } Range
|
|
@@ -24,8 +25,14 @@
|
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
27
|
const { parse } = require("@html-eslint/template-parser");
|
|
28
|
+
const { NodeTypes } = require("es-html-parser");
|
|
27
29
|
const { RULE_CATEGORY } = require("../../constants");
|
|
28
|
-
const {
|
|
30
|
+
const {
|
|
31
|
+
splitToLineNodes,
|
|
32
|
+
isLine,
|
|
33
|
+
isTag,
|
|
34
|
+
hasTemplate,
|
|
35
|
+
} = require("../utils/node");
|
|
29
36
|
const {
|
|
30
37
|
shouldCheckTaggedTemplateExpression,
|
|
31
38
|
shouldCheckTemplateLiteral,
|
|
@@ -173,7 +180,7 @@ module.exports = {
|
|
|
173
180
|
let parentIgnoringChildCount = 0;
|
|
174
181
|
|
|
175
182
|
/**
|
|
176
|
-
* @param {AnyNode | Line} node
|
|
183
|
+
* @param {AnyNode | Line | TemplateText} node
|
|
177
184
|
* @returns {string}
|
|
178
185
|
*/
|
|
179
186
|
function getActualIndent(node) {
|
|
@@ -228,7 +235,7 @@ module.exports = {
|
|
|
228
235
|
}
|
|
229
236
|
|
|
230
237
|
/**
|
|
231
|
-
* @param {AnyNode | Line} node
|
|
238
|
+
* @param {AnyNode | Line | TemplateText} node
|
|
232
239
|
*/
|
|
233
240
|
function checkIndent(node) {
|
|
234
241
|
if (parentIgnoringChildCount > 0) {
|
|
@@ -303,10 +310,23 @@ module.exports = {
|
|
|
303
310
|
},
|
|
304
311
|
Text(node) {
|
|
305
312
|
indentLevel.indent(node);
|
|
313
|
+
if (hasTemplate(node)) {
|
|
314
|
+
node.parts.forEach((part) => {
|
|
315
|
+
if (part.type !== NodeTypes.Part) {
|
|
316
|
+
if (part.open) {
|
|
317
|
+
checkIndent(part.open);
|
|
318
|
+
}
|
|
319
|
+
if (part.close) {
|
|
320
|
+
checkIndent(part.close);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
306
326
|
const lineNodes = splitToLineNodes(node);
|
|
307
327
|
|
|
308
328
|
lineNodes.forEach((lineNode) => {
|
|
309
|
-
if (lineNode.
|
|
329
|
+
if (lineNode.hasTemplate) {
|
|
310
330
|
return;
|
|
311
331
|
}
|
|
312
332
|
if (lineNode.value.trim().length) {
|
|
@@ -323,9 +343,22 @@ module.exports = {
|
|
|
323
343
|
CommentOpen: checkIndent,
|
|
324
344
|
CommentContent(node) {
|
|
325
345
|
indentLevel.indent(node);
|
|
346
|
+
if (hasTemplate(node)) {
|
|
347
|
+
node.parts.forEach((part) => {
|
|
348
|
+
if (part.type !== NodeTypes.Part) {
|
|
349
|
+
if (part.open) {
|
|
350
|
+
checkIndent(part.open);
|
|
351
|
+
}
|
|
352
|
+
if (part.close) {
|
|
353
|
+
checkIndent(part.close);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
|
|
326
359
|
const lineNodes = splitToLineNodes(node);
|
|
327
360
|
lineNodes.forEach((lineNode) => {
|
|
328
|
-
if (lineNode.
|
|
361
|
+
if (lineNode.hasTemplate) {
|
|
329
362
|
return;
|
|
330
363
|
}
|
|
331
364
|
if (lineNode.value.trim().length) {
|
|
@@ -363,7 +396,7 @@ module.exports = {
|
|
|
363
396
|
};
|
|
364
397
|
|
|
365
398
|
/**
|
|
366
|
-
* @param {AnyNode | Line} node
|
|
399
|
+
* @param {AnyNode | Line | TemplateText} node
|
|
367
400
|
* @param {string} actualIndent
|
|
368
401
|
* @return {{range: Range; loc: SourceLocation}}
|
|
369
402
|
*/
|
|
@@ -41,7 +41,7 @@ module.exports = {
|
|
|
41
41
|
if (Array.isArray(node.attributes)) {
|
|
42
42
|
const attrsSet = new Set();
|
|
43
43
|
node.attributes.forEach((attr) => {
|
|
44
|
-
if (attr.key && attrsSet.has(attr.key.value)) {
|
|
44
|
+
if (attr.key && attrsSet.has(attr.key.value.toLowerCase())) {
|
|
45
45
|
context.report({
|
|
46
46
|
node: attr,
|
|
47
47
|
data: {
|
|
@@ -50,7 +50,7 @@ module.exports = {
|
|
|
50
50
|
messageId: MESSAGE_IDS.DUPLICATE_ATTRS,
|
|
51
51
|
});
|
|
52
52
|
} else {
|
|
53
|
-
attrsSet.add(attr.key.value);
|
|
53
|
+
attrsSet.add(attr.key.value.toLowerCase());
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
const { RULE_CATEGORY } = require("../constants");
|
|
17
17
|
const { getLocBetween } = require("./utils/node");
|
|
18
|
+
const { getSourceCode } = require("./utils/source-code");
|
|
18
19
|
const { createVisitors } = require("./utils/visitors");
|
|
19
20
|
|
|
20
21
|
const MESSAGE_IDS = {
|
|
@@ -92,7 +93,7 @@ module.exports = {
|
|
|
92
93
|
const disallowInAssignment = !!(context.options[0] || [])
|
|
93
94
|
.disallowInAssignment;
|
|
94
95
|
|
|
95
|
-
const sourceCode =
|
|
96
|
+
const sourceCode = getSourceCode(context).text;
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
99
|
* @param {Attribute[]} attrs
|
|
@@ -88,7 +88,6 @@ module.exports = {
|
|
|
88
88
|
const text = node.value;
|
|
89
89
|
const matcher = /(^|[^\n \t])([ \t]+\n|\t[\t ]*|[ \t]{2,})/g;
|
|
90
90
|
|
|
91
|
-
// eslint-disable-next-line no-constant-condition
|
|
92
91
|
while (true) {
|
|
93
92
|
const offender = matcher.exec(text);
|
|
94
93
|
if (offender === null) {
|
|
@@ -99,7 +98,7 @@ module.exports = {
|
|
|
99
98
|
const indexStart = node.range[0] + matcher.lastIndex - space.length;
|
|
100
99
|
const indexEnd = indexStart + space.length;
|
|
101
100
|
|
|
102
|
-
const hasOverlap = isOverlapWithTemplates(node.
|
|
101
|
+
const hasOverlap = isOverlapWithTemplates(node.parts, [
|
|
103
102
|
indexStart,
|
|
104
103
|
indexEnd,
|
|
105
104
|
]);
|
|
@@ -62,7 +62,7 @@ module.exports = {
|
|
|
62
62
|
/**
|
|
63
63
|
* @param {string[]} lines
|
|
64
64
|
* @param {number} lineOffset
|
|
65
|
-
* @param {((CommentContent | Text)['
|
|
65
|
+
* @param {((CommentContent | Text)['parts'][number])[]} tokens
|
|
66
66
|
*/
|
|
67
67
|
function check(lines, lineOffset, tokens) {
|
|
68
68
|
/** @type {number[]} */
|
|
@@ -50,7 +50,7 @@ module.exports = {
|
|
|
50
50
|
const href = findAttr(node, "href");
|
|
51
51
|
if (href && href.value && isExternalLink(href.value.value)) {
|
|
52
52
|
const rel = findAttr(node, "rel");
|
|
53
|
-
if (rel && rel.value && rel.value.
|
|
53
|
+
if (rel && rel.value && rel.value.parts.length) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -45,7 +45,7 @@ module.exports = {
|
|
|
45
45
|
* @param {string} source
|
|
46
46
|
* @param {string[]} lines
|
|
47
47
|
* @param {number} rangeOffset
|
|
48
|
-
* @param {((CommentContent | Text)['
|
|
48
|
+
* @param {((CommentContent | Text)['parts'][number])[]} tokens
|
|
49
49
|
*/
|
|
50
50
|
function check(source, lines, rangeOffset, tokens) {
|
|
51
51
|
let rangeIndex = rangeOffset;
|
|
@@ -20,7 +20,8 @@ const MESSAGE_IDS = {
|
|
|
20
20
|
function getProtocol(url) {
|
|
21
21
|
try {
|
|
22
22
|
return new URL(url).protocol;
|
|
23
|
-
|
|
23
|
+
// eslint-disable-next-line no-unused-vars
|
|
24
|
+
} catch (_) {
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -87,7 +88,7 @@ module.exports = {
|
|
|
87
88
|
*/
|
|
88
89
|
function check(node) {
|
|
89
90
|
const attributeValue = getResourceAttributeValue(node);
|
|
90
|
-
if (attributeValue && !attributeValue.
|
|
91
|
+
if (attributeValue && !attributeValue.parts.length) {
|
|
91
92
|
const protocol = getProtocol(attributeValue.value);
|
|
92
93
|
if (protocol === "http:") {
|
|
93
94
|
context.report({
|
package/lib/rules/quotes.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const { RULE_CATEGORY } = require("../constants");
|
|
11
|
+
const { getSourceCode } = require("./utils/source-code");
|
|
11
12
|
const { createVisitors } = require("./utils/visitors");
|
|
12
13
|
|
|
13
14
|
const MESSAGE_IDS = {
|
|
@@ -56,7 +57,7 @@ module.exports = {
|
|
|
56
57
|
: QUOTES_STYLES.DOUBLE;
|
|
57
58
|
const expectedQuote = SELECTED_STYLE === QUOTES_STYLES.DOUBLE ? `"` : `'`;
|
|
58
59
|
|
|
59
|
-
const sourceCode =
|
|
60
|
+
const sourceCode = getSourceCode(context);
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* @param {Range} range
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @typedef { import("../types").RuleModule } RuleModule
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
const { NodeTypes } = require("es-html-parser");
|
|
5
6
|
const { RULE_CATEGORY } = require("../constants");
|
|
6
7
|
const { findAttr } = require("./utils/node");
|
|
7
8
|
const { createVisitors } = require("./utils/visitors");
|
|
@@ -63,8 +64,8 @@ module.exports = {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
if (
|
|
66
|
-
method.value.
|
|
67
|
-
method.value.
|
|
67
|
+
method.value.parts &&
|
|
68
|
+
method.value.parts.some((part) => part.type !== NodeTypes.Part)
|
|
68
69
|
) {
|
|
69
70
|
return;
|
|
70
71
|
}
|
package/lib/rules/utils/node.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @typedef { import("../../types").AnyNode } AnyNode
|
|
11
11
|
* @typedef { import("../../types").AttributeValue } AttributeValue
|
|
12
12
|
* @typedef { import("../../types").AttributeKey } AttributeKey
|
|
13
|
+
* @typedef { import("../../types").TemplateText } TemplateText
|
|
13
14
|
* @typedef { import("eslint").AST.Range } Range
|
|
14
15
|
* @typedef { import("eslint").AST.SourceLocation } SourceLocation
|
|
15
16
|
* @typedef { import("es-html-parser").AnyToken } AnyToken
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
const { NODE_TYPES } = require("@html-eslint/parser");
|
|
21
|
+
const { NodeTypes, TokenTypes } = require("es-html-parser");
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* @param {Tag | ScriptTag | StyleTag} node
|
|
@@ -58,22 +60,22 @@ function isRangesOverlap(rangeA, rangeB) {
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
|
-
* @param {(Text | CommentContent)['
|
|
63
|
+
* @param {(Text | CommentContent)['parts']} parts
|
|
62
64
|
* @param {Range} range
|
|
63
65
|
* @returns {boolean}
|
|
64
66
|
*/
|
|
65
|
-
function isOverlapWithTemplates(
|
|
66
|
-
return
|
|
67
|
-
.filter((
|
|
68
|
-
.some((
|
|
67
|
+
function isOverlapWithTemplates(parts, range) {
|
|
68
|
+
return parts
|
|
69
|
+
.filter((part) => part.type !== NodeTypes.Part)
|
|
70
|
+
.some((part) => isRangesOverlap(part.range, range));
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
/**
|
|
72
|
-
* @param {AttributeKey} node
|
|
74
|
+
* @param {AttributeKey | AttributeValue | Text | CommentContent} node
|
|
73
75
|
* @returns {boolean}
|
|
74
76
|
*/
|
|
75
77
|
function hasTemplate(node) {
|
|
76
|
-
return node.
|
|
78
|
+
return node.parts.some((part) => part.type !== NodeTypes.Part);
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
/**
|
|
@@ -89,15 +91,15 @@ function splitToLineNodes(node) {
|
|
|
89
91
|
* @type {Line[]}
|
|
90
92
|
*/
|
|
91
93
|
const lineNodes = [];
|
|
92
|
-
const
|
|
94
|
+
const parts = node.parts || [];
|
|
93
95
|
/**
|
|
94
96
|
*
|
|
95
97
|
* @param {Range} range
|
|
96
98
|
*/
|
|
97
|
-
function
|
|
98
|
-
return
|
|
99
|
-
(
|
|
100
|
-
|
|
99
|
+
function hasTemplate(range) {
|
|
100
|
+
return parts.some(
|
|
101
|
+
(part) =>
|
|
102
|
+
part.type !== NodeTypes.Part && isRangesOverlap(part.range, range)
|
|
101
103
|
);
|
|
102
104
|
}
|
|
103
105
|
|
|
@@ -125,7 +127,7 @@ function splitToLineNodes(node) {
|
|
|
125
127
|
value,
|
|
126
128
|
range,
|
|
127
129
|
loc,
|
|
128
|
-
|
|
130
|
+
hasTemplate: hasTemplate(range),
|
|
129
131
|
};
|
|
130
132
|
|
|
131
133
|
start += value.length + 1;
|
|
@@ -150,17 +152,6 @@ function getLocBetween(before, after) {
|
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
/**
|
|
154
|
-
* @param {AttributeValue} node
|
|
155
|
-
* @return {boolean}
|
|
156
|
-
*/
|
|
157
|
-
function isExpressionInTemplate(node) {
|
|
158
|
-
if (node.type === NODE_TYPES.AttributeValue) {
|
|
159
|
-
return node.value.indexOf("${") === 0;
|
|
160
|
-
}
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
155
|
/**
|
|
165
156
|
* @param {AnyNode} node
|
|
166
157
|
* @returns {node is Tag}
|
|
@@ -194,7 +185,7 @@ function isText(node) {
|
|
|
194
185
|
}
|
|
195
186
|
|
|
196
187
|
/**
|
|
197
|
-
* @param {AnyNode | Line} node
|
|
188
|
+
* @param {AnyNode | Line | TemplateText} node
|
|
198
189
|
* @returns {node is Line}
|
|
199
190
|
*/
|
|
200
191
|
function isLine(node) {
|
|
@@ -235,7 +226,7 @@ function findParent(node, predicate) {
|
|
|
235
226
|
/**
|
|
236
227
|
*
|
|
237
228
|
* @param {AnyToken[]} tokens
|
|
238
|
-
* @returns {((CommentContent | Text)['
|
|
229
|
+
* @returns {((CommentContent | Text)['parts'][number])[]}
|
|
239
230
|
*/
|
|
240
231
|
function getTemplateTokens(tokens) {
|
|
241
232
|
return (
|
|
@@ -243,10 +234,10 @@ function getTemplateTokens(tokens) {
|
|
|
243
234
|
.concat(
|
|
244
235
|
...tokens
|
|
245
236
|
// @ts-ignore
|
|
246
|
-
.map((token) => token["
|
|
237
|
+
.map((token) => token["parts"] || [])
|
|
247
238
|
)
|
|
248
239
|
// @ts-ignore
|
|
249
|
-
.filter((token) => token.
|
|
240
|
+
.filter((token) => token.type !== TokenTypes.Part)
|
|
250
241
|
);
|
|
251
242
|
}
|
|
252
243
|
|
|
@@ -257,7 +248,6 @@ module.exports = {
|
|
|
257
248
|
splitToLineNodes,
|
|
258
249
|
getLocBetween,
|
|
259
250
|
findParent,
|
|
260
|
-
isExpressionInTemplate,
|
|
261
251
|
isTag,
|
|
262
252
|
isComment,
|
|
263
253
|
isText,
|
package/lib/types/ast.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export interface Text extends Parser.TextNode {
|
|
|
150
150
|
export interface Line {
|
|
151
151
|
type: "Line";
|
|
152
152
|
value: string;
|
|
153
|
-
|
|
153
|
+
hasTemplate: boolean;
|
|
154
154
|
range: eslint.AST.Range;
|
|
155
155
|
loc: eslint.AST.SourceLocation;
|
|
156
156
|
}
|
|
@@ -169,6 +169,8 @@ export interface TemplateLiteral extends estree.TemplateLiteral {
|
|
|
169
169
|
range: eslint.AST.Range;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
export type TemplateText = Text["parts"][number];
|
|
173
|
+
|
|
172
174
|
export type AnyNode =
|
|
173
175
|
| Document
|
|
174
176
|
| Doctype
|
|
@@ -201,4 +203,5 @@ export type AnyNode =
|
|
|
201
203
|
| Text
|
|
202
204
|
| Line
|
|
203
205
|
| TaggedTemplateExpression
|
|
204
|
-
| TemplateLiteral
|
|
206
|
+
| TemplateLiteral
|
|
207
|
+
| Parser.TemplateNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-eslint/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0-alpha.0",
|
|
4
4
|
"description": "ESLint plugin for html",
|
|
5
5
|
"author": "yeonjuan",
|
|
6
6
|
"homepage": "https://github.com/yeonjuan/html-eslint#readme",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"test": "jest --coverage",
|
|
28
28
|
"ts": "tsc",
|
|
29
|
-
"lint": "eslint
|
|
29
|
+
"lint": "eslint",
|
|
30
30
|
"build": "tsc -p ./tsconfig.build.json"
|
|
31
31
|
},
|
|
32
32
|
"bugs": {
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"accessibility"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@html-eslint/template-parser": "^0.
|
|
49
|
-
"@html-eslint/template-syntax-parser": "^0.
|
|
48
|
+
"@html-eslint/template-parser": "^0.35.0-alpha.0",
|
|
49
|
+
"@html-eslint/template-syntax-parser": "^0.35.0-alpha.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@html-eslint/parser": "^0.
|
|
52
|
+
"@html-eslint/parser": "^0.35.0-alpha.0",
|
|
53
53
|
"@types/eslint": "^9.6.1",
|
|
54
54
|
"@types/estree": "^0.0.47",
|
|
55
|
-
"es-html-parser": "
|
|
56
|
-
"eslint": "^
|
|
55
|
+
"es-html-parser": "0.1.0",
|
|
56
|
+
"eslint": "^9",
|
|
57
57
|
"espree": "^10.3.0",
|
|
58
58
|
"typescript": "^5.7.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "11e54582febabbd6482509b63da7822ab786706b"
|
|
61
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-naming-convention.d.ts","sourceRoot":"","sources":["../../lib/rules/id-naming-convention.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"id-naming-convention.d.ts","sourceRoot":"","sources":["../../lib/rules/id-naming-convention.js"],"names":[],"mappings":";;;wBAqCU,UAAU;;kBApCN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;iBACtB,OAAO,UAAU,EAAE,SAAS;gBAC5B,OAAO,UAAU,EAAE,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare namespace _exports {
|
|
2
|
-
export { RuleModule, AnyNode, Line, Tag, RuleListener, Context, Token, SourceCode, Range, SourceLocation, TemplateLiteral, IndentType, MessageId, IndentOptionInfo };
|
|
2
|
+
export { RuleModule, AnyNode, Line, Tag, RuleListener, Context, TemplateText, Token, SourceCode, Range, SourceLocation, TemplateLiteral, IndentType, MessageId, IndentOptionInfo };
|
|
3
3
|
}
|
|
4
4
|
declare const _exports: RuleModule;
|
|
5
5
|
export = _exports;
|
|
@@ -9,6 +9,7 @@ type Line = import("../../types").Line;
|
|
|
9
9
|
type Tag = import("../../types").Tag;
|
|
10
10
|
type RuleListener = import("../../types").RuleListener;
|
|
11
11
|
type Context = import("../../types").Context;
|
|
12
|
+
type TemplateText = import("../../types").TemplateText;
|
|
12
13
|
type Token = import("eslint").AST.Token;
|
|
13
14
|
type SourceCode = import("eslint").SourceCode;
|
|
14
15
|
type Range = import("eslint").AST.Range;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indent.d.ts","sourceRoot":"","sources":["../../../lib/rules/indent/indent.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"indent.d.ts","sourceRoot":"","sources":["../../../lib/rules/indent/indent.js"],"names":[],"mappings":";;;wBAwDU,UAAU;;kBAvDN,OAAO,aAAa,EAAE,UAAU;eAChC,OAAO,aAAa,EAAE,OAAO;YAC7B,OAAO,aAAa,EAAE,IAAI;WAC1B,OAAO,aAAa,EAAE,GAAG;oBACzB,OAAO,aAAa,EAAE,YAAY;eAClC,OAAO,aAAa,EAAE,OAAO;oBAC7B,OAAO,aAAa,EAAE,YAAY;aAClC,OAAO,QAAQ,EAAE,GAAG,CAAC,KAAK;kBAC1B,OAAO,QAAQ,EAAE,UAAU;aAC3B,OAAO,QAAQ,EAAE,GAAG,CAAC,KAAK;sBAC1B,OAAO,QAAQ,EAAE,GAAG,CAAC,cAAc;uBACnC,OAAO,aAAa,EAAE,eAAe;;SAIrC,KAAK;WACL,OAAO;;;kBAEP,aAAa;;;gBAEb,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;gBACvC,MAAM;gBACN,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-extra-spacing-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/no-extra-spacing-attrs.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"no-extra-spacing-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/no-extra-spacing-attrs.js"],"names":[],"mappings":";;;wBAmCU,UAAU;;kBAlCN,OAAO,UAAU,EAAE,UAAU;iBAC7B,OAAO,UAAU,EAAE,SAAS;kBAC5B,OAAO,UAAU,EAAE,UAAU;wBAC7B,OAAO,UAAU,EAAE,gBAAgB;uBACnC,OAAO,UAAU,EAAE,eAAe;0BAClC,OAAO,UAAU,EAAE,kBAAkB;oBACrC,OAAO,UAAU,EAAE,YAAY;yBAC/B,OAAO,UAAU,EAAE,iBAAiB;WACpC,OAAO,UAAU,EAAE,GAAG;gBACtB,OAAO,UAAU,EAAE,QAAQ;iBAC3B,OAAO,UAAU,EAAE,SAAS;eAC5B,OAAO,UAAU,EAAE,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-https.d.ts","sourceRoot":"","sources":["../../lib/rules/prefer-https.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"prefer-https.d.ts","sourceRoot":"","sources":["../../lib/rules/prefer-https.js"],"names":[],"mappings":";;;wBAmEU,UAAU;;kBAlEN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;iBACtB,OAAO,UAAU,EAAE,SAAS;iBAC5B,OAAO,UAAU,EAAE,SAAS;sBAC5B,OAAO,UAAU,EAAE,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../lib/rules/quotes.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../lib/rules/quotes.js"],"names":[],"mappings":";;;wBA0BU,UAAU;;aAzBN,OAAO,QAAQ,EAAE,GAAG,CAAC,KAAK;kBAC1B,OAAO,UAAU,EAAE,UAAU;iBAC7B,OAAO,UAAU,EAAE,SAAS;WAC5B,OAAO,UAAU,EAAE,GAAG;iBACtB,OAAO,UAAU,EAAE,SAAS;gBAC5B,OAAO,UAAU,EAAE,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-form-method.d.ts","sourceRoot":"","sources":["../../lib/rules/require-form-method.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"require-form-method.d.ts","sourceRoot":"","sources":["../../lib/rules/require-form-method.js"],"names":[],"mappings":";;;wBAkBU,UAAU;;kBAjBN,OAAO,UAAU,EAAE,UAAU"}
|
|
@@ -9,6 +9,7 @@ export type Comment = import("../../types").Comment;
|
|
|
9
9
|
export type AnyNode = import("../../types").AnyNode;
|
|
10
10
|
export type AttributeValue = import("../../types").AttributeValue;
|
|
11
11
|
export type AttributeKey = import("../../types").AttributeKey;
|
|
12
|
+
export type TemplateText = import("../../types").TemplateText;
|
|
12
13
|
export type Range = import("eslint").AST.Range;
|
|
13
14
|
export type SourceLocation = import("eslint").AST.SourceLocation;
|
|
14
15
|
export type AnyToken = import("es-html-parser").AnyToken;
|
|
@@ -53,11 +54,6 @@ export function getLocBetween(before: {
|
|
|
53
54
|
* @returns {null | AnyNode}
|
|
54
55
|
*/
|
|
55
56
|
export function findParent(node: Exclude<AnyNode, Line>, predicate: (node: AnyNode) => boolean): null | AnyNode;
|
|
56
|
-
/**
|
|
57
|
-
* @param {AttributeValue} node
|
|
58
|
-
* @return {boolean}
|
|
59
|
-
*/
|
|
60
|
-
export function isExpressionInTemplate(node: AttributeValue): boolean;
|
|
61
57
|
/**
|
|
62
58
|
* @param {AnyNode} node
|
|
63
59
|
* @returns {node is Tag}
|
|
@@ -74,21 +70,21 @@ export function isComment(node: AnyNode): node is Comment;
|
|
|
74
70
|
*/
|
|
75
71
|
export function isText(node: AnyNode): node is Text;
|
|
76
72
|
/**
|
|
77
|
-
* @param {AnyNode | Line} node
|
|
73
|
+
* @param {AnyNode | Line | TemplateText} node
|
|
78
74
|
* @returns {node is Line}
|
|
79
75
|
*/
|
|
80
|
-
export function isLine(node: AnyNode | Line): node is Line;
|
|
76
|
+
export function isLine(node: AnyNode | Line | TemplateText): node is Line;
|
|
81
77
|
/**
|
|
82
78
|
* @param {AnyNode} node
|
|
83
79
|
* @returns {node is ScriptTag}
|
|
84
80
|
*/
|
|
85
81
|
export function isScript(node: AnyNode): node is ScriptTag;
|
|
86
82
|
/**
|
|
87
|
-
* @param {(Text | CommentContent)['
|
|
83
|
+
* @param {(Text | CommentContent)['parts']} parts
|
|
88
84
|
* @param {Range} range
|
|
89
85
|
* @returns {boolean}
|
|
90
86
|
*/
|
|
91
|
-
export function isOverlapWithTemplates(
|
|
87
|
+
export function isOverlapWithTemplates(parts: (Text | CommentContent)["parts"], range: Range): boolean;
|
|
92
88
|
/**
|
|
93
89
|
* @param {string} source
|
|
94
90
|
* @returns {string[]}
|
|
@@ -104,12 +100,12 @@ export function isRangesOverlap(rangeA: Range, rangeB: Range): boolean;
|
|
|
104
100
|
/**
|
|
105
101
|
*
|
|
106
102
|
* @param {AnyToken[]} tokens
|
|
107
|
-
* @returns {((CommentContent | Text)['
|
|
103
|
+
* @returns {((CommentContent | Text)['parts'][number])[]}
|
|
108
104
|
*/
|
|
109
|
-
export function getTemplateTokens(tokens: AnyToken[]): ((CommentContent | Text)["
|
|
105
|
+
export function getTemplateTokens(tokens: AnyToken[]): ((CommentContent | Text)["parts"][number])[];
|
|
110
106
|
/**
|
|
111
|
-
* @param {AttributeKey} node
|
|
107
|
+
* @param {AttributeKey | AttributeValue | Text | CommentContent} node
|
|
112
108
|
* @returns {boolean}
|
|
113
109
|
*/
|
|
114
|
-
export function hasTemplate(node: AttributeKey): boolean;
|
|
110
|
+
export function hasTemplate(node: AttributeKey | AttributeValue | Text | CommentContent): boolean;
|
|
115
111
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/node.js"],"names":[],"mappings":"wBACc,OAAO,aAAa,EAAE,SAAS;kBAC/B,OAAO,aAAa,EAAE,GAAG;wBACzB,OAAO,aAAa,EAAE,SAAS;uBAC/B,OAAO,aAAa,EAAE,QAAQ;mBAC9B,OAAO,aAAa,EAAE,IAAI;mBAC1B,OAAO,aAAa,EAAE,IAAI;6BAC1B,OAAO,aAAa,EAAE,cAAc;sBACpC,OAAO,aAAa,EAAE,OAAO;sBAC7B,OAAO,aAAa,EAAE,OAAO;6BAC7B,OAAO,aAAa,EAAE,cAAc;2BACpC,OAAO,aAAa,EAAE,YAAY;oBAClC,OAAO,QAAQ,EAAE,GAAG,CAAC,KAAK;6BAC1B,OAAO,QAAQ,EAAE,GAAG,CAAC,cAAc;uBACnC,OAAO,gBAAgB,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/node.js"],"names":[],"mappings":"wBACc,OAAO,aAAa,EAAE,SAAS;kBAC/B,OAAO,aAAa,EAAE,GAAG;wBACzB,OAAO,aAAa,EAAE,SAAS;uBAC/B,OAAO,aAAa,EAAE,QAAQ;mBAC9B,OAAO,aAAa,EAAE,IAAI;mBAC1B,OAAO,aAAa,EAAE,IAAI;6BAC1B,OAAO,aAAa,EAAE,cAAc;sBACpC,OAAO,aAAa,EAAE,OAAO;sBAC7B,OAAO,aAAa,EAAE,OAAO;6BAC7B,OAAO,aAAa,EAAE,cAAc;2BACpC,OAAO,aAAa,EAAE,YAAY;2BAClC,OAAO,aAAa,EAAE,YAAY;oBAClC,OAAO,QAAQ,EAAE,GAAG,CAAC,KAAK;6BAC1B,OAAO,QAAQ,EAAE,GAAG,CAAC,cAAc;uBACnC,OAAO,gBAAgB,EAAE,QAAQ;AAO/C;;;;GAIG;AACH,+BAJW,GAAG,GAAG,SAAS,GAAG,QAAQ,OAC1B,MAAM,GACJ,SAAS,GAAG,SAAS,CAMjC;AAED;;;;GAIG;AACH,wCAHW,GAAG,GAAG,SAAS,GAAG,QAAQ,GACxB,OAAO,CAInB;AAED;;;;GAIG;AACH,6CAHW,OAAO,GACL,OAAO,CAInB;AA+BD;;;;GAIG;AACH,uCAHW,IAAI,GAAG,cAAc,GACnB,IAAI,EAAE,CAwDlB;AAED;;;;;GAKG;AACH,sCAJW;IAAC,GAAG,EAAE,cAAc,CAAA;CAAC,SACrB;IAAC,GAAG,EAAE,cAAc,CAAA;CAAC,GACnB,cAAc,CAO1B;AAoDD;;;;GAIG;AACH,iCAJW,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,aACtB,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,GACxB,IAAI,GAAG,OAAO,CAgB1B;AArED;;;GAGG;AACH,4BAHW,OAAO,GACL,IAAI,IAAI,GAAG,CAIvB;AAUD;;;GAGG;AACH,gCAHW,OAAO,GACL,IAAI,IAAI,OAAO,CAI3B;AAED;;;GAGG;AACH,6BAHW,OAAO,GACL,IAAI,IAAI,IAAI,CAIxB;AAED;;;GAGG;AACH,6BAHW,OAAO,GAAG,IAAI,GAAG,YAAY,GAC3B,IAAI,IAAI,IAAI,CAIxB;AA9BD;;;GAGG;AACH,+BAHW,OAAO,GACL,IAAI,IAAI,SAAS,CAI7B;AA3GD;;;;GAIG;AACH,8CAJW,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC,OAAO,CAAC,SAChC,KAAK,GACH,OAAO,CAMnB;AA8HD;;;GAGG;AACH,oCAHW,MAAM,GACJ,MAAM,EAAE,CAIpB;AAvJD;;;;;GAKG;AACH,wCAJW,KAAK,UACL,KAAK,GACH,OAAO,CAInB;AAsKD;;;;GAIG;AACH,0CAHW,QAAQ,EAAE,GACR,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAaxD;AAzKD;;;GAGG;AACH,kCAHW,YAAY,GAAG,cAAc,GAAG,IAAI,GAAG,cAAc,GACnD,OAAO,CAInB"}
|
package/types/rules/indent.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare namespace _exports {
|
|
2
|
-
export { RuleModule, AnyNode, LineNode, BaseNode, TagNode, RuleListener, Token, SourceCode, TemplateLiteral, IndentType, MessageId };
|
|
3
|
-
}
|
|
4
|
-
declare const _exports: RuleModule;
|
|
5
|
-
export = _exports;
|
|
6
|
-
type RuleModule = import("../types").RuleModule;
|
|
7
|
-
type AnyNode = import("../types").AnyNode;
|
|
8
|
-
type LineNode = import("../types").LineNode;
|
|
9
|
-
type BaseNode = import("../types").BaseNode;
|
|
10
|
-
type TagNode = import("../types").TagNode;
|
|
11
|
-
type RuleListener = import("../types").RuleListener;
|
|
12
|
-
type Token = import("eslint").AST.Token;
|
|
13
|
-
type SourceCode = import("eslint").SourceCode;
|
|
14
|
-
type TemplateLiteral = import("estree").TemplateLiteral;
|
|
15
|
-
type IndentType = {
|
|
16
|
-
TAB: "tab";
|
|
17
|
-
SPACE: "space";
|
|
18
|
-
};
|
|
19
|
-
type MessageId = {
|
|
20
|
-
WRONG_INDENT: "wrongIndent";
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=indent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indent.d.ts","sourceRoot":"","sources":["../../lib/rules/indent.js"],"names":[],"mappings":";;;wBAyCU,UAAU;;kBAxCN,OAAO,UAAU,EAAE,UAAU;eAC7B,OAAO,UAAU,EAAE,OAAO;gBAC1B,OAAO,UAAU,EAAE,QAAQ;gBAC3B,OAAO,UAAU,EAAE,QAAQ;eAC3B,OAAO,UAAU,EAAE,OAAO;oBAC1B,OAAO,UAAU,EAAE,YAAY;aAC/B,OAAO,QAAQ,EAAE,GAAG,CAAC,KAAK;kBAC1B,OAAO,QAAQ,EAAE,UAAU;uBAC3B,OAAO,QAAQ,EAAE,eAAe;;SAEhC,KAAK;WACL,OAAO;;;kBAEP,aAAa"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|