@html-eslint/eslint-plugin 0.21.0 → 0.23.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/index.js +24 -3
- package/lib/rules/element-newline.js +10 -3
- package/lib/rules/id-naming-convention.js +21 -2
- package/lib/rules/indent.js +6 -2
- package/lib/rules/lowercase.js +8 -1
- package/lib/rules/no-abstract-roles.js +8 -1
- package/lib/rules/no-accesskey-attrs.js +8 -1
- package/lib/rules/no-aria-hidden-body.js +5 -1
- package/lib/rules/no-duplicate-attrs.js +8 -1
- package/lib/rules/no-duplicate-id.js +8 -1
- package/lib/rules/no-extra-spacing-attrs.js +16 -1
- package/lib/rules/no-inline-styles.js +5 -1
- package/lib/rules/no-multiple-empty-lines.js +6 -1
- package/lib/rules/no-multiple-h1.js +6 -1
- package/lib/rules/no-non-scalable-viewport.js +5 -1
- package/lib/rules/no-obsolete-tags.js +5 -1
- package/lib/rules/no-positive-tabindex.js +8 -1
- package/lib/rules/no-restricted-attr-values.js +6 -1
- package/lib/rules/no-restricted-attrs.js +6 -1
- package/lib/rules/no-script-style-type.js +8 -1
- package/lib/rules/no-skip-heading-levels.js +6 -1
- package/lib/rules/no-target-blank.js +5 -1
- package/lib/rules/no-trailing-spaces.js +5 -1
- package/lib/rules/quotes.js +10 -1
- package/lib/rules/require-attrs.js +8 -1
- package/lib/rules/require-button-type.js +5 -1
- package/lib/rules/require-closing-tags.js +6 -1
- package/lib/rules/require-doctype.js +5 -1
- package/lib/rules/require-frame-title.js +5 -1
- package/lib/rules/require-img-alt.js +6 -1
- package/lib/rules/require-lang.js +5 -1
- package/lib/rules/require-li-container.js +5 -1
- package/lib/rules/require-meta-charset.js +7 -2
- package/lib/rules/require-meta-description.js +6 -2
- package/lib/rules/require-meta-viewport.js +7 -2
- package/lib/rules/require-open-graph-protocol.js +7 -2
- package/lib/rules/require-title.js +9 -3
- package/lib/rules/sort-attrs.js +8 -1
- package/lib/rules/utils/node.js +13 -0
- package/lib/types.d.ts +261 -262
- package/package.json +11 -7
- package/types/index.d.ts +14 -0
- package/types/index.d.ts.map +1 -0
package/lib/types.d.ts
CHANGED
|
@@ -2,269 +2,268 @@ import ESTree from "estree";
|
|
|
2
2
|
import ESLint from "eslint";
|
|
3
3
|
import * as ESHtml from "es-html-parser";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end: ESTree.Position;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ProgramNode extends Omit<ESHtml.DocumentNode, "type" | "children"> {
|
|
24
|
-
type: "Program";
|
|
25
|
-
body: ESHtml.DocumentNode["children"];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface AttributeKeyNode extends ESHtml.AttributeKeyNode {
|
|
29
|
-
parent: AttributeNode;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface TextNode extends ESHtml.TextNode {
|
|
33
|
-
parent: TagNode;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface TagNode extends ESHtml.TagNode {
|
|
37
|
-
attributes: AttributeNode[];
|
|
38
|
-
parent: TagNode | ProgramNode;
|
|
39
|
-
openStart: OpenTagStartNode;
|
|
40
|
-
openEnd: OpenTagEndNode;
|
|
41
|
-
close: CloseTagNode;
|
|
42
|
-
children: Array<
|
|
43
|
-
TextNode | TagNode | ScriptTagNode | StyleTagNode | CommentNode
|
|
44
|
-
>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface OpenTagStartNode extends ESHtml.OpenTagStartNode {
|
|
48
|
-
parent: TagNode;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface OpenTagEndNode extends ESHtml.OpenTagEndNode {
|
|
52
|
-
parent: TagNode;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface CloseTagNode extends ESHtml.CloseTagNode {
|
|
56
|
-
parent: TagNode;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
interface AttributeNode extends ESHtml.AttributeNode {
|
|
60
|
-
key: AttributeKeyNode;
|
|
61
|
-
value?: AttributeValueNode;
|
|
62
|
-
parent: TagNode | StyleTagNode | ScriptTagNode;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
interface AttributeValueNode extends ESHtml.AttributeValueNode {
|
|
66
|
-
parent: AttributeNode;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
interface AttributeValueWrapperEndNode
|
|
70
|
-
extends ESHtml.AttributeValueWrapperEndNode {
|
|
71
|
-
parent: AttributeNode;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface AttributeValueWrapperStartNode
|
|
75
|
-
extends ESHtml.AttributeValueWrapperStartNode {
|
|
76
|
-
parent: AttributeNode;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
interface ScriptTagNode extends ESHtml.ScriptTagNode {
|
|
80
|
-
attributes: AttributeNode[];
|
|
81
|
-
parent: ProgramNode | TagNode;
|
|
82
|
-
openStart: OpenScriptTagStartNode;
|
|
83
|
-
openEnd: OpenScriptTagEndNode;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
interface OpenScriptTagStartNode extends ESHtml.OpenScriptTagStartNode {
|
|
87
|
-
parent: ScriptTagNode;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface CloseScriptTagNode extends ESHtml.CloseScriptTagNode {
|
|
91
|
-
parent: ScriptTagNode;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
interface OpenScriptTagEndNode extends ESHtml.OpenScriptTagEndNode {
|
|
95
|
-
parent: ScriptTagNode;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface ScriptTagContentNode extends ESHtml.ScriptTagContentNode {
|
|
99
|
-
parent: ScriptTagNode;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface StyleTagNode extends ESHtml.StyleTagNode {
|
|
103
|
-
attributes: AttributeNode[];
|
|
104
|
-
parent: TagNode | ProgramNode;
|
|
105
|
-
openStart: OpenStyleTagStartNode;
|
|
106
|
-
openEnd: OpenStyleTagEndNode;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
interface OpenStyleTagStartNode extends ESHtml.OpenStyleTagStartNode {
|
|
110
|
-
parent: StyleTagNode;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
interface OpenStyleTagEndNode extends ESHtml.OpenStyleTagEndNode {
|
|
114
|
-
parent: StyleTagNode;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface StyleTagContentNode extends ESHtml.StyleTagContentNode {
|
|
118
|
-
parent: StyleTagNode;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
interface CloseStyleTagNode extends ESHtml.CloseStyleTagNode {
|
|
122
|
-
parent: StyleTagNode;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
interface CommentNode extends ESHtml.CommentNode {
|
|
126
|
-
parent: ProgramNode | TagNode;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
interface CommentOpenNode extends ESHtml.CommentOpenNode {
|
|
130
|
-
parent: CommentNode;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
interface CommentCloseNode extends ESHtml.CommentCloseNode {
|
|
134
|
-
parent: CommentNode;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
interface CommentContentNode extends ESHtml.CommentContentNode {
|
|
138
|
-
parent: CommentNode;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
interface DoctypeNode extends ESHtml.DoctypeNode {
|
|
142
|
-
parent: ProgramNode;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
interface DoctypeOpenNode extends ESHtml.DoctypeOpenNode {
|
|
146
|
-
parent: DoctypeNode;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
interface DoctypeCloseNode extends ESHtml.DoctypeCloseNode {
|
|
150
|
-
parent: DoctypeNode;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
interface DoctypeAttributeNode extends ESHtml.DoctypeAttributeNode {
|
|
154
|
-
parent: DoctypeNode;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
interface DoctypeAttributeValueNode extends ESHtml.DoctypeAttributeValueNode {
|
|
158
|
-
parent: DoctypeNode;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface DoctypeAttributeWrapperStart
|
|
162
|
-
extends ESHtml.DoctypeAttributeWrapperStartNode {
|
|
163
|
-
parent: DoctypeNode;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
interface DoctypeAttributeWrapperEnd
|
|
167
|
-
extends ESHtml.DoctypeAttributeWrapperEndNode {
|
|
168
|
-
parent: DoctypeNode;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
interface LineNode extends BaseNode {
|
|
172
|
-
type: "Line";
|
|
173
|
-
value: string;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
interface RuleListener {
|
|
177
|
-
Program?: (node: ProgramNode) => void;
|
|
178
|
-
AttributeKey?: (node: AttributeKeyNode) => void;
|
|
179
|
-
Text?: (node: TextNode) => void;
|
|
180
|
-
Tag?: (node: TagNode) => void;
|
|
181
|
-
OpenTagStart?: (node: OpenTagStartNode) => void;
|
|
182
|
-
OpenTagEnd?: (node: OpenTagEndNode) => void;
|
|
183
|
-
CloseTag?: (node: CloseTagNode) => void;
|
|
184
|
-
Attribute?: (node: AttributeNode) => void;
|
|
185
|
-
AttributeValue?: (node: AttributeValueNode) => void;
|
|
186
|
-
AttributeValueWrapperEnd?: (node: AttributeValueWrapperEndNode) => void;
|
|
187
|
-
AttributeValueWrapperStart?: (node: AttributeValueWrapperStartNode) => void;
|
|
188
|
-
ScriptTag?: (node: ScriptTagNode) => void;
|
|
189
|
-
OpenScriptTagStart?: (node: OpenScriptTagStartNode) => void;
|
|
190
|
-
CloseScriptTag?: (node: CloseScriptTagNode) => void;
|
|
191
|
-
OpenScriptTagEnd?: (node: OpenScriptTagEndNode) => void;
|
|
192
|
-
ScriptTagContent?: (node: ScriptTagContentNode) => void;
|
|
193
|
-
StyleTag?: (node: StyleTagNode) => void;
|
|
194
|
-
OpenStyleTagStart?: (node: OpenStyleTagStartNode) => void;
|
|
195
|
-
OpenStyleTagEnd?: (node: OpenStyleTagEndNode) => void;
|
|
196
|
-
StyleTagContent?: (node: StyleTagContentNode) => void;
|
|
197
|
-
CloseStyleTag?: (node: CloseStyleTagNode) => void;
|
|
198
|
-
Comment?: (node: CommentNode) => void;
|
|
199
|
-
CommentOpen?: (node: CommentOpenNode) => void;
|
|
200
|
-
CommentClose?: (node: CommentCloseNode) => void;
|
|
201
|
-
CommentContent?: (node: CommentContentNode) => void;
|
|
202
|
-
Doctype?: (node: DoctypeNode) => void;
|
|
203
|
-
DoctypeOpen: (node: DoctypeOpenNode) => void;
|
|
204
|
-
DoctypeClose?: (node: DoctypeCloseNode) => void;
|
|
205
|
-
DoctypeAttribute?: (node: DoctypeAttributeNode) => void;
|
|
206
|
-
DoctypeAttributeValue?: (node: DoctypeAttributeValueNode) => void;
|
|
207
|
-
DoctypeAttributeWrapperStart?: (node: DoctypeAttributeWrapperStart) => void;
|
|
208
|
-
DoctypeAttributeWrapperEnd?: (node: DoctypeAttributeWrapperEnd) => void;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
interface Rule {
|
|
212
|
-
create(context: Context): RuleListener;
|
|
213
|
-
meta?: ESLint.Rule.RuleMetaData;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
interface RuleFixer {
|
|
217
|
-
insertTextAfter(nodeOrToken: BaseNode | Token, text: string): Fix;
|
|
218
|
-
|
|
219
|
-
insertTextAfterRange(range: Range, text: string): Fix;
|
|
220
|
-
|
|
221
|
-
insertTextBefore(nodeOrToken: BaseNode | Token, text: string): Fix;
|
|
222
|
-
|
|
223
|
-
insertTextBeforeRange(range: Range, text: string): Fix;
|
|
224
|
-
|
|
225
|
-
remove(nodeOrToken: BaseNode | Token): Fix;
|
|
226
|
-
|
|
227
|
-
removeRange(range: Range): Fix;
|
|
228
|
-
|
|
229
|
-
replaceText(nodeOrToken: BaseNode | Token, text: string): Fix;
|
|
230
|
-
|
|
231
|
-
replaceTextRange(range: Range, text: string): Fix;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
interface ReportDescriptorOptionsBase {
|
|
235
|
-
data?: { [key: string]: string };
|
|
236
|
-
|
|
237
|
-
fix?:
|
|
238
|
-
| null
|
|
239
|
-
| ((fixer: RuleFixer) => null | Fix | IterableIterator<Fix> | Fix[]);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
type SuggestionDescriptorMessage = { desc: string } | { messageId: string };
|
|
243
|
-
type SuggestionReportDescriptor = SuggestionDescriptorMessage &
|
|
244
|
-
ReportDescriptorOptionsBase;
|
|
245
|
-
|
|
246
|
-
interface ReportDescriptorOptions extends ReportDescriptorOptionsBase {
|
|
247
|
-
suggest?: SuggestionReportDescriptor[] | null;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
type ReportDescriptor = ReportDescriptorMessage &
|
|
251
|
-
ReportDescriptorLocation &
|
|
252
|
-
ReportDescriptorOptions;
|
|
253
|
-
type ReportDescriptorMessage = { message: string } | { messageId: string };
|
|
254
|
-
type ReportDescriptorLocation = {
|
|
255
|
-
node?: BaseNode;
|
|
256
|
-
loc?: ESLint.AST.SourceLocation;
|
|
257
|
-
line?: number;
|
|
258
|
-
column?: number;
|
|
5
|
+
type Fix = ESLint.Rule.Fix;
|
|
6
|
+
type Token = ESLint.AST.Token;
|
|
7
|
+
|
|
8
|
+
type AnyNode = ESHtml.AnyNode | LineNode;
|
|
9
|
+
|
|
10
|
+
export type Range = ESLint.AST.Range;
|
|
11
|
+
|
|
12
|
+
type Location = ESLint.AST.SourceLocation;
|
|
13
|
+
|
|
14
|
+
export interface BaseNode {
|
|
15
|
+
range: [number, number];
|
|
16
|
+
loc: {
|
|
17
|
+
start: ESTree.Position;
|
|
18
|
+
end: ESTree.Position;
|
|
259
19
|
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ProgramNode
|
|
23
|
+
extends Omit<ESHtml.DocumentNode, "type" | "children"> {
|
|
24
|
+
type: "Program";
|
|
25
|
+
body: ESHtml.DocumentNode["children"];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface AttributeKeyNode extends ESHtml.AttributeKeyNode {
|
|
29
|
+
parent: AttributeNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface TextNode extends ESHtml.TextNode {
|
|
33
|
+
parent: TagNode;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TagNode extends ESHtml.TagNode {
|
|
37
|
+
attributes: AttributeNode[];
|
|
38
|
+
parent: TagNode | ProgramNode;
|
|
39
|
+
openStart: OpenTagStartNode;
|
|
40
|
+
openEnd: OpenTagEndNode;
|
|
41
|
+
close: CloseTagNode;
|
|
42
|
+
children: Array<
|
|
43
|
+
TextNode | TagNode | ScriptTagNode | StyleTagNode | CommentNode
|
|
44
|
+
>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface OpenTagStartNode extends ESHtml.OpenTagStartNode {
|
|
48
|
+
parent: TagNode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface OpenTagEndNode extends ESHtml.OpenTagEndNode {
|
|
52
|
+
parent: TagNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface CloseTagNode extends ESHtml.CloseTagNode {
|
|
56
|
+
parent: TagNode;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface AttributeNode extends ESHtml.AttributeNode {
|
|
60
|
+
key: AttributeKeyNode;
|
|
61
|
+
value?: AttributeValueNode;
|
|
62
|
+
parent: TagNode | StyleTagNode | ScriptTagNode;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface AttributeValueNode extends ESHtml.AttributeValueNode {
|
|
66
|
+
parent: AttributeNode;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface AttributeValueWrapperEndNode
|
|
70
|
+
extends ESHtml.AttributeValueWrapperEndNode {
|
|
71
|
+
parent: AttributeNode;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface AttributeValueWrapperStartNode
|
|
75
|
+
extends ESHtml.AttributeValueWrapperStartNode {
|
|
76
|
+
parent: AttributeNode;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ScriptTagNode extends ESHtml.ScriptTagNode {
|
|
80
|
+
attributes: AttributeNode[];
|
|
81
|
+
parent: ProgramNode | TagNode;
|
|
82
|
+
openStart: OpenScriptTagStartNode;
|
|
83
|
+
openEnd: OpenScriptTagEndNode;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface OpenScriptTagStartNode extends ESHtml.OpenScriptTagStartNode {
|
|
87
|
+
parent: ScriptTagNode;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface CloseScriptTagNode extends ESHtml.CloseScriptTagNode {
|
|
91
|
+
parent: ScriptTagNode;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface OpenScriptTagEndNode extends ESHtml.OpenScriptTagEndNode {
|
|
95
|
+
parent: ScriptTagNode;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface ScriptTagContentNode extends ESHtml.ScriptTagContentNode {
|
|
99
|
+
parent: ScriptTagNode;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface StyleTagNode extends ESHtml.StyleTagNode {
|
|
103
|
+
attributes: AttributeNode[];
|
|
104
|
+
parent: TagNode | ProgramNode;
|
|
105
|
+
openStart: OpenStyleTagStartNode;
|
|
106
|
+
openEnd: OpenStyleTagEndNode;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface OpenStyleTagStartNode extends ESHtml.OpenStyleTagStartNode {
|
|
110
|
+
parent: StyleTagNode;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface OpenStyleTagEndNode extends ESHtml.OpenStyleTagEndNode {
|
|
114
|
+
parent: StyleTagNode;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface StyleTagContentNode extends ESHtml.StyleTagContentNode {
|
|
118
|
+
parent: StyleTagNode;
|
|
119
|
+
}
|
|
260
120
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
121
|
+
interface CloseStyleTagNode extends ESHtml.CloseStyleTagNode {
|
|
122
|
+
parent: StyleTagNode;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface CommentNode extends ESHtml.CommentNode {
|
|
126
|
+
parent: ProgramNode | TagNode;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface CommentOpenNode extends ESHtml.CommentOpenNode {
|
|
130
|
+
parent: CommentNode;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface CommentCloseNode extends ESHtml.CommentCloseNode {
|
|
134
|
+
parent: CommentNode;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface CommentContentNode extends ESHtml.CommentContentNode {
|
|
138
|
+
parent: CommentNode;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface DoctypeNode extends ESHtml.DoctypeNode {
|
|
142
|
+
parent: ProgramNode;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface DoctypeOpenNode extends ESHtml.DoctypeOpenNode {
|
|
146
|
+
parent: DoctypeNode;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface DoctypeCloseNode extends ESHtml.DoctypeCloseNode {
|
|
150
|
+
parent: DoctypeNode;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface DoctypeAttributeNode extends ESHtml.DoctypeAttributeNode {
|
|
154
|
+
parent: DoctypeNode;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface DoctypeAttributeValueNode extends ESHtml.DoctypeAttributeValueNode {
|
|
158
|
+
parent: DoctypeNode;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface DoctypeAttributeWrapperStart
|
|
162
|
+
extends ESHtml.DoctypeAttributeWrapperStartNode {
|
|
163
|
+
parent: DoctypeNode;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface DoctypeAttributeWrapperEnd
|
|
167
|
+
extends ESHtml.DoctypeAttributeWrapperEndNode {
|
|
168
|
+
parent: DoctypeNode;
|
|
169
|
+
}
|
|
264
170
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
? T["children"][number]
|
|
269
|
-
: never;
|
|
171
|
+
interface LineNode extends BaseNode {
|
|
172
|
+
type: "Line";
|
|
173
|
+
value: string;
|
|
270
174
|
}
|
|
175
|
+
|
|
176
|
+
interface RuleListener {
|
|
177
|
+
Program?: (node: ProgramNode) => void;
|
|
178
|
+
AttributeKey?: (node: AttributeKeyNode) => void;
|
|
179
|
+
Text?: (node: TextNode) => void;
|
|
180
|
+
Tag?: (node: TagNode) => void;
|
|
181
|
+
OpenTagStart?: (node: OpenTagStartNode) => void;
|
|
182
|
+
OpenTagEnd?: (node: OpenTagEndNode) => void;
|
|
183
|
+
CloseTag?: (node: CloseTagNode) => void;
|
|
184
|
+
Attribute?: (node: AttributeNode) => void;
|
|
185
|
+
AttributeValue?: (node: AttributeValueNode) => void;
|
|
186
|
+
AttributeValueWrapperEnd?: (node: AttributeValueWrapperEndNode) => void;
|
|
187
|
+
AttributeValueWrapperStart?: (node: AttributeValueWrapperStartNode) => void;
|
|
188
|
+
ScriptTag?: (node: ScriptTagNode) => void;
|
|
189
|
+
OpenScriptTagStart?: (node: OpenScriptTagStartNode) => void;
|
|
190
|
+
CloseScriptTag?: (node: CloseScriptTagNode) => void;
|
|
191
|
+
OpenScriptTagEnd?: (node: OpenScriptTagEndNode) => void;
|
|
192
|
+
ScriptTagContent?: (node: ScriptTagContentNode) => void;
|
|
193
|
+
StyleTag?: (node: StyleTagNode) => void;
|
|
194
|
+
OpenStyleTagStart?: (node: OpenStyleTagStartNode) => void;
|
|
195
|
+
OpenStyleTagEnd?: (node: OpenStyleTagEndNode) => void;
|
|
196
|
+
StyleTagContent?: (node: StyleTagContentNode) => void;
|
|
197
|
+
CloseStyleTag?: (node: CloseStyleTagNode) => void;
|
|
198
|
+
Comment?: (node: CommentNode) => void;
|
|
199
|
+
CommentOpen?: (node: CommentOpenNode) => void;
|
|
200
|
+
CommentClose?: (node: CommentCloseNode) => void;
|
|
201
|
+
CommentContent?: (node: CommentContentNode) => void;
|
|
202
|
+
Doctype?: (node: DoctypeNode) => void;
|
|
203
|
+
DoctypeOpen: (node: DoctypeOpenNode) => void;
|
|
204
|
+
DoctypeClose?: (node: DoctypeCloseNode) => void;
|
|
205
|
+
DoctypeAttribute?: (node: DoctypeAttributeNode) => void;
|
|
206
|
+
DoctypeAttributeValue?: (node: DoctypeAttributeValueNode) => void;
|
|
207
|
+
DoctypeAttributeWrapperStart?: (node: DoctypeAttributeWrapperStart) => void;
|
|
208
|
+
DoctypeAttributeWrapperEnd?: (node: DoctypeAttributeWrapperEnd) => void;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface RuleModule extends ESLint.Rule.RuleModule {
|
|
212
|
+
create(context: Context): RuleListener;
|
|
213
|
+
meta?: ESLint.Rule.RuleMetaData;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface RuleFixer {
|
|
217
|
+
insertTextAfter(nodeOrToken: BaseNode | Token, text: string): Fix;
|
|
218
|
+
|
|
219
|
+
insertTextAfterRange(range: Range, text: string): Fix;
|
|
220
|
+
|
|
221
|
+
insertTextBefore(nodeOrToken: BaseNode | Token, text: string): Fix;
|
|
222
|
+
|
|
223
|
+
insertTextBeforeRange(range: Range, text: string): Fix;
|
|
224
|
+
|
|
225
|
+
remove(nodeOrToken: BaseNode | Token): Fix;
|
|
226
|
+
|
|
227
|
+
removeRange(range: Range): Fix;
|
|
228
|
+
|
|
229
|
+
replaceText(nodeOrToken: BaseNode | Token, text: string): Fix;
|
|
230
|
+
|
|
231
|
+
replaceTextRange(range: Range, text: string): Fix;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface ReportDescriptorOptionsBase {
|
|
235
|
+
data?: { [key: string]: string };
|
|
236
|
+
|
|
237
|
+
fix?:
|
|
238
|
+
| null
|
|
239
|
+
| ((fixer: RuleFixer) => null | Fix | IterableIterator<Fix> | Fix[]);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
type SuggestionDescriptorMessage = { desc: string } | { messageId: string };
|
|
243
|
+
type SuggestionReportDescriptor = SuggestionDescriptorMessage &
|
|
244
|
+
ReportDescriptorOptionsBase;
|
|
245
|
+
|
|
246
|
+
interface ReportDescriptorOptions extends ReportDescriptorOptionsBase {
|
|
247
|
+
suggest?: SuggestionReportDescriptor[] | null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
type ReportDescriptor = ReportDescriptorMessage &
|
|
251
|
+
ReportDescriptorLocation &
|
|
252
|
+
ReportDescriptorOptions;
|
|
253
|
+
type ReportDescriptorMessage = { message: string } | { messageId: string };
|
|
254
|
+
type ReportDescriptorLocation = {
|
|
255
|
+
node?: BaseNode;
|
|
256
|
+
loc?: ESLint.AST.SourceLocation;
|
|
257
|
+
line?: number;
|
|
258
|
+
column?: number;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
interface Context extends Omit<ESLint.Rule.RuleContext, "report"> {
|
|
262
|
+
report(descriptor: ReportDescriptor): void;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export type ChildType<T extends BaseNode> = T extends ProgramNode
|
|
266
|
+
? T["body"][number]
|
|
267
|
+
: T extends TagNode
|
|
268
|
+
? T["children"][number]
|
|
269
|
+
: never;
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-eslint/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "ESLint plugin for html",
|
|
5
5
|
"author": "yeonjuan",
|
|
6
6
|
"homepage": "https://github.com/yeonjuan/html-eslint#readme",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
|
+
"types": "types/index.d.ts",
|
|
9
10
|
"directories": {
|
|
10
11
|
"lib": "lib",
|
|
11
|
-
"test": "__tests__"
|
|
12
|
+
"test": "__tests__",
|
|
13
|
+
"types": "types"
|
|
12
14
|
},
|
|
13
15
|
"files": [
|
|
14
|
-
"lib"
|
|
16
|
+
"lib",
|
|
17
|
+
"types"
|
|
15
18
|
],
|
|
16
19
|
"publishConfig": {
|
|
17
20
|
"access": "public"
|
|
@@ -23,7 +26,8 @@
|
|
|
23
26
|
"scripts": {
|
|
24
27
|
"test": "jest --coverage",
|
|
25
28
|
"ts": "tsc",
|
|
26
|
-
"lint": "eslint . --ext .js"
|
|
29
|
+
"lint": "eslint . --ext .js",
|
|
30
|
+
"build": "tsc -p ./tsconfig.build.json"
|
|
27
31
|
},
|
|
28
32
|
"bugs": {
|
|
29
33
|
"url": "https://github.com/yeonjuan/html-eslint/issues"
|
|
@@ -41,11 +45,11 @@
|
|
|
41
45
|
"accessibility"
|
|
42
46
|
],
|
|
43
47
|
"devDependencies": {
|
|
44
|
-
"@html-eslint/parser": "^0.
|
|
45
|
-
"@types/eslint": "^
|
|
48
|
+
"@html-eslint/parser": "^0.23.0",
|
|
49
|
+
"@types/eslint": "^8.56.2",
|
|
46
50
|
"@types/estree": "^0.0.47",
|
|
47
51
|
"es-html-parser": "^0.0.8",
|
|
48
52
|
"typescript": "^4.4.4"
|
|
49
53
|
},
|
|
50
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "4399086819b9c93546fe3b16493638a84ac362c0"
|
|
51
55
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export = plugin;
|
|
2
|
+
/**
|
|
3
|
+
* @type {{configs: {recommended: typeof recommended,"flat/recommended": import("eslint").Linter.FlatConfig , rules: typeof rules}}}
|
|
4
|
+
*/
|
|
5
|
+
declare const plugin: {
|
|
6
|
+
configs: {
|
|
7
|
+
recommended: typeof recommended;
|
|
8
|
+
"flat/recommended": import("eslint").Linter.FlatConfig;
|
|
9
|
+
rules: typeof rules;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
import recommended = require("./configs/recommended");
|
|
13
|
+
import rules = require("./rules");
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,sBAFU;IAAC,OAAO,EAAE;QAAC,aAAa,kBAAkB,CAAC;QAAA,kBAAkB,EAAE,OAAO,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAE;QAAC,OAAO,YAAY,CAAA;KAAC,CAAA;CAAC,CAQjI"}
|