@html-eslint/eslint-plugin 0.34.0 → 0.35.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.
@@ -6,22 +6,24 @@
6
6
  * @typedef { import("../types").ScriptTag } ScriptTag
7
7
  * @typedef { import("../types").StyleTag } StyleTag
8
8
  * @typedef { import("../types").Text } Text
9
- * @typedef { Tag | Doctype | ScriptTag | StyleTag | Text } NewlineNode
10
- * @typedef {{
11
- * childFirst: NewlineNode | null;
12
- * childLast: NewlineNode | null;
13
- * shouldBeNewline: boolean;
14
- * }} NodeMeta
9
+ * @typedef { import("../types").AnyNode } AnyNode
10
+ * @typedef { import("../types").OpenTagEnd } OpenTagEnd
11
+ * @typedef { import("../types").CloseTag } CloseTag
15
12
  */
16
13
 
17
14
  const { RULE_CATEGORY } = require("../constants");
18
- const { isTag, isComment, isText } = require("./utils/node");
15
+ const {
16
+ isTag,
17
+ isComment,
18
+ isText,
19
+ splitToLineNodes,
20
+ isLine,
21
+ isScript,
22
+ isStyle,
23
+ } = require("./utils/node");
19
24
  const { createVisitors } = require("./utils/visitors");
20
25
  const MESSAGE_IDS = {
21
26
  EXPECT_NEW_LINE_AFTER: "expectAfter",
22
- EXPECT_NEW_LINE_AFTER_OPEN: "expectAfterOpen",
23
- EXPECT_NEW_LINE_BEFORE: "expectBefore",
24
- EXPECT_NEW_LINE_BEFORE_CLOSE: "expectBeforeClose",
25
27
  };
26
28
 
27
29
  /**
@@ -100,167 +102,169 @@ module.exports = {
100
102
  ],
101
103
  messages: {
102
104
  [MESSAGE_IDS.EXPECT_NEW_LINE_AFTER]:
103
- "There should be a linebreak after {{tag}} element.",
104
- [MESSAGE_IDS.EXPECT_NEW_LINE_AFTER_OPEN]:
105
- "There should be a linebreak after {{tag}} open.",
106
- [MESSAGE_IDS.EXPECT_NEW_LINE_BEFORE]:
107
- "There should be a linebreak before {{tag}} element.",
108
- [MESSAGE_IDS.EXPECT_NEW_LINE_BEFORE_CLOSE]:
109
- "There should be a linebreak before {{tag}} close.",
105
+ "There should be a linebreak after {{name}}.",
110
106
  },
111
107
  },
112
108
 
113
109
  create(context) {
114
110
  const option = context.options[0] || {};
115
- const skipTags = option.skip || [];
111
+ /**
112
+ * @type {string[]}
113
+ */
114
+ const skipTags = option.skip || ["pre", "code"];
116
115
  const inlineTags = optionsOrPresets(option.inline || []);
117
116
 
118
117
  /**
119
- * @param {Array<NewlineNode>} siblings
120
- * @returns {NodeMeta} meta
118
+ * @param {AnyNode[]} children
119
+ * @returns {Exclude<AnyNode, Text>[]}
121
120
  */
