Skip to content

Commit c629e3b

Browse files
committed
fix(deps): update mdast-util-to-hast to ^13.2.1
Address security vulnerability GHSA-4fh9-h7wg-q85m (unsanitized class attribute). Update tests to use ts-ignore for runtime behavior tests.
1 parent d115f5b commit c629e3b

File tree

3 files changed

+104
-82
lines changed

3 files changed

+104
-82
lines changed

lib/omission/closing.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ function dt(_, index, parent) {
176176
const next = siblingAfter(parent, index)
177177
return Boolean(
178178
next &&
179-
next.type === 'element' &&
180-
(next.tagName === 'dt' || next.tagName === 'dd')
179+
next.type === 'element' &&
180+
(next.tagName === 'dt' || next.tagName === 'dd')
181181
)
182182
}
183183

@@ -277,8 +277,8 @@ function thead(_, index, parent) {
277277
const next = siblingAfter(parent, index)
278278
return Boolean(
279279
next &&
280-
next.type === 'element' &&
281-
(next.tagName === 'tbody' || next.tagName === 'tfoot')
280+
next.type === 'element' &&
281+
(next.tagName === 'tbody' || next.tagName === 'tfoot')
282282
)
283283
}
284284

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"comma-separated-tokens": "^2.0.0",
1212
"hast-util-whitespace": "^3.0.0",
1313
"html-void-elements": "^3.0.0",
14-
"mdast-util-to-hast": "^13.0.0",
14+
"mdast-util-to-hast": "^13.2.1",
1515
"property-information": "^7.0.0",
1616
"space-separated-tokens": "^2.0.0",
1717
"stringify-entities": "^4.0.0",

test/attribute.js

