@html-eslint/eslint-plugin 0.47.1 → 0.49.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/configs/all.js +10 -0
- package/lib/index.js +14 -1
- package/lib/languages/html-language.js +3 -3
- package/lib/languages/html-source-code.js +13 -87
- package/lib/rules/indent/indent.js +49 -36
- package/package.json +9 -9
- package/types/configs/all.d.ts +2 -0
- package/types/configs/all.d.ts.map +1 -0
- package/types/index.d.ts +8 -56
- package/types/index.d.ts.map +1 -1
- package/types/languages/html-language.d.ts +12 -3
- package/types/languages/html-language.d.ts.map +1 -1
- package/types/languages/html-source-code.d.ts +13 -55
- package/types/languages/html-source-code.d.ts.map +1 -1
- package/types/rules/indent/indent.d.ts +1 -0
- package/types/rules/indent/indent.d.ts.map +1 -1
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@ const {
|
|
|
3
3
|
recommendedRules,
|
|
4
4
|
recommendedLegacyRules,
|
|
5
5
|
} = require("./configs/recommended");
|
|
6
|
+
const { allRules } = require("./configs/all");
|
|
6
7
|
const { HTMLLanguage } = require("./languages/html-language");
|
|
7
8
|
const { name, version } = require("../package.json");
|
|
8
9
|
const parser = require("@html-eslint/parser");
|
|
@@ -11,7 +12,7 @@ const parser = require("@html-eslint/parser");
|
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* @
|
|
15
|
+
* @type {ESLint.Plugin}
|
|
15
16
|
*/
|
|
16
17
|
const plugin = {
|
|
17
18
|
meta: {
|
|
@@ -42,6 +43,18 @@ const plugin = {
|
|
|
42
43
|
},
|
|
43
44
|
rules: recommendedLegacyRules,
|
|
44
45
|
},
|
|
46
|
+
"flat/all": {
|
|
47
|
+
plugins: {
|
|
48
|
+
/** @type {ESLint.Plugin} */
|
|
49
|
+
get "@html-eslint"() {
|
|
50
|
+
return plugin;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
languageOptions: {
|
|
54
|
+
parser,
|
|
55
|
+
},
|
|
56
|
+
rules: allRules,
|
|
57
|
+
},
|
|
45
58
|
},
|
|
46
59
|
};
|
|
47
60
|
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const { visitorKeys, parseForESLint } = require("@html-eslint/parser");
|
|
8
|
-
const {
|
|
8
|
+
const { createHTMLSourceCode } = require("./html-source-code");
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @implements {Language<{ LangOptions: ParserOptions; Code:
|
|
11
|
+
* @implements {Language<{ LangOptions: ParserOptions; Code: ReturnType<typeof createHTMLSourceCode>; RootNode: AST.Program; Node: {}}>}
|
|
12
12
|
*/
|
|
13
13
|
class HTMLLanguage {
|
|
14
14
|
constructor() {
|
|
@@ -104,7 +104,7 @@ class HTMLLanguage {
|
|
|
104
104
|
* @param {OkParseResult<AST.Program>} parseResult
|
|
105
105
|
*/
|
|
106
106
|
createSourceCode(file, parseResult) {
|
|
107
|
-
return
|
|
107
|
+
return createHTMLSourceCode({
|
|
108
108
|
text: /** @type {string} */ (file.body),
|
|
109
109
|
ast: parseResult.ast,
|
|
110
110
|
comments: parseResult.comments,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {AST} from 'eslint';
|
|
3
3
|
* @import {SourceLocation, DirectiveType} from '@eslint/plugin-kit';
|
|
4
|
-
* @import {TraversalStep,
|
|
4
|
+
* @import {TraversalStep, SourceCode} from '@eslint/core';
|
|
5
5
|
* @import {CommentContent, AnyHTMLNode} from '@html-eslint/types';
|
|
6
6
|
* @import {BaseNode} from '../types';
|
|
7
|
+
*
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
9
|
const {
|
|
10
10
|
TextSourceCodeBase,
|
|
11
11
|
ConfigCommentParser,
|
|
@@ -71,90 +71,6 @@ class HTMLSourceCode extends TextSourceCodeBase {
|
|
|
71
71
|
return this.lines;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
// Copied from eslint source code
|
|
75
|
-
/**
|
|
76
|
-
* @see https://github.com/eslint/eslint/blob/f60f2764971a33e252be13e560dccf21f554dbf1/lib/languages/js/source-code/source-code.js#L745
|
|
77
|
-
* @param {Position} loc
|
|
78
|
-
* @returns {number}
|
|
79
|
-
*/
|
|
80
|
-
getIndexFromLoc(loc) {
|
|
81
|
-
if (
|
|
82
|
-
typeof loc !== "object" ||
|
|
83
|
-
typeof loc.line !== "number" ||
|
|
84
|
-
typeof loc.column !== "number"
|
|
85
|
-
) {
|
|
86
|
-
throw new TypeError(
|
|
87
|
-
"Expected `loc` to be an object with numeric `line` and `column` properties."
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (loc.line <= 0) {
|
|
92
|
-
throw new RangeError(
|
|
93
|
-
`Line number out of range (line ${loc.line} requested). Line numbers should be 1-based.`
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (loc.line > this.lineStartIndices.length) {
|
|
98
|
-
throw new RangeError(
|
|
99
|
-
`Line number out of range (line ${loc.line} requested, but only ${this.lineStartIndices.length} lines present).`
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const lineStartIndex = this.lineStartIndices[loc.line - 1];
|
|
104
|
-
const lineEndIndex =
|
|
105
|
-
loc.line === this.lineStartIndices.length
|
|
106
|
-
? this.text.length
|
|
107
|
-
: this.lineStartIndices[loc.line];
|
|
108
|
-
const positionIndex = lineStartIndex + loc.column;
|
|
109
|
-
if (
|
|
110
|
-
(loc.line === this.lineStartIndices.length &&
|
|
111
|
-
positionIndex > lineEndIndex) ||
|
|
112
|
-
(loc.line < this.lineStartIndices.length && positionIndex >= lineEndIndex)
|
|
113
|
-
) {
|
|
114
|
-
throw new RangeError(
|
|
115
|
-
`Column number out of range (column ${loc.column} requested, but the length of line ${loc.line} is ${lineEndIndex - lineStartIndex}).`
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return positionIndex;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Copied from eslint source code
|
|
123
|
-
/**
|
|
124
|
-
* @see https://github.com/eslint/eslint/blob/f60f2764971a33e252be13e560dccf21f554dbf1/lib/languages/js/source-code/source-code.js#L694
|
|
125
|
-
* @param {number} index
|
|
126
|
-
* @returns {Position}
|
|
127
|
-
*/
|
|
128
|
-
getLocFromIndex(index) {
|
|
129
|
-
if (typeof index !== "number") {
|
|
130
|
-
throw new TypeError("Expected `index` to be a number.");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (index < 0 || index > this.text.length) {
|
|
134
|
-
throw new RangeError(
|
|
135
|
-
`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
if (index === this.text.length) {
|
|
139
|
-
return {
|
|
140
|
-
line: this.lines.length,
|
|
141
|
-
// @ts-ignore
|
|
142
|
-
column: this.lines.at(-1).length,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const lineNumber =
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
index >= this.lineStartIndices.at(-1)
|
|
149
|
-
? this.lineStartIndices.length
|
|
150
|
-
: this.lineStartIndices.findIndex((el) => index < el);
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
line: lineNumber,
|
|
154
|
-
column: index - this.lineStartIndices[lineNumber - 1],
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
74
|
getInlineConfigNodes() {
|
|
159
75
|
return this.comments.filter((comment) => INLINE_CONFIG.test(comment.value));
|
|
160
76
|
}
|
|
@@ -267,7 +183,17 @@ class HTMLSourceCode extends TextSourceCodeBase {
|
|
|
267
183
|
return this.parentsMap.get(node);
|
|
268
184
|
}
|
|
269
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* @param {{ast: AST.Program, text: string, comments: CommentContent[]}} config
|
|
188
|
+
* @returns {TextSourceCodeBase<any> & {
|
|
189
|
+
* getDisableDirectives(): { problems: {ruleId: null | string, message: string; loc: SourceLocation}[]; directives: Directive[]}
|
|
190
|
+
* getInlineConfigNodes(): CommentContent[]
|
|
191
|
+
* }}
|
|
192
|
+
*/
|
|
193
|
+
function createHTMLSourceCode(config) {
|
|
194
|
+
return new HTMLSourceCode(config);
|
|
195
|
+
}
|
|
270
196
|
|
|
271
197
|
module.exports = {
|
|
272
|
-
|
|
198
|
+
createHTMLSourceCode,
|
|
273
199
|
};
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* @typedef {Object} Option2
|
|
19
19
|
* @property {number} [Option2.Attribute]
|
|
20
20
|
* @property {Record<string, number>} [Option2.tagChildrenIndent]
|
|
21
|
+
* @property {boolean} [Option2.ignoreComment]
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
const { parseTemplateLiteral } = require("../utils/template-literal");
|
|
@@ -97,6 +98,10 @@ module.exports = {
|
|
|
97
98
|
},
|
|
98
99
|
additionalProperties: false,
|
|
99
100
|
},
|
|
101
|
+
ignoreComment: {
|
|
102
|
+
type: "boolean",
|
|
103
|
+
default: false,
|
|
104
|
+
},
|
|
100
105
|
},
|
|
101
106
|
additionalProperties: false,
|
|
102
107
|
},
|
|
@@ -110,6 +115,7 @@ module.exports = {
|
|
|
110
115
|
const sourceCode = getSourceCode(context);
|
|
111
116
|
const indentLevelOptions = (context.options && context.options[1]) || {};
|
|
112
117
|
const lines = sourceCode.getLines();
|
|
118
|
+
const ignoreComment = indentLevelOptions.ignoreComment === true;
|
|
113
119
|
const { indentType, indentSize, indentChar } = getIndentOptionInfo(context);
|
|
114
120
|
|
|
115
121
|
/**
|
|
@@ -265,6 +271,48 @@ module.exports = {
|
|
|
265
271
|
}
|
|
266
272
|
}
|
|
267
273
|
|
|
274
|
+
/**
|
|
275
|
+
* @type {RuleListener}
|
|
276
|
+
*/
|
|
277
|
+
const commentVisitor = {
|
|
278
|
+
Comment(node) {
|
|
279
|
+
indentLevel.indent(node);
|
|
280
|
+
},
|
|
281
|
+
CommentOpen: checkIndent,
|
|
282
|
+
CommentContent(node) {
|
|
283
|
+
indentLevel.indent(node);
|
|
284
|
+
if (hasTemplate(node)) {
|
|
285
|
+
node.parts.forEach((part) => {
|
|
286
|
+
if (part.type !== NODE_TYPES.Part) {
|
|
287
|
+
if (part.open) {
|
|
288
|
+
checkIndent(part.open);
|
|
289
|
+
}
|
|
290
|
+
if (part.close) {
|
|
291
|
+
checkIndent(part.close);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const lineNodes = splitToLineNodes(node);
|
|
298
|
+
lineNodes.forEach((lineNode) => {
|
|
299
|
+
if (lineNode.hasTemplate) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (lineNode.value.trim().length) {
|
|
303
|
+
checkIndent(lineNode);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
CommentClose: checkIndent,
|
|
308
|
+
"Comment:exit"(node) {
|
|
309
|
+
indentLevel.dedent(node);
|
|
310
|
+
},
|
|
311
|
+
"CommentContent:exit"(node) {
|
|
312
|
+
indentLevel.dedent(node);
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
|
|
268
316
|
/**
|
|
269
317
|
* @type {RuleListener}
|
|
270
318
|
*/
|
|
@@ -342,42 +390,7 @@ module.exports = {
|
|
|
342
390
|
"Text:exit"(node) {
|
|
343
391
|
indentLevel.dedent(node);
|
|
344
392
|
},
|
|
345
|
-
|
|
346
|
-
indentLevel.indent(node);
|
|
347
|
-
},
|
|
348
|
-
CommentOpen: checkIndent,
|
|
349
|
-
CommentContent(node) {
|
|
350
|
-
indentLevel.indent(node);
|
|
351
|
-
if (hasTemplate(node)) {
|
|
352
|
-
node.parts.forEach((part) => {
|
|
353
|
-
if (part.type !== NODE_TYPES.Part) {
|
|
354
|
-
if (part.open) {
|
|
355
|
-
checkIndent(part.open);
|
|
356
|
-
}
|
|
357
|
-
if (part.close) {
|
|
358
|
-
checkIndent(part.close);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const lineNodes = splitToLineNodes(node);
|
|
365
|
-
lineNodes.forEach((lineNode) => {
|
|
366
|
-
if (lineNode.hasTemplate) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (lineNode.value.trim().length) {
|
|
370
|
-
checkIndent(lineNode);
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
},
|
|
374
|
-
CommentClose: checkIndent,
|
|
375
|
-
"Comment:exit"(node) {
|
|
376
|
-
indentLevel.dedent(node);
|
|
377
|
-
},
|
|
378
|
-
"CommentContent:exit"(node) {
|
|
379
|
-
indentLevel.dedent(node);
|
|
380
|
-
},
|
|
393
|
+
...(ignoreComment ? {} : commentVisitor),
|
|
381
394
|
};
|
|
382
395
|
return visitor;
|
|
383
396
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-eslint/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "ESLint plugin for HTML",
|
|
6
6
|
"author": "yeonjuan",
|
|
@@ -39,25 +39,25 @@
|
|
|
39
39
|
"accessibility"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@eslint/plugin-kit": "^0.
|
|
43
|
-
"@html-eslint/parser": "^0.
|
|
44
|
-
"@html-eslint/template-parser": "^0.
|
|
45
|
-
"@html-eslint/template-syntax-parser": "^0.
|
|
46
|
-
"@html-eslint/types": "^0.
|
|
42
|
+
"@eslint/plugin-kit": "^0.4.1",
|
|
43
|
+
"@html-eslint/parser": "^0.49.0",
|
|
44
|
+
"@html-eslint/template-parser": "^0.49.0",
|
|
45
|
+
"@html-eslint/template-syntax-parser": "^0.49.0",
|
|
46
|
+
"@html-eslint/types": "^0.49.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"eslint": "^8.0.0 || ^9.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@eslint/core": "^0.
|
|
52
|
+
"@eslint/core": "^1.0.0",
|
|
53
53
|
"@types/estree": "^0.0.47",
|
|
54
54
|
"es-html-parser": "0.3.1",
|
|
55
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.39.1",
|
|
56
56
|
"espree": "^10.3.0",
|
|
57
57
|
"typescript": "^5.8.3"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "56d2df10793aa5014065a94815e865b753ccc76b"
|
|
63
63
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../lib/configs/all.js"],"names":[],"mappings":"AAEA,+CAGgD"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,58 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
export = plugin;
|
|
2
|
+
/**
|
|
3
|
+
* @import { ESLint } from "eslint";
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @type {ESLint.Plugin}
|
|
7
|
+
*/
|
|
8
|
+
declare const plugin: ESLint.Plugin;
|
|
5
9
|
import type { ESLint } from "eslint";
|
|
6
|
-
import parser = require("@html-eslint/parser");
|
|
7
|
-
export declare namespace meta {
|
|
8
|
-
export { name };
|
|
9
|
-
export { version };
|
|
10
|
-
}
|
|
11
|
-
export declare namespace languages {
|
|
12
|
-
let html: HTMLLanguage;
|
|
13
|
-
}
|
|
14
|
-
export { rules };
|
|
15
|
-
export declare let configs: {
|
|
16
|
-
recommended: {
|
|
17
|
-
rules: {
|
|
18
|
-
"html/require-lang": "error";
|
|
19
|
-
"html/require-img-alt": "error";
|
|
20
|
-
"html/require-doctype": "error";
|
|
21
|
-
"html/require-title": "error";
|
|
22
|
-
"html/no-multiple-h1": "error";
|
|
23
|
-
"html/no-extra-spacing-attrs": "error";
|
|
24
|
-
"html/attrs-newline": "error";
|
|
25
|
-
"html/element-newline": ["error", {
|
|
26
|
-
inline: string[];
|
|
27
|
-
}];
|
|
28
|
-
"html/no-duplicate-id": "error";
|
|
29
|
-
"html/indent": "error";
|
|
30
|
-
"html/require-li-container": "error";
|
|
31
|
-
"html/quotes": "error";
|
|
32
|
-
"html/no-obsolete-tags": "error";
|
|
33
|
-
"html/require-closing-tags": "error";
|
|
34
|
-
"html/no-duplicate-attrs": "error";
|
|
35
|
-
"html/use-baseline": "error";
|
|
36
|
-
"html/no-duplicate-in-head": "error";
|
|
37
|
-
};
|
|
38
|
-
plugins: {};
|
|
39
|
-
};
|
|
40
|
-
"recommended-legacy": {
|
|
41
|
-
rules: Record<string, "error" | ["error", {
|
|
42
|
-
inline: string[];
|
|
43
|
-
}]>;
|
|
44
|
-
};
|
|
45
|
-
"flat/recommended": {
|
|
46
|
-
plugins: {
|
|
47
|
-
/** @type {ESLint.Plugin} */
|
|
48
|
-
readonly "@html-eslint": ESLint.Plugin;
|
|
49
|
-
};
|
|
50
|
-
languageOptions: {
|
|
51
|
-
parser: typeof parser;
|
|
52
|
-
};
|
|
53
|
-
rules: Record<string, "error" | ["error", {
|
|
54
|
-
inline: string[];
|
|
55
|
-
}]>;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
10
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.js"],"names":[],"mappings":";AASA;;GAEG;AAEH;;GAEG;AACH,sBAFU,aAAa,CA4CrB;4BAhDyB,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @implements {Language<{ LangOptions: ParserOptions; Code:
|
|
2
|
+
* @implements {Language<{ LangOptions: ParserOptions; Code: ReturnType<typeof createHTMLSourceCode>; RootNode: AST.Program; Node: {}}>}
|
|
3
3
|
*/
|
|
4
4
|
export class HTMLLanguage implements Language {
|
|
5
5
|
/**
|
|
@@ -43,7 +43,17 @@ export class HTMLLanguage implements Language {
|
|
|
43
43
|
* @param {File} file
|
|
44
44
|
* @param {OkParseResult<AST.Program>} parseResult
|
|
45
45
|
*/
|
|
46
|
-
createSourceCode(file: File, parseResult: OkParseResult<AST.Program>):
|
|
46
|
+
createSourceCode(file: File, parseResult: OkParseResult<AST.Program>): import("@eslint/plugin-kit").TextSourceCodeBase<any> & {
|
|
47
|
+
getDisableDirectives(): {
|
|
48
|
+
problems: {
|
|
49
|
+
ruleId: null | string;
|
|
50
|
+
message: string;
|
|
51
|
+
loc: import("@eslint/plugin-kit").SourceLocation;
|
|
52
|
+
}[];
|
|
53
|
+
directives: import("@eslint/plugin-kit").Directive[];
|
|
54
|
+
};
|
|
55
|
+
getInlineConfigNodes(): import("@html-eslint/types").CommentContent[];
|
|
56
|
+
};
|
|
47
57
|
}
|
|
48
58
|
import type { Language } from "@eslint/core";
|
|
49
59
|
import type { ParserOptions } from "@html-eslint/parser";
|
|
@@ -51,5 +61,4 @@ import type { File } from "@eslint/core";
|
|
|
51
61
|
import type { AST } from "eslint";
|
|
52
62
|
import type { ParseResult } from "@eslint/core";
|
|
53
63
|
import type { OkParseResult } from "@eslint/core";
|
|
54
|
-
import { HTMLSourceCode } from "./html-source-code";
|
|
55
64
|
//# sourceMappingURL=html-language.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-language.d.ts","sourceRoot":"","sources":["../../lib/languages/html-language.js"],"names":[],"mappings":"AASA;;GAEG;AACH;IAEI;;;OAGG;IACH,UAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,WAFU,CAAC,GAAC,CAAC,CAEK;IAElB;;;OAGG;IACH,aAFU,CAAC,GAAC,CAAC,CAEO;IAEpB;;OAEG;IACH,aAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,aAFU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAEJ;IAGhC;;OAEG;IACH,yCAFW,aAAa,QA8BvB;IAED;;;;;OAKG;IACH,YALW,IAAI,YAEZ;QAA+B,eAAe,EAAtC,aAAa;KACrB,GAAU,YAAY,WAAW,CAAC,CAkBpC;IAED;;;OAGG;IACH,uBAHW,IAAI,eACJ,cAAc,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"html-language.d.ts","sourceRoot":"","sources":["../../lib/languages/html-language.js"],"names":[],"mappings":"AASA;;GAEG;AACH;IAEI;;;OAGG;IACH,UAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,WAFU,CAAC,GAAC,CAAC,CAEK;IAElB;;;OAGG;IACH,aAFU,CAAC,GAAC,CAAC,CAEO;IAEpB;;OAEG;IACH,aAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,aAFU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAEJ;IAGhC;;OAEG;IACH,yCAFW,aAAa,QA8BvB;IAED;;;;;OAKG;IACH,YALW,IAAI,YAEZ;QAA+B,eAAe,EAAtC,aAAa;KACrB,GAAU,YAAY,WAAW,CAAC,CAkBpC;IAED;;;OAGG;IACH,uBAHW,IAAI,eACJ,cAAc,WAAW,CAAC;;;;;;;;;;MAQpC;CACF;8BA/GyE,cAAc;mCACtD,qBAAqB;0BADmB,cAAc;yBAEhE,QAAQ;iCAF0C,cAAc;mCAAd,cAAc"}
|
|
@@ -1,48 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
text: string;
|
|
10
|
-
comments: CommentContent[];
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* @property
|
|
14
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
* @param {{ast: AST.Program, text: string, comments: CommentContent[]}} config
|
|
3
|
+
* @returns {TextSourceCodeBase<any> & {
|
|
4
|
+
* getDisableDirectives(): { problems: {ruleId: null | string, message: string; loc: SourceLocation}[]; directives: Directive[]}
|
|
5
|
+
* getInlineConfigNodes(): CommentContent[]
|
|
6
|
+
* }}
|
|
7
|
+
*/
|
|
8
|
+
export function createHTMLSourceCode(config: {
|
|
15
9
|
ast: AST.Program;
|
|
16
|
-
|
|
17
|
-
* @property
|
|
18
|
-
*/
|
|
10
|
+
text: string;
|
|
19
11
|
comments: CommentContent[];
|
|
20
|
-
|
|
21
|
-
lineStartIndices: number[];
|
|
22
|
-
/**
|
|
23
|
-
* @param {BaseNode} node
|
|
24
|
-
* @returns {[number, number]}
|
|
25
|
-
*/
|
|
26
|
-
getRange(node: BaseNode): [number, number];
|
|
27
|
-
/**
|
|
28
|
-
* @param {BaseNode} node
|
|
29
|
-
* @returns {import("@eslint/plugin-kit").SourceLocation}
|
|
30
|
-
*/
|
|
31
|
-
getLoc(node: BaseNode): import("@eslint/plugin-kit").SourceLocation;
|
|
32
|
-
getLines(): string[];
|
|
33
|
-
/**
|
|
34
|
-
* @see https://github.com/eslint/eslint/blob/f60f2764971a33e252be13e560dccf21f554dbf1/lib/languages/js/source-code/source-code.js#L745
|
|
35
|
-
* @param {Position} loc
|
|
36
|
-
* @returns {number}
|
|
37
|
-
*/
|
|
38
|
-
getIndexFromLoc(loc: Position): number;
|
|
39
|
-
/**
|
|
40
|
-
* @see https://github.com/eslint/eslint/blob/f60f2764971a33e252be13e560dccf21f554dbf1/lib/languages/js/source-code/source-code.js#L694
|
|
41
|
-
* @param {number} index
|
|
42
|
-
* @returns {Position}
|
|
43
|
-
*/
|
|
44
|
-
getLocFromIndex(index: number): Position;
|
|
45
|
-
getInlineConfigNodes(): CommentContent[];
|
|
12
|
+
}): TextSourceCodeBase<any> & {
|
|
46
13
|
getDisableDirectives(): {
|
|
47
14
|
problems: {
|
|
48
15
|
ruleId: null | string;
|
|
@@ -51,20 +18,11 @@ export class HTMLSourceCode extends TextSourceCodeBase<import("@eslint/core").So
|
|
|
51
18
|
}[];
|
|
52
19
|
directives: Directive[];
|
|
53
20
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* @param {AnyHTMLNode} node
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
getParent(node: AnyHTMLNode): any;
|
|
60
|
-
}
|
|
61
|
-
import { TextSourceCodeBase } from "@eslint/plugin-kit";
|
|
21
|
+
getInlineConfigNodes(): CommentContent[];
|
|
22
|
+
};
|
|
62
23
|
import type { AST } from 'eslint';
|
|
63
24
|
import type { CommentContent } from '@html-eslint/types';
|
|
64
|
-
import
|
|
65
|
-
import type { Position } from '@eslint/core';
|
|
25
|
+
import { TextSourceCodeBase } from "@eslint/plugin-kit";
|
|
66
26
|
import type { SourceLocation } from '@eslint/plugin-kit';
|
|
67
27
|
import { Directive } from "@eslint/plugin-kit";
|
|
68
|
-
import type { TraversalStep } from '@eslint/core';
|
|
69
|
-
import type { AnyHTMLNode } from '@html-eslint/types';
|
|
70
28
|
//# sourceMappingURL=html-source-code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-source-code.d.ts","sourceRoot":"","sources":["../../lib/languages/html-source-code.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"html-source-code.d.ts","sourceRoot":"","sources":["../../lib/languages/html-source-code.js"],"names":[],"mappings":"AAyLA;;;;;;GAMG;AACH,6CANW;IAAC,GAAG,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,cAAc,EAAE,CAAA;CAAC,GAC1D,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClC,oBAAoB,IAAI;QAAE,QAAQ,EAAE;YAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,cAAc,CAAA;SAAC,EAAE,CAAC;QAAC,UAAU,EAAE,SAAS,EAAE,CAAA;KAAC,CAAA;IAC7H,oBAAoB,IAAI,cAAc,EAAE,CAAA;CACzC,CAIH;yBAjMqB,QAAQ;oCAGgB,oBAAoB;;oCAFlB,oBAAoB"}
|
|
@@ -20,6 +20,7 @@ type Option1 = "tab" | number;
|
|
|
20
20
|
type Option2 = {
|
|
21
21
|
Attribute?: number | undefined;
|
|
22
22
|
tagChildrenIndent?: Record<string, number> | undefined;
|
|
23
|
+
ignoreComment?: boolean | undefined;
|
|
23
24
|
};
|
|
24
25
|
import type { RuleModule } from "../../types";
|
|
25
26
|
import type { AnyNode } from "@html-eslint/types";
|
|
@@ -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,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;;qBAnD3B,OAAO,GAAG,IAAI;;SAEb,KAAK;WACL,OAAO;;;kBAEP,aAAa;;;gBAEb,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;gBACvC,MAAM;gBACN,MAAM;;eAEP,KAAK,GAAG,MAAM;;;;;;gCAd+B,aAAa;6BAD+C,oBAAoB;0BAChF,aAAa"}
|