Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Apr 9, 2024
1 parent 4bcafe9 commit 803c4dc
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions lib/find-repo.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -522,10 +522,10 @@ async function checkAll(files) {
/** @type {Array<ReferenceInfo>} */
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

Expand Down Expand Up @@ -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))
)
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
66 changes: 33 additions & 33 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)

Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -147,7 +147,7 @@ test('remark-validate-links', async function (t) {
try {
await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand Down Expand Up @@ -180,7 +180,7 @@ test('remark-validate-links', async function (t) {
try {
await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -368,7 +368,7 @@ test('remark-validate-links', async function (t) {
async function () {
const result = await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -493,7 +493,7 @@ test('remark-validate-links', async function (t) {
try {
await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand All @@ -518,7 +518,7 @@ test('remark-validate-links', async function (t) {
try {
await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand All @@ -542,7 +542,7 @@ test('remark-validate-links', async function (t) {

const result = await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand Down Expand Up @@ -572,7 +572,7 @@ test('remark-validate-links', async function (t) {

const result = await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand Down Expand Up @@ -602,7 +602,7 @@ test('remark-validate-links', async function (t) {

const result = await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand Down Expand Up @@ -631,7 +631,7 @@ test('remark-validate-links', async function (t) {

const result = await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand Down Expand Up @@ -678,7 +678,7 @@ test('remark-validate-links', async function (t) {
async function () {
const result = await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -1047,7 +1047,7 @@ test('remark-validate-links', async function (t) {
async function () {
const result = await exec(
[
bin,
binary,
'--no-config',
'--no-ignore',
'--use',
Expand All @@ -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',
Expand Down

0 comments on commit 803c4dc

Please sign in to comment.