diff --git a/package.json b/package.json index a92390b5..1f7de69b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/remark-lint-no-duplicate-defined-urls/package.json b/packages/remark-lint-no-duplicate-defined-urls/package.json index f4f276ee..20d123fa 100644 --- a/packages/remark-lint-no-duplicate-defined-urls/package.json +++ b/packages/remark-lint-no-duplicate-defined-urls/package.json @@ -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": { diff --git a/packages/remark-lint-no-duplicate-headings-in-section/package.json b/packages/remark-lint-no-duplicate-headings-in-section/package.json index beebad99..a0277a89 100644 --- a/packages/remark-lint-no-duplicate-headings-in-section/package.json +++ b/packages/remark-lint-no-duplicate-headings-in-section/package.json @@ -50,7 +50,8 @@ "xo": { "prettier": true, "rules": { - "capitalized-comments": "off" + "capitalized-comments": "off", + "logical-assignment-operators": "off" } } } diff --git a/script/info.js b/script/info.js index 57a6aeb5..d5f8da27 100644 --- a/script/info.js +++ b/script/info.js @@ -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( diff --git a/script/pipeline-package.js b/script/pipeline-package.js index da09d712..9b187989 100644 --- a/script/pipeline-package.js +++ b/script/pipeline-package.js @@ -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) { diff --git a/test.js b/test.js index cbc5715e..58afe09e 100644 --- a/test.js +++ b/test.js @@ -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