@html-eslint/eslint-plugin 0.35.0-alpha.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.
- package/lib/rules/element-newline.js +158 -153
- package/lib/rules/indent/indent.js +5 -3
- package/lib/rules/utils/node.js +13 -1
- package/lib/types/ast.d.ts +8 -2
- package/package.json +5 -5
- package/types/rules/element-newline.d.ts +4 -7
- package/types/rules/element-newline.d.ts.map +1 -1
- package/types/rules/indent/indent.d.ts +3 -1
- package/types/rules/indent/indent.d.ts.map +1 -1
- package/types/rules/utils/node.d.ts +10 -2
- package/types/rules/utils/node.d.ts.map +1 -1
|
@@ -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 {
|
|
10
|
-
* @typedef {
|
|
11
|
-
*
|
|
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 {
|
|
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 {{
|
|
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
|
-
|
|
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 {
|
|
120
|
-
* @returns {
|
|
118
|
+
* @param {AnyNode[]} children
|
|
119
|
+
* @returns {Exclude<AnyNode, Text>[]}
|
|
121
120
|
*/
|
|
122
|
-
function
|
|
121
|
+
function getChildrenToCheck(children) {
|
|
123
122
|
/**
|
|
124
|
-
* @type {
|
|
123
|
+
* @type {Exclude<AnyNode, Text>[]}
|
|
125
124
|
*/
|
|
126
|
-
const
|
|
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
|
-
|
|
141
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
154
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
const nodeChildShouldBeNewline = nodeMeta.shouldBeNewline;
|
|
199
|
+
childrenToCheck.forEach((current, index) => {
|
|
200
|
+
const next = childrenToCheck[index + 1];
|
|
164
201
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
202
|
+
if (
|
|
203
|
+
!next ||
|
|
204
|
+
!isOnTheSameLine(current, next) ||
|
|
205
|
+
(isInline(current) && isInline(next))
|
|
206
|
+
) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
168
209
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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 {
|
|
253
|
+
* @param {AnyNode} node
|
|
254
|
+
* @returns {boolean}
|
|
240
255
|
*/
|
|
241
256
|
function isEmptyText(node) {
|
|
242
|
-
return
|
|
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 {
|
|
264
|
+
* @param {AnyNode} node
|
|
261
265
|
* @param {{ isClose?: boolean }} options
|
|
262
266
|
*/
|
|
263
|
-
function
|
|
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
|
-
|
|
309
|
-
checkSiblings(node.children);
|
|
314
|
+
checkChildren(node.children, node);
|
|
310
315
|
},
|
|
311
316
|
});
|
|
312
317
|
},
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* @typedef { import("eslint").AST.Range } Range
|
|
12
12
|
* @typedef { import("eslint").AST.SourceLocation } SourceLocation
|
|
13
13
|
* @typedef { import("../../types").TemplateLiteral } TemplateLiteral
|
|
14
|
+
* @typedef { import("../../types").OpenTemplate } OpenTemplate
|
|
15
|
+
* @typedef { import("../../types").CloseTemplate } CloseTemplate
|
|
14
16
|
*
|
|
15
17
|
*
|
|
16
18
|
* @typedef {Object} IndentType
|
|
@@ -180,7 +182,7 @@ module.exports = {
|
|
|
180
182
|
let parentIgnoringChildCount = 0;
|
|
181
183
|
|
|
182
184
|
/**
|
|
183
|
-
* @param {AnyNode | Line | TemplateText} node
|
|
185
|
+
* @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate} node
|
|
184
186
|
* @returns {string}
|
|
185
187
|
*/
|
|
186
188
|
function getActualIndent(node) {
|
|
@@ -235,7 +237,7 @@ module.exports = {
|
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
/**
|
|
238
|
-
* @param {AnyNode | Line | TemplateText} node
|
|
240
|
+
* @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate} node
|
|
239
241
|
*/
|
|
240
242
|
function checkIndent(node) {
|
|
241
243
|
if (parentIgnoringChildCount > 0) {
|
|
@@ -396,7 +398,7 @@ module.exports = {
|
|
|
396
398
|
};
|
|
397
399
|
|
|
398
400
|
/**
|
|
399
|
-
* @param {AnyNode | Line | TemplateText} node
|
|
401
|
+
* @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate} node
|
|
400
402
|
* @param {string} actualIndent
|
|
401
403
|
* @return {{range: Range; loc: SourceLocation}}
|
|
402
404
|
*/
|
package/lib/rules/utils/node.js
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* @typedef { import("../../types").AttributeValue } AttributeValue
|
|
12
12
|
* @typedef { import("../../types").AttributeKey } AttributeKey
|
|
13
13
|
* @typedef { import("../../types").TemplateText } TemplateText
|
|
14
|
+
* @typedef { import("../../types").OpenTemplate } OpenTemplate
|
|
15
|
+
* @typedef { import("../../types").CloseTemplate } CloseTemplate
|
|
16
|
+
* @typedef { import("../../types").AnyPartNode } AnyPartNode
|
|
14
17
|
* @typedef { import("eslint").AST.Range } Range
|
|
15
18
|
* @typedef { import("eslint").AST.SourceLocation } SourceLocation
|
|
16
19
|
* @typedef { import("es-html-parser").AnyToken } AnyToken
|
|
@@ -168,6 +171,14 @@ function isScript(node) {
|
|
|
168
171
|
return node.type === NODE_TYPES.ScriptTag;
|
|
169
172
|
}
|
|
170
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
|
+
|
|
171
182
|
/**
|
|
172
183
|
* @param {AnyNode} node
|
|
173
184
|
* @returns {node is Comment}
|
|
@@ -185,7 +196,7 @@ function isText(node) {
|
|
|
185
196
|
}
|
|
186
197
|
|
|
187
198
|
/**
|
|
188
|
-
* @param {AnyNode | Line | TemplateText} node
|
|
199
|
+
* @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate } node
|
|
189
200
|
* @returns {node is Line}
|
|
190
201
|
*/
|
|
191
202
|
function isLine(node) {
|
|
@@ -253,6 +264,7 @@ module.exports = {
|
|
|
253
264
|
isText,
|
|
254
265
|
isLine,
|
|
255
266
|
isScript,
|
|
267
|
+
isStyle,
|
|
256
268
|
isOverlapWithTemplates,
|
|
257
269
|
codeToLines,
|
|
258
270
|
isRangesOverlap,
|
package/lib/types/ast.d.ts
CHANGED
|
@@ -171,6 +171,13 @@ export interface TemplateLiteral extends estree.TemplateLiteral {
|
|
|
171
171
|
|
|
172
172
|
export type TemplateText = Text["parts"][number];
|
|
173
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
|
+
|
|
174
181
|
export type AnyNode =
|
|
175
182
|
| Document
|
|
176
183
|
| Doctype
|
|
@@ -203,5 +210,4 @@ export type AnyNode =
|
|
|
203
210
|
| Text
|
|
204
211
|
| Line
|
|
205
212
|
| TaggedTemplateExpression
|
|
206
|
-
| TemplateLiteral
|
|
207
|
-
| Parser.TemplateNode;
|
|
213
|
+
| TemplateLiteral;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-eslint/eslint-plugin",
|
|
3
|
-
"version": "0.35.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",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"accessibility"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@html-eslint/template-parser": "^0.35.0
|
|
49
|
-
"@html-eslint/template-syntax-parser": "^0.35.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.35.0
|
|
52
|
+
"@html-eslint/parser": "^0.35.0",
|
|
53
53
|
"@types/eslint": "^9.6.1",
|
|
54
54
|
"@types/estree": "^0.0.47",
|
|
55
55
|
"es-html-parser": "0.1.0",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"espree": "^10.3.0",
|
|
58
58
|
"typescript": "^5.7.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "2493a6a72eba5e4fca3be33897050a4ea29712dd"
|
|
61
61
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare namespace _exports {
|
|
2
|
-
export { RuleModule, Tag, Comment, Doctype, ScriptTag, StyleTag, Text,
|
|
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
|
|
14
|
-
type
|
|
15
|
-
|
|
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":";;;
|
|
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, TemplateText, 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;
|
|
@@ -15,6 +15,8 @@ type SourceCode = import("eslint").SourceCode;
|
|
|
15
15
|
type Range = import("eslint").AST.Range;
|
|
16
16
|
type SourceLocation = import("eslint").AST.SourceLocation;
|
|
17
17
|
type TemplateLiteral = import("../../types").TemplateLiteral;
|
|
18
|
+
type OpenTemplate = import("../../types").OpenTemplate;
|
|
19
|
+
type CloseTemplate = import("../../types").CloseTemplate;
|
|
18
20
|
type IndentType = {
|
|
19
21
|
TAB: "tab";
|
|
20
22
|
SPACE: "space";
|
|
@@ -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":";;;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"}
|
|
@@ -10,6 +10,9 @@ export type AnyNode = import("../../types").AnyNode;
|
|
|
10
10
|
export type AttributeValue = import("../../types").AttributeValue;
|
|
11
11
|
export type AttributeKey = import("../../types").AttributeKey;
|
|
12
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;
|
|
13
16
|
export type Range = import("eslint").AST.Range;
|
|
14
17
|
export type SourceLocation = import("eslint").AST.SourceLocation;
|
|
15
18
|
export type AnyToken = import("es-html-parser").AnyToken;
|
|
@@ -70,15 +73,20 @@ export function isComment(node: AnyNode): node is Comment;
|
|
|
70
73
|
*/
|
|
71
74
|
export function isText(node: AnyNode): node is Text;
|
|
72
75
|
/**
|
|
73
|
-
* @param {AnyNode | Line | TemplateText} node
|
|
76
|
+
* @param {AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate } node
|
|
74
77
|
* @returns {node is Line}
|
|
75
78
|
*/
|
|
76
|
-
export function isLine(node: AnyNode | Line | TemplateText): node is Line;
|
|
79
|
+
export function isLine(node: AnyNode | Line | TemplateText | OpenTemplate | CloseTemplate): node is Line;
|
|
77
80
|
/**
|
|
78
81
|
* @param {AnyNode} node
|
|
79
82
|
* @returns {node is ScriptTag}
|
|
80
83
|
*/
|
|
81
84
|
export function isScript(node: AnyNode): node is ScriptTag;
|
|
85
|
+
/**
|
|
86
|
+
* @param {AnyNode} node
|
|
87
|
+
* @returns {node is StyleTag}
|
|
88
|
+
*/
|
|
89
|
+
export function isStyle(node: AnyNode): node is StyleTag;
|
|
82
90
|
/**
|
|
83
91
|
* @param {(Text | CommentContent)['parts']} parts
|
|
84
92
|
* @param {Range} range
|
|
@@ -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;2BAClC,OAAO,aAAa,EAAE,YAAY;
|
|
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"}
|