122
- function checkSiblings(siblings) {
121
+ function getChildrenToCheck(children) {
123
122
  /**
124
- * @type {NodeMeta}
123
+ * @type {Exclude<AnyNode, Text>[]}
125
124
  */
126
- const meta = {
127
- childFirst: null,
128
- childLast: null,
129
- shouldBeNewline: false,
130
- };
131
-
132
- const nodesWithContent = [];
133
- for (
134
- let length = siblings.length, index = 0;
135
- index < length;
136
- index += 1
137
- ) {
138
- const node = siblings[index];
125
+ const childrenToCheck = [];
139
126
 
140
- if (isEmptyText(node) === false) {
141
- nodesWithContent.push(node);
127
+ for (const child of children) {
128
+ if (isText(child)) {
129
+ const lines = splitToLineNodes(child);
130
+ childrenToCheck.push(...lines);
131
+ continue;
142
132
  }
133
+ childrenToCheck.push(child);
143
134
  }
135
+ return childrenToCheck.filter((child) => !isEmptyText(child));
136
+ }
144
137
 
145
- for (
146
- let length = nodesWithContent.length, index = 0;
147
- index < length;
148
- index += 1
149
- ) {
150
- const node = nodesWithContent[index];
151
- const nodeNext = nodesWithContent[index + 1];
138
+ /**
139
+ * @param {AnyNode} before
140
+ * @param {AnyNode} after
141
+ * @returns {boolean}
142
+ */
143
+ function isOnTheSameLine(before, after) {
144
+ return before.loc.end.line === after.loc.start.line;
145
+ }
152
146
 
153
- if (meta.childFirst === null) {
154
- meta.childFirst = node;
155
- }
147
+ /**
148
+ * @param {AnyNode} node
149
+ * @returns {boolean}
150
+ */
151
+ function shouldSkipChildren(node) {
152
+ if (isTag(node) && skipTags.includes(node.name.toLowerCase())) {
153
+ return true;
154
+ }
155
+ return false;
156
+ }
156
157
 
157
- meta.childLast = node;
158
+ /**
159
+ * @param {AnyNode} node
160
+ * @returns {boolean}
161
+ */
162
+ function isInline(node) {
163
+ return (
164
+ isLine(node) ||
165
+ (isTag(node) && inlineTags.includes(node.name.toLowerCase()))
166
+ );
167
+ }
168
+
169
+ /**
170
+ * @param {AnyNode[]} children
171
+ * @param {AnyNode} parent
172
+ * @param {[OpenTagEnd, CloseTag]} [wrapper]
173
+ */
174
+ function checkChildren(children, parent, wrapper) {
175
+ if (shouldSkipChildren(parent)) {
176
+ return;
177
+ }
158
178
 
159
- const nodeShouldBeNewline = shouldBeNewline(node);
179
+ const childrenToCheck = getChildrenToCheck(children);
180
+ const firstChild = childrenToCheck[0];
181
+ if (
182
+ wrapper &&
183
+ firstChild &&
184
+ childrenToCheck.some((child) => !isInline(child))
185
+ ) {
186
+ const open = wrapper[0];
187
+ if (isOnTheSameLine(open, firstChild)) {
188
+ context.report({
189
+ node: open,
190
+ messageId: MESSAGE_IDS.EXPECT_NEW_LINE_AFTER,
191
+ data: { name: getName(parent) },
192
+ fix(fixer) {
193
+ return fixer.insertTextAfter(open, `\n`);
194
+ },
195
+ });
196
+ }
197
+ }
160
198
 
161
- if (isTag(node) && skipTags.includes(node.name) === false) {
162
- const nodeMeta = checkSiblings(node.children);
163
- const nodeChildShouldBeNewline = nodeMeta.shouldBeNewline;
199
+ childrenToCheck.forEach((current, index) => {
200
+ const next = childrenToCheck[index + 1];
164
201
 
165
- if (nodeShouldBeNewline || nodeChildShouldBeNewline) {
166
- meta.shouldBeNewline = true;
167
- }
202
+ if (
203
+ !next ||
204
+ !isOnTheSameLine(current, next) ||
205
+ (isInline(current) && isInline(next))
206
+ ) {
207
+ return;
208
+ }
168
209
 
169
- if (
170
- nodeShouldBeNewline &&
171
- nodeChildShouldBeNewline &&
172
- nodeMeta.childFirst &&
173
- nodeMeta.childLast
174
- ) {
175
- if (
176
- node.openEnd.loc.end.line === nodeMeta.childFirst.loc.start.line
177
- ) {
178
- if (isNotNewlineStart(nodeMeta.childFirst)) {
179
- context.report({
180
- node: node,
181
- messageId: MESSAGE_IDS.EXPECT_NEW_LINE_AFTER_OPEN,
182
- data: { tag: label(node) },
183
- fix(fixer) {
184
- return fixer.insertTextAfter(node.openEnd, `\n`);
185
- },
186
- });
187
- }
188
- }
210
+ context.report({
211
+ node: current,
212
+ messageId: MESSAGE_IDS.EXPECT_NEW_LINE_AFTER,
213
+ data: { name: getName(current, { isClose: true }) },
214
+ fix(fixer) {
215
+ return fixer.insertTextAfter(current, `\n`);
216
+ },
217
+ });
218
+ });
189
219
 
190
- if (
191
- node.close &&
192
- nodeMeta.childLast.loc.end.line === node.close.loc.start.line
193
- ) {
194
- if (isNotNewlineEnd(nodeMeta.childLast)) {
195
- context.report({
196
- node: node,
197
- messageId: MESSAGE_IDS.EXPECT_NEW_LINE_BEFORE_CLOSE,
198
- data: { tag: label(node, { isClose: true }) },
199
- fix(fixer) {
200
- return fixer.insertTextBefore(node.close, `\n`);
201
- },
202
- });
203
- }
204
- }
205
- }
220
+ childrenToCheck.forEach((child) => {
221
+ if (isTag(child)) {
222
+ /**
223
+ * @type {[OpenTagEnd, CloseTag] | undefined}
224
+ */
225
+ const wrapper = child.close
226
+ ? [child.openEnd, child.close]
227
+ : undefined;
228
+ checkChildren(child.children, child, wrapper);
206
229
  }
230
+ });
207
231
 
208
- if (nodeNext && node.loc.end.line === nodeNext.loc.start.line) {
209
- if (nodeShouldBeNewline) {
210
- if (isNotNewlineStart(nodeNext)) {
211
- context.report({
212
- node: nodeNext,
213
- messageId: MESSAGE_IDS.EXPECT_NEW_LINE_AFTER,
214
- data: { tag: label(node) },
215
- fix(fixer) {
216
- return fixer.insertTextAfter(node, `\n`);
217
- },
218
- });
219
- }
220
- } else if (shouldBeNewline(nodeNext)) {
221
- if (isNotNewlineEnd(node)) {
222
- context.report({
223
- node: nodeNext,
224
- messageId: MESSAGE_IDS.EXPECT_NEW_LINE_BEFORE,
225
- data: { tag: label(nodeNext) },
226
- fix(fixer) {
227
- return fixer.insertTextBefore(nodeNext, `\n`);
228
- },
229
- });
230
- }
231
- }
232
+ const lastChild = childrenToCheck[childrenToCheck.length - 1];
233
+ if (
234
+ wrapper &&
235
+ lastChild &&
236
+ childrenToCheck.some((child) => !isInline(child))
237
+ ) {
238
+ const close = wrapper[1];
239
+ if (isOnTheSameLine(close, lastChild)) {
240
+ context.report({
241
+ node: lastChild,
242
+ messageId: MESSAGE_IDS.EXPECT_NEW_LINE_AFTER,
243
+ data: { name: getName(lastChild, { isClose: true }) },
244
+ fix(fixer) {
245
+ return fixer.insertTextAfter(lastChild, `\n`);
246
+ },
247
+ });
232
248
  }
233
249
  }
234
-
235
- return meta;
236
250
  }
237
251
 
238
252
  /**
239
- * @param {NewlineNode} node
253
+ * @param {AnyNode} node
254
+ * @returns {boolean}
240
255
  */
241
256
  function isEmptyText(node) {
242
- return node.type === `Text` && node.value.trim().length === 0;
243
- }
244
-
245
- /**
246
- * @param {NewlineNode} node
247
- */
248
- function isNotNewlineEnd(node) {
249
- return node.type !== `Text` || /(\n|\r\n)\s*$/.test(node.value) === false;
250
- }
251
-
252
- /**
253
- * @param {NewlineNode} node
254
- */
255
- function isNotNewlineStart(node) {
256
- return node.type !== `Text` || /^(\n|\r\n)/.test(node.value) === false;
257
+ return (
258
+ (isText(node) && node.value.trim().length === 0) ||
259
+ (isLine(node) && node.value.trim().length === 0)
260
+ );
257
261
  }
258
262
 
259
263
  /**
260
- * @param {NewlineNode} node
264
+ * @param {AnyNode} node
261
265
  * @param {{ isClose?: boolean }} options
262
266
  */
263
- function label(node, options = {}) {
267
+ function getName(node, options = {}) {
264
268
  const isClose = options.isClose || false;
265
269
  if (isTag(node)) {
266
270
  if (isClose) {
@@ -268,6 +272,24 @@ module.exports = {
268
272
  }
269
273
  return `<${node.name}>`;
270
274
  }
275
+ if (isLine(node)) {
276
+ return "text";
277
+ }
278
+ if (isComment(node)) {
279
+ return "comment";
280
+ }
281
+ if (isScript(node)) {
282
+ if (isClose) {
283
+ return `</script>`;
284
+ }
285
+ return "<script>";
286
+ }
287
+ if (isStyle(node)) {
288
+ if (isClose) {
289
+ return `</style>`;
290
+ }
291
+ return "<style>";
292
+ }
271
293
  return `<${node.type}>`;
272
294
  }
273
295
 
@@ -287,26 +309,9 @@ module.exports = {
287
309
  return result;
288
310
  }
289
311
 
290
- /**
291
- * @param {NewlineNode} node
292
- */
293
- function shouldBeNewline(node) {
294
- if (isComment(node)) {
295
- return /[\n\r]+/.test(node.value.value.trim());
296
- }
297
- if (isTag(node)) {
298
- return inlineTags.includes(node.name.toLowerCase()) === false;
299
- }
300
- if (isText(node)) {
301
- return /[\n\r]+/.test(node.value.trim());
302
- }
303
- return true;
304
- }
305
-
306
312
  return createVisitors(context, {
307
313
  Document(node) {
308
- // @ts-ignore
309
- checkSiblings(node.children);
314
+ checkChildren(node.children, node);
310
315
  },
311
316
  });
312
317
  },
@@ -5,11 +5,14 @@
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
11
12
  * @typedef { import("eslint").AST.SourceLocation } SourceLocation
12
13
  * @typedef { import("../../types").TemplateLiteral } TemplateLiteral
14
+ * @typedef { import("../../types").OpenTemplate } OpenTemplate
15
+ * @typedef { import("../../types").CloseTemplate } CloseTemplate
13
16
  *
14
17
  *
15
18
  * @typedef {Object} IndentType
@@ -24,8 +27,14 @@
24
27
  */
25
28
 
26
29
  const { parse } = require("@html-eslint/template-parser");
30
+ const { NodeTypes } = require("es-html-parser");
27
31
  const { RULE_CATEGORY } = require("../../constants");
28
- const { splitToLineNodes, isLine, isTag } = require("../utils/node");
32
+ const {
33
+ splitToLineNodes,
34
+ isLine,
35
+ isTag,
36
+ hasTemplate,
37
+ } = require("../utils/node");
29
38
  const {
30
39
  shouldCheckTaggedTemplateExpression,
31
40
  shouldCheckTemplateLiteral,
@@ -173,7 +182,7 @@ module.exports = {
173
182
  let parentIgnoringChildCount = 0;
174
183
 
175
184
  /**
176
- * @param {AnyNode | Line} node
185
+ * @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate} node
177
186
  * @returns {string}
178
187
  */
179
188
  function getActualIndent(node) {
@@ -228,7 +237,7 @@ module.exports = {
228
237
  }
229
238
 
230
239
  /**
231
- * @param {AnyNode | Line} node
240
+ * @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate} node
232
241
  */
233
242
  function checkIndent(node) {
234
243
  if (parentIgnoringChildCount > 0) {
@@ -303,10 +312,23 @@ module.exports = {
303
312
  },
304
313
  Text(node) {
305
314
  indentLevel.indent(node);
315
+ if (hasTemplate(node)) {
316
+ node.parts.forEach((part) => {
317
+ if (part.type !== NodeTypes.Part) {
318
+ if (part.open) {
319
+ checkIndent(part.open);
320
+ }
321
+ if (part.close) {
322
+ checkIndent(part.close);
323
+ }
324
+ }
325
+ });
326
+ }
327
+
306
328
  const lineNodes = splitToLineNodes(node);
307
329
 
308
330
  lineNodes.forEach((lineNode) => {
309
- if (lineNode.skipIndentCheck) {
331
+ if (lineNode.hasTemplate) {
310
332
  return;
311
333
  }
312
334
  if (lineNode.value.trim().length) {
@@ -323,9 +345,22 @@ module.exports = {
323
345
  CommentOpen: checkIndent,
324
346
  CommentContent(node) {
325
347
  indentLevel.indent(node);
348
+ if (hasTemplate(node)) {
349
+ node.parts.forEach((part) => {
350
+ if (part.type !== NodeTypes.Part) {
351
+ if (part.open) {
352
+ checkIndent(part.open);
353
+ }
354
+ if (part.close) {
355
+ checkIndent(part.close);
356
+ }
357
+ }
358
+ });
359
+ }
360
+
326
361
  const lineNodes = splitToLineNodes(node);
327
362
  lineNodes.forEach((lineNode) => {
328
- if (lineNode.skipIndentCheck) {
363
+ if (lineNode.hasTemplate) {
329
364
  return;
330
365
  }
331
366
  if (lineNode.value.trim().length) {
@@ -363,7 +398,7 @@ module.exports = {
363
398
  };
364
399
 
365
400
  /**
366
- * @param {AnyNode | Line} node
401
+ * @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate} node
367
402
  * @param {string} actualIndent
368
403
  * @return {{range: Range; loc: SourceLocation}}
369
404
  */
@@ -41,7 +41,7 @@ module.exports = {
41
41
  if (!ariaHiddenAttr) {
42
42
  return;
43
43
  }
44
- if (ariaHiddenAttr.value && ariaHiddenAttr.value.templates.length) {
44
+ if (ariaHiddenAttr.value && ariaHiddenAttr.value.parts.length) {
45
45
  return;
46
46
  }
47
47
 
@@ -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 = context.getSourceCode().text;
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.templates, [
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)['templates'][number])[]} tokens
65
+ * @param {((CommentContent | Text)['parts'][number])[]} tokens
66
66
  */
67
67
  function check(lines, lineOffset, tokens) {
68
68
  /** @type {number[]} */
@@ -42,7 +42,7 @@ module.exports = {
42
42
  if (
43
43
  tabIndexAttr &&
44
44
  tabIndexAttr.value &&
45
- !tabIndexAttr.value.templates.length &&
45
+ !tabIndexAttr.value.parts.length &&
46
46
  parseInt(tabIndexAttr.value.value, 10) > 0
47
47
  ) {
48
48
  context.report({
@@ -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.templates.length) {
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)['templates'][number])[]} tokens
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
- } catch (e) {
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.templates.length) {
91
+ if (attributeValue && !attributeValue.parts.length) {
91
92
  const protocol = getProtocol(attributeValue.value);
92
93
  if (protocol === "http:") {
93
94
  context.report({
@@ -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 = context.getSourceCode();
60
+ const sourceCode = getSourceCode(context);
60
61
 
61
62
  /**
62
63
  * @param {Range} range
@@ -49,7 +49,7 @@ module.exports = {
49
49
  });
50
50
  } else if (
51
51
  !VALID_BUTTON_TYPES_SET.has(typeAttr.value.value) &&
52
- !typeAttr.value.templates.length
52
+ !typeAttr.value.parts.length
53
53
  ) {
54
54
  context.report({
55
55
  node: typeAttr,
@@ -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.templates &&
67
- method.value.templates.some((template) => template.isTemplate)
67
+ method.value.parts &&
68
+ method.value.parts.some((part) => part.type !== NodeTypes.Part)
68
69
  ) {
69
70
  return;
70
71
  }
@@ -10,6 +10,10 @@
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
14
+ * @typedef { import("../../types").OpenTemplate } OpenTemplate
15
+ * @typedef { import("../../types").CloseTemplate } CloseTemplate
16
+ * @typedef { import("../../types").AnyPartNode } AnyPartNode
13
17
  * @typedef { import("eslint").AST.Range } Range
14
18
  * @typedef { import("eslint").AST.SourceLocation } SourceLocation
15
19
  * @typedef { import("es-html-parser").AnyToken } AnyToken
@@ -17,6 +21,7 @@
17
21
  */
18
22
 
19
23
  const { NODE_TYPES } = require("@html-eslint/parser");
24
+ const { NodeTypes, TokenTypes } = require("es-html-parser");
20
25
 
21
26
  /**
22
27
  * @param {Tag | ScriptTag | StyleTag} node
@@ -58,22 +63,22 @@ function isRangesOverlap(rangeA, rangeB) {
58
63
  }
59
64
 
60
65
  /**
61
- * @param {(Text | CommentContent)['templates']} templates
66
+ * @param {(Text | CommentContent)['parts']} parts
62
67
  * @param {Range} range
63
68
  * @returns {boolean}
64
69
  */
65
- function isOverlapWithTemplates(templates, range) {
66
- return templates
67
- .filter((template) => template.isTemplate)
68
- .some((template) => isRangesOverlap(template.range, range));
70
+ function isOverlapWithTemplates(parts, range) {
71
+ return parts
72
+ .filter((part) => part.type !== NodeTypes.Part)
73
+ .some((part) => isRangesOverlap(part.range, range));
69
74
  }
70
75
 
71
76
  /**
72
- * @param {AttributeKey | AttributeValue} node
77
+ * @param {AttributeKey | AttributeValue | Text | CommentContent} node
73
78
  * @returns {boolean}
74
79
  */
75
80
  function hasTemplate(node) {
76
- return node.templates.some((template) => template.isTemplate);
81
+ return node.parts.some((part) => part.type !== NodeTypes.Part);
77
82
  }
78
83
 
79
84
  /**
@@ -89,15 +94,15 @@ function splitToLineNodes(node) {
89
94
  * @type {Line[]}
90
95
  */
91
96
  const lineNodes = [];
92
- const templates = node.templates || [];
97
+ const parts = node.parts || [];
93
98
  /**
94
99
  *
95
100
  * @param {Range} range
96
101
  */
97
- function shouldSkipIndentCheck(range) {
98
- return templates.some(
99
- (template) =>
100
- template.isTemplate && isRangesOverlap(template.range, range)
102
+ function hasTemplate(range) {
103
+ return parts.some(
104
+ (part) =>
105
+ part.type !== NodeTypes.Part && isRangesOverlap(part.range, range)
101
106
  );
102
107
  }
103
108
 
@@ -125,7 +130,7 @@ function splitToLineNodes(node) {
125
130
  value,
126
131
  range,
127
132
  loc,
128
- skipIndentCheck: shouldSkipIndentCheck(range),
133
+ hasTemplate: hasTemplate(range),
129
134
  };
130
135
 
131
136
  start += value.length + 1;
@@ -166,6 +171,14 @@ function isScript(node) {
166
171
  return node.type === NODE_TYPES.ScriptTag;
167
172
  }
168
173
 
174
+ /**
175
+ * @param {AnyNode} node
176
+ * @returns {node is StyleTag}
177
+ */
178
+ function isStyle(node) {
179
+ return node.type === NODE_TYPES.StyleTag;
180
+ }
181
+
169
182
  /**
170
183
  * @param {AnyNode} node
171
184
  * @returns {node is Comment}
@@ -183,7 +196,7 @@ function isText(node) {
183
196
  }
184
197
 
185
198
  /**
186
- * @param {AnyNode | Line} node
199
+ * @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate } node
187
200
  * @returns {node is Line}
188
201
  */
189
202
  function isLine(node) {
@@ -224,7 +237,7 @@ function findParent(node, predicate) {
224
237
  /**
225
238
  *
226
239
  * @param {AnyToken[]} tokens
227
- * @returns {((CommentContent | Text)['templates'][number])[]}
240
+ * @returns {((CommentContent | Text)['parts'][number])[]}
228
241
  */
229
242
  function getTemplateTokens(tokens) {
230
243
  return (
@@ -232,10 +245,10 @@ function getTemplateTokens(tokens) {
232
245
  .concat(
233
246
  ...tokens
234
247
  // @ts-ignore
235
- .map((token) => token["templates"] || [])
248
+ .map((token) => token["parts"] || [])
236
249
  )
237
250
  // @ts-ignore
238
- .filter((token) => token.isTemplate)
251
+ .filter((token) => token.type !== TokenTypes.Part)
239
252
  );
240
253
  }
241
254
 
@@ -251,6 +264,7 @@ module.exports = {
251
264
  isText,
252
265
  isLine,
253
266
  isScript,
267
+ isStyle,
254
268
  isOverlapWithTemplates,
255
269
  codeToLines,
256
270
  isRangesOverlap,
@@ -150,7 +150,7 @@ export interface Text extends Parser.TextNode {
150
150
  export interface Line {
151
151
  type: "Line";
152
152
  value: string;
153
- skipIndentCheck: boolean;
153
+ hasTemplate: boolean;
154
154
  range: eslint.AST.Range;
155
155
  loc: eslint.AST.SourceLocation;
156
156
  }
@@ -169,6 +169,15 @@ export interface TemplateLiteral extends estree.TemplateLiteral {
169
169
  range: eslint.AST.Range;
170
170
  }
171
171
 
172
+ export type TemplateText = Text["parts"][number];
173
+
174
+ export type OpenTemplate = Exclude<Parser.TemplateNode<any>["open"], undefined>;
175
+ export type CloseTemplate = Exclude<
176
+ Parser.TemplateNode<any>["close"],
177
+ undefined
178
+ >;
179
+ export type AnyPartNode = Parser.PartNode<Parser.NodeTypes>;
180
+
172
181
  export type AnyNode =
173
182
  | Document
174
183
  | Doctype
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-eslint/eslint-plugin",
3
- "version": "0.34.0",
3
+ "version": "0.35.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 . --ext .js",
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.34.0",
49
- "@html-eslint/template-syntax-parser": "^0.34.0"
48
+ "@html-eslint/template-parser": "^0.35.0",
49
+ "@html-eslint/template-syntax-parser": "^0.35.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@html-eslint/parser": "^0.34.0",
52
+ "@html-eslint/parser": "^0.35.0",
53
53
  "@types/eslint": "^9.6.1",
54
54
  "@types/estree": "^0.0.47",
55
- "es-html-parser": "^1.0.0-alpha.4",
56
- "eslint": "^8",
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": "f0401cc30d1510d6f5c7511280c0a6b9779fea0c"
60
+ "gitHead": "2493a6a72eba5e4fca3be33897050a4ea29712dd"
61
61
  }
@@ -1,5 +1,5 @@
1
1
  declare namespace _exports {
2
- export { RuleModule, Tag, Comment, Doctype, ScriptTag, StyleTag, Text, NewlineNode, NodeMeta };
2
+ export { RuleModule, Tag, Comment, Doctype, ScriptTag, StyleTag, Text, AnyNode, OpenTagEnd, CloseTag };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
@@ -10,10 +10,7 @@ type Doctype = import("../types").Doctype;
10
10
  type ScriptTag = import("../types").ScriptTag;
11
11
  type StyleTag = import("../types").StyleTag;
12
12
  type Text = import("../types").Text;
13
- type NewlineNode = Tag | Doctype | ScriptTag | StyleTag | Text;
14
- type NodeMeta = {
15
- childFirst: NewlineNode | null;
16
- childLast: NewlineNode | null;
17
- shouldBeNewline: boolean;
18
- };
13
+ type AnyNode = import("../types").AnyNode;
14
+ type OpenTagEnd = import("../types").OpenTagEnd;
15
+ type CloseTag = import("../types").CloseTag;
19
16
  //# sourceMappingURL=element-newline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"element-newline.d.ts","sourceRoot":"","sources":["../../lib/rules/element-newline.js"],"names":[],"mappings":";;;wBAmEU,UAAU;;kBAlEN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;eACtB,OAAO,UAAU,EAAE,OAAO;eAC1B,OAAO,UAAU,EAAE,OAAO;iBAC1B,OAAO,UAAU,EAAE,SAAS;gBAC5B,OAAO,UAAU,EAAE,QAAQ;YAC3B,OAAO,UAAU,EAAE,IAAI;mBACvB,GAAG,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI;gBAC5C;IACR,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;CAC1B"}
1
+ {"version":3,"file":"element-newline.d.ts","sourceRoot":"","sources":["../../lib/rules/element-newline.js"],"names":[],"mappings":";;;wBAqEU,UAAU;;kBApEN,OAAO,UAAU,EAAE,UAAU;WAC7B,OAAO,UAAU,EAAE,GAAG;eACtB,OAAO,UAAU,EAAE,OAAO;eAC1B,OAAO,UAAU,EAAE,OAAO;iBAC1B,OAAO,UAAU,EAAE,SAAS;gBAC5B,OAAO,UAAU,EAAE,QAAQ;YAC3B,OAAO,UAAU,EAAE,IAAI;eACvB,OAAO,UAAU,EAAE,OAAO;kBAC1B,OAAO,UAAU,EAAE,UAAU;gBAC7B,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, OpenTemplate, CloseTemplate, IndentType, MessageId, IndentOptionInfo };
3
3
  }
4
4
  declare const _exports: RuleModule;
5
5
  export = _exports;
@@ -9,11 +9,14 @@ 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;
15
16
  type SourceLocation = import("eslint").AST.SourceLocation;
16
17
  type TemplateLiteral = import("../../types").TemplateLiteral;
18
+ type OpenTemplate = import("../../types").OpenTemplate;
19
+ type CloseTemplate = import("../../types").CloseTemplate;
17
20
  type IndentType = {
18
21
  TAB: "tab";
19
22
  SPACE: "space";
@@ -1 +1 @@
1
- {"version":3,"file":"indent.d.ts","sourceRoot":"","sources":["../../../lib/rules/indent/indent.js"],"names":[],"mappings":";;;wBAiDU,UAAU;;kBAhDN,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;aAC7B,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
+ {"version":3,"file":"indent.d.ts","sourceRoot":"","sources":["../../../lib/rules/indent/indent.js"],"names":[],"mappings":";;;wBA0DU,UAAU;;kBAzDN,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;oBACrC,OAAO,aAAa,EAAE,YAAY;qBAClC,OAAO,aAAa,EAAE,aAAa;;SAInC,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":";;;wBAkCU,UAAU;;kBAjCN,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
+ {"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":";;;wBAkEU,UAAU;;kBAjEN,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
+ {"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":";;;wBAyBU,UAAU;;aAxBN,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
+ {"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":";;;wBAiBU,UAAU;;kBAhBN,OAAO,UAAU,EAAE,UAAU"}
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,10 @@ 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;
13
+ export type OpenTemplate = import("../../types").OpenTemplate;
14
+ export type CloseTemplate = import("../../types").CloseTemplate;
15
+ export type AnyPartNode = import("../../types").AnyPartNode;
12
16
  export type Range = import("eslint").AST.Range;
13
17
  export type SourceLocation = import("eslint").AST.SourceLocation;
14
18
  export type AnyToken = import("es-html-parser").AnyToken;
@@ -69,21 +73,26 @@ export function isComment(node: AnyNode): node is Comment;
69
73
  */
70
74
  export function isText(node: AnyNode): node is Text;
71
75
  /**
72
- * @param {AnyNode | Line} node
76
+ * @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate } node
73
77
  * @returns {node is Line}
74
78
  */
75
- export function isLine(node: AnyNode | Line): node is Line;
79
+ export function isLine(node: AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate): node is Line;
76
80
  /**
77
81
  * @param {AnyNode} node
78
82
  * @returns {node is ScriptTag}
79
83
  */
80
84
  export function isScript(node: AnyNode): node is ScriptTag;
81
85
  /**
82
- * @param {(Text | CommentContent)['templates']} templates
86
+ * @param {AnyNode} node
87
+ * @returns {node is StyleTag}
88
+ */
89
+ export function isStyle(node: AnyNode): node is StyleTag;
90
+ /**
91
+ * @param {(Text | CommentContent)['parts']} parts
83
92
  * @param {Range} range
84
93
  * @returns {boolean}
85
94
  */
86
- export function isOverlapWithTemplates(templates: (Text | CommentContent)["templates"], range: Range): boolean;
95
+ export function isOverlapWithTemplates(parts: (Text | CommentContent)["parts"], range: Range): boolean;
87
96
  /**
88
97
  * @param {string} source
89
98
  * @returns {string[]}
@@ -99,12 +108,12 @@ export function isRangesOverlap(rangeA: Range, rangeB: Range): boolean;
99
108
  /**
100
109
  *
101
110
  * @param {AnyToken[]} tokens
102
- * @returns {((CommentContent | Text)['templates'][number])[]}
111
+ * @returns {((CommentContent | Text)['parts'][number])[]}
103
112
  */
104
- export function getTemplateTokens(tokens: AnyToken[]): ((CommentContent | Text)["templates"][number])[];
113
+ export function getTemplateTokens(tokens: AnyToken[]): ((CommentContent | Text)["parts"][number])[];
105
114
  /**
106
- * @param {AttributeKey | AttributeValue} node
115
+ * @param {AttributeKey | AttributeValue | Text | CommentContent} node
107
116
  * @returns {boolean}
108
117
  */
109
- export function hasTemplate(node: AttributeKey | AttributeValue): boolean;
118
+ export function hasTemplate(node: AttributeKey | AttributeValue | Text | CommentContent): boolean;
110
119
  //# 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;AAM/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,GACZ,IAAI,IAAI,IAAI,CAIxB;AA9BD;;;GAGG;AACH,+BAHW,OAAO,GACL,IAAI,IAAI,SAAS,CAI7B;AA3GD;;;;GAIG;AACH,kDAJW,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC,WAAW,CAAC,SACpC,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,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAa5D;AAzKD;;;GAGG;AACH,kCAHW,YAAY,GAAG,cAAc,GAC3B,OAAO,CAInB"}
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;2BAClC,OAAO,aAAa,EAAE,YAAY;4BAClC,OAAO,aAAa,EAAE,aAAa;0BACnC,OAAO,aAAa,EAAE,WAAW;oBACjC,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;AA4DD;;;;GAIG;AACH,iCAJW,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,aACtB,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,GACxB,IAAI,GAAG,OAAO,CAgB1B;AA7ED;;;GAGG;AACH,4BAHW,OAAO,GACL,IAAI,IAAI,GAAG,CAIvB;AAkBD;;;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,GAAG,YAAY,GAAG,aAAa,GAC1D,IAAI,IAAI,IAAI,CAIxB;AAtCD;;;GAGG;AACH,+BAHW,OAAO,GACL,IAAI,IAAI,SAAS,CAI7B;AAED;;;GAGG;AACH,8BAHW,OAAO,GACL,IAAI,IAAI,QAAQ,CAI5B;AAnHD;;;;GAIG;AACH,8CAJW,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC,OAAO,CAAC,SAChC,KAAK,GACH,OAAO,CAMnB;AAsID;;;GAGG;AACH,oCAHW,MAAM,GACJ,MAAM,EAAE,CAIpB;AA/JD;;;;;GAKG;AACH,wCAJW,KAAK,UACL,KAAK,GACH,OAAO,CAInB;AA8KD;;;;GAIG;AACH,0CAHW,QAAQ,EAAE,GACR,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAaxD;AAjLD;;;GAGG;AACH,kCAHW,YAAY,GAAG,cAAc,GAAG,IAAI,GAAG,cAAc,GACnD,OAAO,CAInB"}
@@ -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"}