Skip to content

Commit 1077ff3

Browse files
committed
Refactor to use @imports
1 parent aa0dae3 commit 1077ff3

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('./lib/index.js').Options} Options
2+
* @typedef {import('./lib/parse-argv.js').Options} Options
33
*/
44

55
export {args} from './lib/index.js'

lib/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('unified-engine').Callback} EngineCallback
3-
* @typedef {import('unified-engine').Context} EngineContext
4-
*
5-
* @typedef {import('./parse-argv.js').Options} Options
6-
* @typedef {import('./parse-argv.js').State} State
2+
* @import {Options} from 'unified-args'
3+
* @import {Callback as EngineCallback, Context as EngineContext} from 'unified-engine'
4+
* @import {State} from './parse-argv.js'
75
*/
86

97
import process from 'node:process'

lib/parse-argv.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/**
2-
* @typedef {import('unified-engine').Options} EngineOptions
3-
* @typedef {import('unified-engine').Preset} Preset
4-
*
5-
* @typedef {import('./schema.js').Field} Field
2+
* @import {Options as EngineOptions, Preset} from 'unified-engine'
3+
* @import {Field} from './schema.js'
64
*/
75

86
/**

test/fixtures/plugins/plugin.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
/** @type {import('unified').Plugin<[unknown?]>} */
1+
/**
2+
* @import {Plugin} from 'unified'
3+
*/
4+
5+
/** @type {Plugin<[unknown?]>} */
26
export default function plugin(options) {
37
console.log(JSON.stringify(options))
48
}

test/fixtures/processor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
2-
* @typedef {import('unist').Literal} Literal
3-
* @typedef {import('unist').Node} Node
2+
* @import {Compiler, Parser, Plugin} from 'unified'
3+
* @import {Literal, Node} from 'unist'
44
*/
55

66
import {unified} from 'unified'
77

88
export const processor = unified()
99
.use(
10-
/** @type {import('unified').Plugin<[], string, Node>} */
10+
/** @type {Plugin<[], string, Node>} */
1111
// @ts-expect-error: TS is wrong about `this`.
1212
function () {
13-
/** @type {import('unified').Parser<Node>} */
13+
/** @type {Parser<Node>} */
1414
this.parser = function (value) {
1515
/** @type {Literal} */
1616
const node = {type: 'text', value}
@@ -19,10 +19,10 @@ export const processor = unified()
1919
}
2020
)
2121
.use(
22-
/** @type {import('unified').Plugin<[], Node, string>} */
22+
/** @type {Plugin<[], Node, string>} */
2323
// @ts-expect-error: TS is wrong about `this`.
2424
function () {
25-
/** @type {import('unified').Compiler<Node, string>} */
25+
/** @type {Compiler<Node, string>} */
2626
this.compiler = function (tree) {
2727
const node = /** @type {Literal} */ (tree)
2828
return String(node.value)

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @typedef {import('execa').ExecaError<string>} ExecaError
2+
* @import {ExecaError} from 'execa'
33
*/
44

55
import assert from 'node:assert/strict'

0 commit comments

Comments
 (0)