Skip to content

Commit e90c5c5

Browse files
committed
.
0 parents  commit e90c5c5

File tree

133 files changed

+3846
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+3846
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.github/workflows/bb.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: bb
2+
on:
3+
issues:
4+
types: [opened, reopened, edited, closed, labeled, unlabeled]
5+
pull_request_target:
6+
types: [opened, reopened, edited, closed, labeled, unlabeled]
7+
jobs:
8+
main:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: unifiedjs/beep-boop-beta@main
12+
with:
13+
repo-token: ${{secrets.GITHUB_TOKEN}}

.github/workflows/main.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: main
2+
on:
3+
- pull_request
4+
- push
5+
jobs:
6+
main:
7+
name: ${{matrix.node}}
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: dcodeIO/setup-node-nvm@master
12+
with:
13+
node-version: ${{matrix.node}}
14+
- run: npm install
15+
- run: npm test
16+
- uses: codecov/codecov-action@v1
17+
strategy:
18+
matrix:
19+
node:
20+
- lts/erbium
21+
- node

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
*.d.ts
3+
*.log
4+
coverage/
5+
node_modules/
6+
yarn.lock
7+
test/error-codes-from-p5.js

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage/
2+
*.html
3+
*.md

index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @typedef {import('./lib/index.js').Options} Options
3+
* @typedef {import('./lib/index.js').OnError} OnError
4+
* @typedef {import('./lib/index.js').ErrorCode} ErrorCode
5+
* @typedef {import('./lib/index.js').ErrorSeverity} ErrorSeverity
6+
*/
7+
8+
export {fromHtml} from './lib/index.js'

lib/errors.js

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

0 commit comments

Comments
 (0)