Lines changed: 99 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,15 @@ test('`element` attributes', async (t) => {
130130

131131
await t.test('should serialize unknowns set to objects', async function () {
132132
assert.deepEqual(
133-
toHtml({
134-
type: 'element',
135-
tagName: 'i',
136-
// @ts-expect-error: check how the runtime handles a `toString` method on an object.
137-
properties: {unknown: {toString}},
138-
children: []
139-
}),
133+
toHtml(
134+
// @ts-ignore: check how the runtime handles a `toString` method on an object.
135+
{
136+
type: 'element',
137+
tagName: 'i',
138+
properties: {unknown: {toString}},
139+
children: []
140+
}
141+
),
140142
'<i unknown="yup"></i>'
141143
)
142144
})
@@ -531,13 +533,15 @@ test('`element` attributes', async (t) => {
531533
'should serialize known numbers set to an object',
532534
async function () {
533535
assert.deepEqual(
534-
toHtml({
535-
type: 'element',
536-
tagName: 'i',
537-
// @ts-expect-error: check how the runtime handles a `toString` method on an object.
538-
properties: {cols: {toString}},
539-
children: []
540-
}),
536+
toHtml(
537+
// @ts-ignore: check how the runtime handles a `toString` method on an object.
538+
{
539+
type: 'element',
540+
tagName: 'i',
541+
properties: {cols: {toString}},
542+
children: []
543+
}
544+
),
541545
'<i cols="yup"></i>'
542546
)
543547
}
@@ -577,13 +581,15 @@ test('`element` attributes', async (t) => {
577581
'should serialize known numbers set to an array of booleans',
578582
async function () {
579583
assert.deepEqual(
580-
toHtml({
581-
type: 'element',
582-
tagName: 'i',
583-
// @ts-expect-error: check how the runtime handles booleans in an array.
584-
properties: {cols: [true, false]},
585-
children: []
586-
}),
584+
toHtml(
585+
// @ts-ignore: check how the runtime handles booleans in an array.
586+
{
587+
type: 'element',
588+
tagName: 'i',
589+
properties: {cols: [true, false]},
590+
children: []
591+
}
592+
),
587593
'<i cols="true false"></i>'
588594
)
589595
}
@@ -717,13 +723,15 @@ test('`element` attributes', async (t) => {
717723
'should serialize known space-separated lists set to an object',
718724
async function () {
719725
assert.deepEqual(
720-
toHtml({
721-
type: 'element',
722-
tagName: 'i',
723-
// @ts-expect-error: check how the runtime handles a `toString` method on an object.
724-
properties: {className: {toString}},
725-
children: []
726-
}),
726+
toHtml(
727+
// @ts-ignore: check how the runtime handles a `toString` method on an object.
728+
{
729+
type: 'element',
730+
tagName: 'i',
731+
properties: {className: {toString}},
732+
children: []
733+
}
734+
),
727735
'<i class="yup"></i>'
728736
)
729737
}
@@ -763,13 +771,15 @@ test('`element` attributes', async (t) => {
763771
'should serialize known space-separated lists set to an array of booleans',
764772
async function () {
765773
assert.deepEqual(
766-
toHtml({
767-
type: 'element',
768-
tagName: 'i',
769-
// @ts-expect-error: check how the runtime handles booleans in an array.
770-
properties: {className: [true, false]},
771-
children: []
772-
}),
774+
toHtml(
775+
// @ts-ignore: check how the runtime handles booleans in an array.
776+
{
777+
type: 'element',
778+
tagName: 'i',
779+
properties: {className: [true, false]},
780+
children: []
781+
}
782+
),
773783
'<i class="true false"></i>'
774784
)
775785
}
@@ -889,13 +899,15 @@ test('`element` attributes', async (t) => {
889899
'should serialize known comma-separated lists set to an object',
890900
async function () {
891901
assert.deepEqual(
892-
toHtml({
893-
type: 'element',
894-
tagName: 'i',
895-
// @ts-expect-error: check how the runtime handles a `toString` method on an object.
896-
properties: {accept: {toString}},
897-
children: []
898-
}),
902+
toHtml(
903+
// @ts-ignore: check how the runtime handles a `toString` method on an object.
904+
{
905+
type: 'element',
906+
tagName: 'i',
907+
properties: {accept: {toString}},
908+
children: []
909+
}
910+
),
899911
'<i accept="yup"></i>'
900912
)
901913
}
@@ -935,13 +947,15 @@ test('`element` attributes', async (t) => {
935947
'should serialize known comma-separated lists set to an array of booleans',
936948
async function () {
937949
assert.deepEqual(
938-
toHtml({
939-
type: 'element',
940-
tagName: 'i',
941-
// @ts-expect-error: check how the runtime handles booleans in an array.
942-
properties: {accept: [true, false]},
943-
children: []
944-
}),
950+
toHtml(
951+
// @ts-ignore: check how the runtime handles booleans in an array.
952+
{
953+
type: 'element',
954+
tagName: 'i',
955+
properties: {accept: [true, false]},
956+
children: []
957+
}
958+
),
945959
'<i accept="true, false"></i>'
946960
)
947961
}
@@ -1056,13 +1070,15 @@ test('`element` attributes', async (t) => {
10561070
'should serialize known normals set to an object',
10571071
async function () {
10581072
assert.deepEqual(
1059-
toHtml({
1060-
type: 'element',
1061-
tagName: 'i',
1062-
// @ts-expect-error: check how the runtime handles a `toString` method on an object.
1063-
properties: {id: {toString}},
1064-
children: []
1065-
}),
1073+
toHtml(
1074+
// @ts-ignore: check how the runtime handles a `toString` method on an object.
1075+
{
1076+
type: 'element',
1077+
tagName: 'i',
1078+
properties: {id: {toString}},
1079+
children: []
1080+
}
1081+
),
10661082
'<i id="yup"></i>'
10671083
)
10681084
}
@@ -1102,13 +1118,15 @@ test('`element` attributes', async (t) => {
11021118
'should serialize known normals set to an array of booleans as a space-separated list',
11031119
async function () {
11041120
assert.deepEqual(
1105-
toHtml({
1106-
type: 'element',
1107-
tagName: 'i',
1108-
// @ts-expect-error: check how the runtime handles booleans in an array.
1109-
properties: {id: [true, false]},
1110-
children: []
1111-
}),
1121+
toHtml(
1122+
// @ts-ignore: check how the runtime handles booleans in an array.
1123+
{
1124+
type: 'element',
1125+
tagName: 'i',
1126+
properties: {id: [true, false]},
1127+
children: []
1128+
}
1129+
),
11121130
'<i id="true false"></i>'
11131131
)
11141132
}
@@ -1252,13 +1270,15 @@ test('`element` attributes', async (t) => {
12521270
'should serialize data properties set to an object',
12531271
async function () {
12541272
assert.deepEqual(
1255-
toHtml({
1256-
type: 'element',
1257-
tagName: 'i',
1258-
// @ts-expect-error: check how the runtime handles a `toString` method on an object.
1259-
properties: {dataId: {toString}},
1260-
children: []
1261-
}),
1273+
toHtml(
1274+
// @ts-ignore: check how the runtime handles a `toString` method on an object.
1275+
{
1276+
type: 'element',
1277+
tagName: 'i',
1278+
properties: {dataId: {toString}},
1279+
children: []
1280+
}
1281+
),
12621282
'<i data-id="yup"></i>'
12631283
)
12641284
}
@@ -1298,13 +1318,15 @@ test('`element` attributes', async (t) => {
12981318
'should serialize data properties set to an array of booleans as a space-separated list',
12991319
async function () {
13001320
assert.deepEqual(
1301-
toHtml({
1302-
type: 'element',
1303-
tagName: 'i',
1304-
// @ts-expect-error: check how the runtime handles booleans in an array.
1305-
properties: {dataId: [true, false]},
1306-
children: []
1307-
}),
1321+
toHtml(
1322+
// @ts-ignore: check how the runtime handles booleans in an array.
1323+
{
1324+
type: 'element',
1325+
tagName: 'i',
1326+
properties: {dataId: [true, false]},
1327+
children: []
1328+
}
1329+
),
13081330
'<i data-id="true false"></i>'
13091331
)
13101332
}

0 commit comments

Comments
 (0)