-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
errors.js
349 lines (348 loc) · 12.5 KB
/
errors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/**
* @typedef ErrorInfo
* Info on a `parse5` error.
* @property {string} reason
* Reason of error.
* @property {string} description
* More info on error.
* @property {false} [url]
* Turn off if this is not documented in the html5 spec (optional).
*/
export const errors = {
/** @type {ErrorInfo} */
abandonedHeadElementChild: {
reason: 'Unexpected metadata element after head',
description:
'Unexpected element after head. Expected the element before `</head>`',
url: false
},
/** @type {ErrorInfo} */
abruptClosingOfEmptyComment: {
reason: 'Unexpected abruptly closed empty comment',
description: 'Unexpected `>` or `->`. Expected `-->` to close comments'
},
/** @type {ErrorInfo} */
abruptDoctypePublicIdentifier: {
reason: 'Unexpected abruptly closed public identifier',
description:
'Unexpected `>`. Expected a closing `"` or `\'` after the public identifier'
},
/** @type {ErrorInfo} */
abruptDoctypeSystemIdentifier: {
reason: 'Unexpected abruptly closed system identifier',
description:
'Unexpected `>`. Expected a closing `"` or `\'` after the identifier identifier'
},
/** @type {ErrorInfo} */
absenceOfDigitsInNumericCharacterReference: {
reason: 'Unexpected non-digit at start of numeric character reference',
description:
'Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references'
},
/** @type {ErrorInfo} */
cdataInHtmlContent: {
reason: 'Unexpected CDATA section in HTML',
description:
'Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead'
},
/** @type {ErrorInfo} */
characterReferenceOutsideUnicodeRange: {
reason: 'Unexpected too big numeric character reference',
description:
'Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)'
},
/** @type {ErrorInfo} */
closingOfElementWithOpenChildElements: {
reason: 'Unexpected closing tag with open child elements',
description:
'Unexpectedly closing tag. Expected other tags to be closed first',
url: false
},
/** @type {ErrorInfo} */
controlCharacterInInputStream: {
reason: 'Unexpected control character',
description:
'Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace'
},
/** @type {ErrorInfo} */
controlCharacterReference: {
reason: 'Unexpected control character reference',
description:
'Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace'
},
/** @type {ErrorInfo} */
disallowedContentInNoscriptInHead: {
reason: 'Disallowed content inside `<noscript>` in `<head>`',
description:
'Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`',
url: false
},
/** @type {ErrorInfo} */
duplicateAttribute: {
reason: 'Unexpected duplicate attribute',
description:
'Unexpectedly double attribute. Expected attributes to occur only once'
},
/** @type {ErrorInfo} */
endTagWithAttributes: {
reason: 'Unexpected attribute on closing tag',
description: 'Unexpected attribute. Expected `>` instead'
},
/** @type {ErrorInfo} */
endTagWithTrailingSolidus: {
reason: 'Unexpected slash at end of closing tag',
description: 'Unexpected `%c-1`. Expected `>` instead'
},
/** @type {ErrorInfo} */
endTagWithoutMatchingOpenElement: {
reason: 'Unexpected unopened end tag',
description: 'Unexpected end tag. Expected no end tag or another end tag',
url: false
},
/** @type {ErrorInfo} */
eofBeforeTagName: {
reason: 'Unexpected end of file',
description: 'Unexpected end of file. Expected tag name instead'
},
/** @type {ErrorInfo} */
eofInCdata: {
reason: 'Unexpected end of file in CDATA',
description: 'Unexpected end of file. Expected `]]>` to close the CDATA'
},
/** @type {ErrorInfo} */
eofInComment: {
reason: 'Unexpected end of file in comment',
description: 'Unexpected end of file. Expected `-->` to close the comment'
},
/** @type {ErrorInfo} */
eofInDoctype: {
reason: 'Unexpected end of file in doctype',
description:
'Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)'
},
/** @type {ErrorInfo} */
eofInElementThatCanContainOnlyText: {
reason: 'Unexpected end of file in element that can only contain text',
description: 'Unexpected end of file. Expected text or a closing tag',
url: false
},
/** @type {ErrorInfo} */
eofInScriptHtmlCommentLikeText: {
reason: 'Unexpected end of file in comment inside script',
description: 'Unexpected end of file. Expected `-->` to close the comment'
},
/** @type {ErrorInfo} */
eofInTag: {
reason: 'Unexpected end of file in tag',
description: 'Unexpected end of file. Expected `>` to close the tag'
},
/** @type {ErrorInfo} */
incorrectlyClosedComment: {
reason: 'Incorrectly closed comment',
description: 'Unexpected `%c-1`. Expected `-->` to close the comment'
},
/** @type {ErrorInfo} */
incorrectlyOpenedComment: {
reason: 'Incorrectly opened comment',
description: 'Unexpected `%c`. Expected `<!--` to open the comment'
},
/** @type {ErrorInfo} */
invalidCharacterSequenceAfterDoctypeName: {
reason: 'Invalid sequence after doctype name',
description: 'Unexpected sequence at `%c`. Expected `public` or `system`'
},
/** @type {ErrorInfo} */
invalidFirstCharacterOfTagName: {
reason: 'Invalid first character in tag name',
description: 'Unexpected `%c`. Expected an ASCII letter instead'
},
/** @type {ErrorInfo} */
misplacedDoctype: {
reason: 'Misplaced doctype',
description: 'Unexpected doctype. Expected doctype before head',
url: false
},
/** @type {ErrorInfo} */
misplacedStartTagForHeadElement: {
reason: 'Misplaced `<head>` start tag',
description:
'Unexpected start tag `<head>`. Expected `<head>` directly after doctype',
url: false
},
/** @type {ErrorInfo} */
missingAttributeValue: {
reason: 'Missing attribute value',
description:
'Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead'
},
/** @type {ErrorInfo} */
missingDoctype: {
reason: 'Missing doctype before other content',
description: 'Expected a `<!doctype html>` before anything else',
url: false
},
/** @type {ErrorInfo} */
missingDoctypeName: {
reason: 'Missing doctype name',
description: 'Unexpected doctype end at `%c`. Expected `html` instead'
},
/** @type {ErrorInfo} */
missingDoctypePublicIdentifier: {
reason: 'Missing public identifier in doctype',
description: 'Unexpected `%c`. Expected identifier for `public` instead'
},
/** @type {ErrorInfo} */
missingDoctypeSystemIdentifier: {
reason: 'Missing system identifier in doctype',
description:
'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'
},
/** @type {ErrorInfo} */
missingEndTagName: {
reason: 'Missing name in end tag',
description: 'Unexpected `%c`. Expected an ASCII letter instead'
},
/** @type {ErrorInfo} */
missingQuoteBeforeDoctypePublicIdentifier: {
reason: 'Missing quote before public identifier in doctype',
description: 'Unexpected `%c`. Expected `"` or `\'` instead'
},
/** @type {ErrorInfo} */
missingQuoteBeforeDoctypeSystemIdentifier: {
reason: 'Missing quote before system identifier in doctype',
description: 'Unexpected `%c`. Expected `"` or `\'` instead'
},
/** @type {ErrorInfo} */
missingSemicolonAfterCharacterReference: {
reason: 'Missing semicolon after character reference',
description: 'Unexpected `%c`. Expected `;` instead'
},
/** @type {ErrorInfo} */
missingWhitespaceAfterDoctypePublicKeyword: {
reason: 'Missing whitespace after public identifier in doctype',
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
},
/** @type {ErrorInfo} */
missingWhitespaceAfterDoctypeSystemKeyword: {
reason: 'Missing whitespace after system identifier in doctype',
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
},
/** @type {ErrorInfo} */
missingWhitespaceBeforeDoctypeName: {
reason: 'Missing whitespace before doctype name',
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
},
/** @type {ErrorInfo} */
missingWhitespaceBetweenAttributes: {
reason: 'Missing whitespace between attributes',
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
},
/** @type {ErrorInfo} */
missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers: {
reason:
'Missing whitespace between public and system identifiers in doctype',
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
},
/** @type {ErrorInfo} */
nestedComment: {
reason: 'Unexpected nested comment',
description: 'Unexpected `<!--`. Expected `-->`'
},
/** @type {ErrorInfo} */
nestedNoscriptInHead: {
reason: 'Unexpected nested `<noscript>` in `<head>`',
description:
'Unexpected `<noscript>`. Expected a closing tag or a meta element',
url: false
},
/** @type {ErrorInfo} */
nonConformingDoctype: {
reason: 'Unexpected non-conforming doctype declaration',
description:
'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',
url: false
},
/** @type {ErrorInfo} */
nonVoidHtmlElementStartTagWithTrailingSolidus: {
reason: 'Unexpected trailing slash on start tag of non-void element',
description: 'Unexpected `/`. Expected `>` instead'
},
/** @type {ErrorInfo} */
noncharacterCharacterReference: {
reason:
'Unexpected noncharacter code point referenced by character reference',
description: 'Unexpected code point. Do not use noncharacters in HTML'
},
/** @type {ErrorInfo} */
noncharacterInInputStream: {
reason: 'Unexpected noncharacter character',
description: 'Unexpected code point `%x`. Do not use noncharacters in HTML'
},
/** @type {ErrorInfo} */
nullCharacterReference: {
reason: 'Unexpected NULL character referenced by character reference',
description: 'Unexpected code point. Do not use NULL characters in HTML'
},
/** @type {ErrorInfo} */
openElementsLeftAfterEof: {
reason: 'Unexpected end of file',
description: 'Unexpected end of file. Expected closing tag instead',
url: false
},
/** @type {ErrorInfo} */
surrogateCharacterReference: {
reason: 'Unexpected surrogate character referenced by character reference',
description:
'Unexpected code point. Do not use lone surrogate characters in HTML'
},
/** @type {ErrorInfo} */
surrogateInInputStream: {
reason: 'Unexpected surrogate character',
description:
'Unexpected code point `%x`. Do not use lone surrogate characters in HTML'
},
/** @type {ErrorInfo} */
unexpectedCharacterAfterDoctypeSystemIdentifier: {
reason: 'Invalid character after system identifier in doctype',
description: 'Unexpected character at `%c`. Expected `>`'
},
/** @type {ErrorInfo} */
unexpectedCharacterInAttributeName: {
reason: 'Unexpected character in attribute name',
description:
'Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter'
},
/** @type {ErrorInfo} */
unexpectedCharacterInUnquotedAttributeValue: {
reason: 'Unexpected character in unquoted attribute value',
description: 'Unexpected `%c`. Quote the attribute value to include it'
},
/** @type {ErrorInfo} */
unexpectedEqualsSignBeforeAttributeName: {
reason: 'Unexpected equals sign before attribute name',
description: 'Unexpected `%c`. Add an attribute name before it'
},
/** @type {ErrorInfo} */
unexpectedNullCharacter: {
reason: 'Unexpected NULL character',
description:
'Unexpected code point `%x`. Do not use NULL characters in HTML'
},
/** @type {ErrorInfo} */
unexpectedQuestionMarkInsteadOfTagName: {
reason: 'Unexpected question mark instead of tag name',
description: 'Unexpected `%c`. Expected an ASCII letter instead'
},
/** @type {ErrorInfo} */
unexpectedSolidusInTag: {
reason: 'Unexpected slash in tag',
description:
'Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value'
},
/** @type {ErrorInfo} */
unknownNamedCharacterReference: {
reason: 'Unexpected unknown named character reference',
description:
'Unexpected character reference. Expected known named character references'
}
}