From 803c4dc0ca27736c6e97efa34a03bc3bad86e0d7 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 9 Apr 2024 19:59:20 +0200 Subject: [PATCH] Update dev-dependencies --- lib/find-repo.node.js | 4 +-- lib/index.js | 26 ++++++++--------- package.json | 4 +-- test/index.js | 66 +++++++++++++++++++++---------------------- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/find-repo.node.js b/lib/find-repo.node.js index 379b03d..71a6043 100644 --- a/lib/find-repo.node.js +++ b/lib/find-repo.node.js @@ -5,9 +5,9 @@ import path from 'node:path' import {promisify} from 'node:util' -import {exec as execCb} from 'node:child_process' +import {exec as execCallback} from 'node:child_process' -const exec = promisify(execCb) +const exec = promisify(execCallback) /** * @param {VFile} file diff --git a/lib/index.js b/lib/index.js index 97e5996..916ce0e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -270,11 +270,11 @@ export default function remarkValidateLinks(options, fileSet) { visit(tree, function (node) { const data = node.data || {} - const props = data.hProperties || {} + const hProperties = data.hProperties || {} // @ts-expect-error: accept a `data.id`, which is not standard mdast, but // is here for historical reasons. const dataId = /** @type {unknown} */ (data.id) - let id = String(props.name || props.id || dataId || '') + let id = String(hProperties.name || hProperties.id || dataId || '') if (!id && node.type === 'heading') { id = slugger.slug( @@ -367,18 +367,18 @@ export default function remarkValidateLinks(options, fileSet) { * Nothing. */ function addReference(filePath, hash, node) { - let refs = references.get(filePath) + let referenceMap = references.get(filePath) - if (!refs) { - refs = new Map() - references.set(filePath, refs) + if (!referenceMap) { + referenceMap = new Map() + references.set(filePath, referenceMap) } - let hashes = refs.get(hash) + let hashes = referenceMap.get(hash) if (!hashes) { hashes = [] - refs.set(hash, hashes) + referenceMap.set(hash, hashes) } hashes.push(node) @@ -522,10 +522,10 @@ async function checkAll(files) { /** @type {Array} */ const missing = [] - for (const [key, refs] of references) { + for (const [key, referenceMap] of references) { const lands = landmarks.get(key) - for (const [hash, infos] of refs) { + for (const [hash, infos] of referenceMap) { /* c8 ignore next -- `else` can only happen in browser. */ const exists = lands ? lands.get(hash) : false @@ -765,10 +765,10 @@ function normalize(url, state) { * Whether `filePath` is a readme. */ function readme(filePath) { - const ext = path.extname(filePath) + const extension = path.extname(filePath) return ( - readmeExtensions.has(ext) && - readmeBasename.test(path.basename(filePath, ext)) + readmeExtensions.has(extension) && + readmeBasename.test(path.basename(filePath, extension)) ) } diff --git a/package.json b/package.json index 0645f04..160c94a 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "devDependencies": { "@types/hosted-git-info": "^3.0.0", "@types/node": "^20.0.0", - "c8": "^8.0.0", + "c8": "^9.0.0", "prettier": "^3.0.0", "remark": "^15.0.0", "remark-cli": "^12.0.0", @@ -75,7 +75,7 @@ "type-coverage": "^2.0.0", "typescript": "^5.0.0", "vfile-sort": "^4.0.0", - "xo": "^0.56.0" + "xo": "^0.58.0" }, "scripts": { "build": "tsc --build --clean && tsc --build && type-coverage", diff --git a/test/index.js b/test/index.js index 28dd8af..0a58507 100644 --- a/test/index.js +++ b/test/index.js @@ -28,7 +28,7 @@ const fakeBaseUrl = new URL('fixtures/', import.meta.url) const gitUrl = new URL('../.git', import.meta.url) const gitBakUrl = new URL('../.git.bak', import.meta.url) -const bin = fileURLToPath( +const binary = fileURLToPath( new URL('../node_modules/.bin/remark', import.meta.url) ) @@ -94,7 +94,7 @@ test('remark-validate-links', async function (t) { await t.test('should ignore invalid repositories', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -120,7 +120,7 @@ test('remark-validate-links', async function (t) { await t.test('should not fail on Gist repositories', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -147,7 +147,7 @@ test('remark-validate-links', async function (t) { try { await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -180,7 +180,7 @@ test('remark-validate-links', async function (t) { try { await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -216,7 +216,7 @@ test('remark-validate-links', async function (t) { await t.test('should work if there are no links', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -233,7 +233,7 @@ test('remark-validate-links', async function (t) { await t.test('should work with stdin', async function () { const promise = exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -264,7 +264,7 @@ test('remark-validate-links', async function (t) { await t.test('should work when not all files are given', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -298,7 +298,7 @@ test('remark-validate-links', async function (t) { await t.test('should work when all files are given', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -340,7 +340,7 @@ test('remark-validate-links', async function (t) { await t.test('should work with definitions', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -368,7 +368,7 @@ test('remark-validate-links', async function (t) { async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -430,7 +430,7 @@ test('remark-validate-links', async function (t) { await exec('git remote add origin git@github.com:wooorm/test.git') const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -493,7 +493,7 @@ test('remark-validate-links', async function (t) { try { await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -518,7 +518,7 @@ test('remark-validate-links', async function (t) { try { await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -542,7 +542,7 @@ test('remark-validate-links', async function (t) { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -572,7 +572,7 @@ test('remark-validate-links', async function (t) { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -602,7 +602,7 @@ test('remark-validate-links', async function (t) { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -631,7 +631,7 @@ test('remark-validate-links', async function (t) { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -678,7 +678,7 @@ test('remark-validate-links', async function (t) { async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -705,7 +705,7 @@ test('remark-validate-links', async function (t) { await t.test('should support a GitLab shortcode', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -747,7 +747,7 @@ test('remark-validate-links', async function (t) { await t.test('should support a Bitbucket shortcode', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -789,7 +789,7 @@ test('remark-validate-links', async function (t) { await t.test('should suggest similar links', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -816,7 +816,7 @@ test('remark-validate-links', async function (t) { await t.test('should recognise links to particular lines', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -843,7 +843,7 @@ test('remark-validate-links', async function (t) { await t.test('should recognise links with encoded URLs', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -872,7 +872,7 @@ test('remark-validate-links', async function (t) { await t.test('should support folders', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -902,7 +902,7 @@ test('remark-validate-links', async function (t) { await t.test('should warn on files as folders', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -928,7 +928,7 @@ test('remark-validate-links', async function (t) { await t.test('should check images', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -958,7 +958,7 @@ test('remark-validate-links', async function (t) { await t.test('should slug image alts correctly', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -975,7 +975,7 @@ test('remark-validate-links', async function (t) { await t.test('should support query parameters', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -1001,7 +1001,7 @@ test('remark-validate-links', async function (t) { await t.test('should support case insensitive headings', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -1028,7 +1028,7 @@ test('remark-validate-links', async function (t) { await t.test('should ignore external links', async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -1047,7 +1047,7 @@ test('remark-validate-links', async function (t) { async function () { const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use', @@ -1067,7 +1067,7 @@ test('remark-validate-links', async function (t) { await exec('git remote add origin git@gitlab.acme.company:acme/project.git') const result = await exec( [ - bin, + binary, '--no-config', '--no-ignore', '--use',