Update dev-dependencies

This commit is contained in:
Titus Wormer 2024-04-07 18:08:13 +02:00
parent 802f78f0fa
commit 7e676ed54a
No known key found for this signature in database
GPG Key ID: E6E581152ED04E2E
6 changed files with 25 additions and 21 deletions

View File

@ -144,7 +144,7 @@
"to-vfile": "^8.0.0",
"type-coverage": "^2.0.0",
"type-fest": "^4.0.0",
"typescript": "^5.4.0-beta",
"typescript": "^5.4.0",
"unified": "^11.0.0",
"unist-builder": "^4.0.0",
"unist-util-remove-position": "^5.0.0",
@ -152,7 +152,7 @@
"vfile-find-down": "^7.0.0",
"vfile-reporter": "^8.0.0",
"vfile-sort": "^4.0.0",
"xo": "^0.56.0"
"xo": "^0.58.0"
},
"scripts": {
"generate": "node --conditions development script/build-packages.js",

View File

@ -37,7 +37,7 @@
"mdast-util-phrasing": "^4.0.0",
"unified-lint-rule": "^2.0.0",
"unist-util-visit-parents": "^6.0.0",
"vfile-message": "4.0.0"
"vfile-message": "^4.0.0"
},
"scripts": {},
"typeCoverage": {

View File

@ -50,7 +50,8 @@
"xo": {
"prettier": true,
"rules": {
"capitalized-comments": "off"
"capitalized-comments": "off",
"logical-assignment-operators": "off"
}
}
}

View File

@ -266,8 +266,10 @@ async function addPlugin(name) {
*/
async function addPreset(name) {
/** @type {{default: Preset}} */
const mod = await import(new URL(name + '/index.js', packagesUrl).href)
const plugins = mod.default.plugins
const presetModule = await import(
new URL(name + '/index.js', packagesUrl).href
)
const plugins = presetModule.default.plugins
assert(plugins, 'expected plugins in preset')
/** @type {PresetInfo} */
const presetInfo = {name, plugins: []}
@ -277,21 +279,22 @@ async function addPreset(name) {
while (++index < plugins.length) {
const plugin = plugins[index]
/** @type {import('unified').Plugin<[unknown]>} */
let fn
let pluginFunction
/** @type {unknown} */
let option
if (Array.isArray(plugin)) {
;[fn, option] = /** @type {import('unified').PluginTuple<[unknown]>} */ (
plugin
)
;[pluginFunction, option] =
/** @type {import('unified').PluginTuple<[unknown]>} */ (plugin)
} else {
assert(typeof plugin === 'function')
fn = plugin
pluginFunction = plugin
}
// @ts-expect-error: `displayName`s are fine.
const name = /** @type {string} */ (fn.displayName || fn.name)
const name = /** @type {string} */ (
// @ts-expect-error: `displayName`s are fine.
pluginFunction.displayName || pluginFunction.name
)
const pluginName = name
.replace(

View File

@ -331,7 +331,7 @@ async function generateReadme(state) {
const description = stripIndent(fileInfo.description || '').trim()
const explicitDocs = fromMarkdown(description, {
const explicitDescription = fromMarkdown(description, {
extensions: [gfm()],
mdastExtensions: [gfmFromMarkdown()]
})
@ -341,9 +341,9 @@ async function generateReadme(state) {
let category = 'intro'
let contentIndex = -1
while (++contentIndex < explicitDocs.children.length) {
while (++contentIndex < explicitDescription.children.length) {
const node = /** @type {TopLevelContent} */ (
explicitDocs.children[contentIndex]
explicitDescription.children[contentIndex]
)
if (node.type === 'heading' && node.depth === 2) {

10
test.js
View File

@ -32,7 +32,7 @@ test('remark-lint', async function (t) {
])
})
const doc = [
const value = [
'# A heading',
'',
'# Another main heading.',
@ -47,7 +47,7 @@ test('remark-lint', async function (t) {
.use(remarkLintNoHeadingPunctuation)
.use(remarkLintNoMultipleToplevelHeadings)
.use(remarkLint)
.process({path: 'virtual.md', value: doc})
.process({path: 'virtual.md', value})
assert.deepEqual(file.messages.map(String), [
'virtual.md:3:1-3:24: Unexpected character `.` at end of heading, remove it',
@ -60,7 +60,7 @@ test('remark-lint', async function (t) {
.use(remarkLint)
.use(remarkLintNoHeadingPunctuation)
.use(remarkLintNoMultipleToplevelHeadings)
.process({path: 'virtual.md', value: doc})
.process({path: 'virtual.md', value})
assert.deepEqual(file.messages.map(String), [
'virtual.md:3:1-3:24: Unexpected character `.` at end of heading, remove it',
@ -307,8 +307,8 @@ test('plugins', async function (t) {
// type-coverage:ignore-next-line -- `TestContext` not exposed from `node:test`.
async function assertPlugin(info, t) {
/** @type {{default: Plugin}} */
const pluginMod = await import(info.name)
const plugin = pluginMod.default
const pluginModule = await import(info.name)
const plugin = pluginModule.default
for (const check of info.checks) {
const name = check.name + ':' + check.configuration