Skip to content

Commit 34a5ba4

Browse files
committed
Refactor to use @imports
1 parent 6b2533a commit 34a5ba4

File tree

43 files changed

+188
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+188
-175
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* @typedef {import('./lib/configuration.js').ConfigResult} ConfigResult
33
* @typedef {import('./lib/file-set.js').Completer} Completer
44
* @typedef {import('./lib/index.js').Callback} Callback
5-
* @typedef {import('./lib/index.js').ConfigTransform} ConfigTransform
5+
* @typedef {import('./lib/configuration.js').ConfigTransform} ConfigTransform
66
* @typedef {import('./lib/index.js').Context} Context
7-
* @typedef {import('./lib/index.js').FileSet} FileSet
7+
* @typedef {import('./lib/file-set.js').FileSet} FileSet
88
* @typedef {import('./lib/index.js').Options} Options
9-
* @typedef {import('./lib/index.js').PresetSupportingSpecifiers} Preset
10-
* @typedef {import('./lib/index.js').ResolveFrom} ResolveFrom
9+
* @typedef {import('./lib/configuration.js').PresetSupportingSpecifiers} Preset
10+
* @typedef {import('./lib/ignore.js').ResolveFrom} ResolveFrom
1111
* @typedef {import('./lib/index.js').VFileReporter} VFileReporter
1212
*/
1313

lib/configuration.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/**
2-
* @typedef {import('unified').Plugin<Array<unknown>>} Plugin
3-
* @typedef {import('unified').PluginTuple<Array<unknown>>} PluginTuple
4-
* @typedef {import('unified').Preset} Preset
5-
* @typedef {import('unified').Settings} Settings
2+
* @import {PluginTuple, Plugin, Preset, Settings} from 'unified'
63
*/
74

85
/**
@@ -19,7 +16,7 @@
1916
* Resolved configuration.
2017
* @property {string | undefined} filePath
2118
* File path of found configuration.
22-
* @property {Array<PluginTuple>} plugins
19+
* @property {Array<PluginTuple<Array<unknown>>>} plugins
2320
* Resolved plugins.
2421
* @property {Settings} settings
2522
* Resolved settings.
@@ -61,10 +58,10 @@
6158
* @typedef {PluginSupportingSpecifiers | PluginTupleSupportingSpecifiers | Preset} PluggableSupportingSpecifiers
6259
* Usable values, with support for specifiers.
6360
*
64-
* @typedef {Plugin | string} PluginSupportingSpecifiers
61+
* @typedef {Plugin<Array<unknown>> | string} PluginSupportingSpecifiers
6562
* A plugin, or a specifier to one.
6663
*
67-
* @typedef {[plugin: string, ...parameters: Array<unknown>] | PluginTuple} PluginTupleSupportingSpecifiers
64+
* @typedef {[plugin: string, ...parameters: Array<unknown>] | PluginTuple<Array<unknown>>} PluginTupleSupportingSpecifiers
6865
* A plugin with configuration, with support for specifiers.
6966
*
7067
* @typedef PresetSupportingSpecifiers
@@ -439,7 +436,7 @@ async function merge(target, raw, options) {
439436
try {
440437
if (typeof result === 'function') {
441438
// Assume plugin.
442-
const plugin = /** @type {Plugin} */ (result)
439+
const plugin = /** @type {Plugin<Array<unknown>>} */ (result)
443440
addPlugin(plugin, value)
444441
} else {
445442
// Assume preset.
@@ -462,7 +459,7 @@ async function merge(target, raw, options) {
462459
}
463460

464461
/**
465-
* @param {Plugin} plugin
462+
* @param {Plugin<Array<unknown>>} plugin
466463
* Plugin.
467464
* @param {unknown} value
468465
* Primary parameter.
@@ -485,7 +482,7 @@ async function merge(target, raw, options) {
485482
}
486483

487484
/**
488-
* @param {PluginTuple} entry
485+
* @param {PluginTuple<Array<unknown>>} entry
489486
* Tuple.
490487
* @param {unknown} value
491488
* Primary value.
@@ -501,11 +498,11 @@ function reconfigure(entry, value) {
501498
}
502499

503500
/**
504-
* @param {Array<PluginTuple>} entries
501+
* @param {Array<PluginTuple<Array<unknown>>>} entries
505502
* Tuples.
506-
* @param {Plugin} plugin
503+
* @param {Plugin<Array<unknown>>} plugin
507504
* Plugin.
508-
* @returns {PluginTuple | undefined}
505+
* @returns {PluginTuple<Array<unknown>> | undefined}
509506
* Tuple.
510507
*/
511508
function find(entries, plugin) {

lib/file-pipeline/configure.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('trough').Callback} Callback
3-
*
4-
* @typedef {import('vfile').VFile} VFile
5-
*
6-
* @typedef {import('./index.js').Context} Context
2+
* @import {Callback} from 'trough'
3+
* @import {VFile} from 'vfile'
4+
* @import {Context} from './index.js'
75
*/
86

97
import createDebug from 'debug'

lib/file-pipeline/copy.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('trough').Callback} Callback
3-
*
4-
* @typedef {import('vfile').VFile} VFile
5-
*
6-
* @typedef {import('./index.js').Context} Context
2+
* @import {Callback} from 'trough'
3+
* @import {VFile} from 'vfile'
4+
* @import {Context} from './index.js'
75
*/
86

