Skip to content

Commit 8892b29

Browse files
committed
Refactor to use @imports
1 parent c855537 commit 8892b29

37 files changed

+118
-260
lines changed

lib/handlers/a.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Link} Link
5-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
6-
*
7-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Link, PhrasingContent} from 'mdast'
85
*/
96

10-
// Fix to let VS Code see references to the above types.
11-
''
12-
137
/**
148
* @param {State} state
159
* State.

lib/handlers/base.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
54
*/
65

7-
// Fix to let VS Code see references to the above types.
8-
''
9-
106
/**
117
* @param {State} state
128
* State.

lib/handlers/blockquote.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Blockquote} Blockquote
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Blockquote} from 'mdast'
75
*/
86

9-
// Fix to let VS Code see references to the above types.
10-
''
11-
127
/**
138
* @param {State} state
149
* State.

lib/handlers/br.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Break} Break
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Break} from 'mdast'
75
*/
86

9-
// Fix to let VS Code see references to the above types.
10-
''
11-
127
/**
138
* @param {State} state
149
* State.

lib/handlers/code.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Code} Code
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Code} from 'mdast'
75
*/
86

97
import {toText} from 'hast-util-to-text'

lib/handlers/comment.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
/**
2-
* @typedef {import('hast').Comment} Comment
3-
*
4-
* @typedef {import('mdast').Html} Html
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Comment} from 'hast'
4+
* @import {Html} from 'mdast'
75
*/
86

9-
// Fix to let VS Code see references to the above types.
10-
''
11-
127
/**
138
* @param {State} state
149
* State.

lib/handlers/del.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Delete} Delete
5-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
6-
*
7-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Delete, PhrasingContent} from 'mdast'
85
*/
96

10-
// Fix to let VS Code see references to the above types.
11-
''
12-
137
/**
148
* @param {State} state
159
* State.

lib/handlers/dl.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
* @typedef {import('hast').ElementContent} ElementContent
4-
*
5-
* @typedef {import('mdast').BlockContent} BlockContent
6-
* @typedef {import('mdast').DefinitionContent} DefinitionContent
7-
* @typedef {import('mdast').List} List
8-
* @typedef {import('mdast').ListContent} ListContent
9-
* @typedef {import('mdast').ListItem} ListItem
10-
*
11-
* @typedef {import('../state.js').State} State
12-
*
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {ElementContent, Element} from 'hast'
4+
* @import {BlockContent, DefinitionContent, ListContent, ListItem, List} from 'mdast'
135
*/
146

157
/**

lib/handlers/em.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Emphasis} Emphasis
5-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
6-
*
7-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Emphasis, PhrasingContent} from 'mdast'
85
*/
96

10-
// Fix to let VS Code see references to the above types.
11-
''
12-
137
/**
148
* @param {State} state
159
* State.

lib/handlers/heading.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Heading} Heading
5-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
6-
*
7-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Heading, PhrasingContent} from 'mdast'
85
*/
96

10-
// Fix to let VS Code see references to the above types.
11-
''
12-
137
/**
148
* @param {State} state
159
* State.

lib/handlers/hr.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').ThematicBreak} ThematicBreak
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {ThematicBreak} from 'mdast'
75
*/
86

9-
// Fix to let VS Code see references to the above types.
10-
''
11-
127
/**
138
* @param {State} state
149
* State.

lib/handlers/iframe.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Link} Link
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Link} from 'mdast'
75
*/
86

9-
// Fix to let VS Code see references to the above types.
10-
''
11-
127
/**
138
* @param {State} state
149
* State.

lib/handlers/img.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Image} Image
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Image} from 'mdast'
75
*/
86

9-
// Fix to let VS Code see references to the above types.
10-
''
11-
127
/**
138
* @param {State} state
149
* State.

lib/handlers/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
2-
* @typedef {import('hast').Parents} Parents
3-
*
4-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Parents} from 'hast'
54
*/
65

76
import {a} from './a.js'

lib/handlers/inline-code.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').InlineCode} InlineCode
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {InlineCode} from 'mdast'
75
*/
86

97
import {toText} from 'hast-util-to-text'

lib/handlers/input.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Image} Image
5-
* @typedef {import('mdast').Link} Link
6-
* @typedef {import('mdast').Text} Text
7-
*
8-
* @typedef {import('../util/find-selected-options.js').Options} Options
9-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Image, Link, Text} from 'mdast'
5+
* @import {Options} from '../util/find-selected-options.js'
106
*/
117

128
import {findSelectedOptions} from '../util/find-selected-options.js'

lib/handlers/li.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').ListItem} ListItem
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {ListItem} from 'mdast'
75
*/
86

97
/**

lib/handlers/list.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').List} List
5-
* @typedef {import('mdast').ListContent} ListContent
6-
* @typedef {import('mdast').ListItem} ListItem
7-
*
8-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {ListItem, List} from 'mdast'
95
*/
106

117
import {listItemsSpread} from '../util/list-items-spread.js'

lib/handlers/media.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Image} Image
5-
* @typedef {import('mdast').Link} Link
6-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
7-
* @typedef {import('mdast').Root} Root
8-
* @typedef {import('mdast').RootContent} MdastRootContent
9-
*
10-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Image, Link, PhrasingContent, RootContent as MdastRootContent, Root} from 'mdast'
115
*/
126

137
import {toString} from 'mdast-util-to-string'

lib/handlers/p.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Paragraph} Paragraph
5-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
6-
*
7-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Paragraph, PhrasingContent} from 'mdast'
85
*/
96

10-
// Fix to let VS Code see references to the above types.
11-
''
12-
137
/**
148
* @param {State} state
159
* State.

lib/handlers/q.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').RootContent} MdastRootContent
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {RootContent as MdastRootContent} from 'mdast'
75
*/
86

97
const defaultQuotes = ['"']

lib/handlers/root.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('hast').Root} HastRoot
3-
*
4-
* @typedef {import('mdast').Root} MdastRoot
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Root as HastRoot} from 'hast'
4+
* @import {Root as MdastRoot} from 'mdast'
75
*/
86

97
import {wrap, wrapNeeded} from '../util/wrap.js'

lib/handlers/select.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Text} Text
5-
*
6-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {Text} from 'mdast'
75
*/
86

97
import {findSelectedOptions} from '../util/find-selected-options.js'

lib/handlers/strong.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
/**
2-
* @typedef {import('hast').Element} Element
3-
*
4-
* @typedef {import('mdast').Strong} Strong
5-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
6-
*
7-
* @typedef {import('../state.js').State} State
2+
* @import {State} from 'hast-util-to-mdast'
3+
* @import {Element} from 'hast'
4+
* @import {PhrasingContent, Strong} from 'mdast'
85
*/
96

10-
// Fix to let VS Code see references to the above types.
11-
''
12-
137
/**
148
* @param {State} state
159
* State.

0 commit comments

Comments
 (0)