Skip to content

Commit f67eee4

Browse files
committed
Refactor to use @imports
1 parent 8ac2d6b commit f67eee4

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* @typedef {import('./lib/index.js').Find} Find
32
* @typedef {import('./lib/index.js').FindAndReplaceList} FindAndReplaceList
43
* @typedef {import('./lib/index.js').FindAndReplaceTuple} FindAndReplaceTuple
4+
* @typedef {import('./lib/index.js').Find} Find
55
* @typedef {import('./lib/index.js').Options} Options
66
* @typedef {import('./lib/index.js').RegExpMatchObject} RegExpMatchObject
7-
* @typedef {import('./lib/index.js').Replace} Replace
87
* @typedef {import('./lib/index.js').ReplaceFunction} ReplaceFunction
8+
* @typedef {import('./lib/index.js').Replace} Replace
99
*/
1010

1111
export {findAndReplace} from './lib/index.js'

lib/index.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
/**
2-
* @typedef {import('mdast').Nodes} Nodes
3-
* @typedef {import('mdast').Parents} Parents
4-
* @typedef {import('mdast').PhrasingContent} PhrasingContent
5-
* @typedef {import('mdast').Root} Root
6-
* @typedef {import('mdast').Text} Text
7-
* @typedef {import('unist-util-visit-parents').Test} Test
8-
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
2+
* @import {Nodes, Parents, PhrasingContent, Root, Text} from 'mdast'
3+
* @import {BuildVisitor, Test, VisitorResult} from 'unist-util-visit-parents'
94
*/
105

116
/**
@@ -90,7 +85,7 @@ export function findAndReplace(tree, list, options) {
9085
visitParents(tree, 'text', visitor)
9186
}
9287

93-
/** @type {import('unist-util-visit-parents').BuildVisitor<Root, 'text'>} */
88+
/** @type {BuildVisitor<Root, 'text'>} */
9489
function visitor(node, parents) {
9590
let index = -1
9691
/** @type {Parents | undefined} */

test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('mdast').Root} Root
2+
* @import {Root} from 'mdast'
33
*/
44

55
import assert from 'node:assert/strict'

0 commit comments

Comments
 (0)