97
import fs from 'node:fs'

lib/file-pipeline/file-system.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('trough').Callback} Callback
3-
*
4-
* @typedef {import('vfile').VFile} VFile
5-
*
6-
* @typedef {import('./index.js').Context} Context
2+
* @import {Callback} from 'trough'
3+
* @import {VFile} from 'vfile'
4+
* @import {Context} from './index.js'
75
*/
86

97
import fs from 'node:fs'

lib/file-pipeline/index.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
/**
2-
* @typedef {import('trough').Pipeline} Pipeline
3-
*
4-
* @typedef {import('unified').Processor} Processor
5-
*
6-
* @typedef {import('unist').Node} Node
7-
*
8-
* @typedef {import('vfile').VFile} VFile
9-
*
10-
* @typedef {import('vfile-message').VFileMessage} VFileMessage
11-
*
12-
* @typedef {import('../configuration.js').Configuration} Configuration
13-
* @typedef {import('../file-set.js').FileSet} FileSet
14-
* @typedef {import('../index.js').Settings} Settings
2+
* @import {Pipeline} from 'trough'
3+
* @import {Processor} from 'unified'
4+
* @import {Node} from 'unist'
5+
* @import {VFileMessage} from 'vfile-message'
6+
* @import {VFile} from 'vfile'
7+
* @import {Configuration} from '../configuration.js'
8+
* @import {Settings} from '../index.js'
9+
* @import {FileSet} from '../file-set.js'
1510
*/
1611

1712
/**

lib/file-pipeline/parse.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('unist').Node} Node
3-
*
4-
* @typedef {import('vfile').VFile} VFile
5-
*
6-
* @typedef {import('./index.js').Context} Context
2+
* @import {Node} from 'unist'
3+
* @import {VFile} from 'vfile'
4+
* @import {Context} from './index.js'
75
*/
86

97
import createDebug from 'debug'

lib/file-pipeline/queue.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('trough').Callback} Callback
3-
*
4-
* @typedef {import('vfile').VFile} VFile
5-
*
6-
* @typedef {import('./index.js').Context} Context
2+
* @import {Callback} from 'trough'
3+
* @import {VFile} from 'vfile'
4+
* @import {Context} from './index.js'
75
*/
86

97
import createDebug from 'debug'

lib/file-pipeline/read.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('trough').Callback} Callback
3-
*
4-
* @typedef {import('vfile').VFile} VFile
5-
*
6-
* @typedef {import('./index.js').Context} Context
2+
* @import {Callback} from 'trough'
3+
* @import {VFile} from 'vfile'
4+
* @import {Context} from './index.js'
75
*/
86

97
import fs from 'node:fs'

lib/file-pipeline/stdout.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* @typedef {import('trough').Callback} Callback
3-
*
4-
* @typedef {import('vfile').VFile} VFile
5-
*
6-
* @typedef {import('./index.js').Context} Context
2+
* @import {Callback} from 'trough'
3+
* @import {VFile} from 'vfile'
4+
* @import {Context} from './index.js'
75
*/
86

97
import createDebug from 'debug'

0 commit comments

Comments
 (0)