File tree Expand file tree Collapse file tree 3 files changed +7
-15
lines changed Expand file tree Collapse file tree 3 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -50,21 +50,12 @@ export function excerpt(tree, options = {}) {
50
50
}
51
51
52
52
if (
53
- // @ts -expect-error: integrate w/ `mdast-util-mdx`
54
53
( node . type === 'mdxFlowExpression' ||
55
- // @ts -expect-error
56
54
node . type === 'mdxTextExpression' ) &&
57
- // @ts -expect-error
58
55
node . data &&
59
- // @ts -expect-error
60
56
node . data . estree &&
61
- // @ts -expect-error
62
57
node . data . estree . comments &&
63
- // @ts -expect-error
64
- node . data . estree . comments . some (
65
- ( /** @type {import('acorn').Comment } */ node ) =>
66
- node . value . trim ( ) === comment
67
- )
58
+ node . data . estree . comments . some ( ( node ) => node . value . trim ( ) === comment )
68
59
) {
69
60
found = true
70
61
return
@@ -79,7 +70,8 @@ export function excerpt(tree, options = {}) {
79
70
let index = - 1
80
71
81
72
while ( ++ index < node . children . length && ! found ) {
82
- const result = preorder ( node . children [ index ] )
73
+ const child = /** @type {Node } */ ( node . children [ index ] )
74
+ const result = preorder ( child )
83
75
// @ts -expect-error: assume content model matches.
84
76
if ( result ) children . push ( result )
85
77
}
Original file line number Diff line number Diff line change 43
43
"hast-util-select" : " ^5.0.0" ,
44
44
"hastscript" : " ^7.0.0" ,
45
45
"mdast-util-from-markdown" : " ^1.0.0" ,
46
- "mdast-util-mdx" : " ^1 .0.0" ,
47
- "mdast-util-to-hast" : " ^11 .0.0" ,
46
+ "mdast-util-mdx" : " ^2 .0.0" ,
47
+ "mdast-util-to-hast" : " ^12 .0.0" ,
48
48
"micromark-extension-mdxjs" : " ^1.0.0" ,
49
49
"prettier" : " ^2.0.0" ,
50
50
"remark-cli" : " ^10.0.0" ,
55
55
"typescript" : " ^4.0.0" ,
56
56
"unist-builder" : " ^3.0.0" ,
57
57
"unist-util-remove-position" : " ^4.0.0" ,
58
- "xo" : " ^0.44 .0"
58
+ "xo" : " ^0.49 .0"
59
59
},
60
60
"scripts" : {
61
61
"prepack" : " npm run build && npm run format" ,
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ test('hastUtilExcerpt', (t) => {
91
91
removePosition (
92
92
fromMarkdown ( 'Some text\n\n{/* more */}\n\nSome more text' , {
93
93
extensions : [ mdxjs ( ) ] ,
94
- mdastExtensions : [ mdxFromMarkdown ]
94
+ mdastExtensions : [ mdxFromMarkdown ( ) ]
95
95
} )
96
96
) ,
97
97
{ passThrough : [ 'mdxFlowExpression' , 'mdxTextExpression' , 'mdxjsEsm' ] }
You can’t perform that action at this time.
0 commit comments