remark-lint-no-undefined-references
raw JSON → 5.0.2 verified Fri May 01 auth: no javascript
remark-lint rule to warn when Markdown references to undefined definitions are found. Current stable version: 5.0.2. Released as part of the remark-lint monorepo; patch updates follow release cadence of the monorepo. Differentiator: catches broken links in Markdown documents by ensuring all `[text][reference]` and `[text][]` references have a corresponding `[reference]: URL` definition. Supports options to allow shortcut references and custom allow-lists. Ships TypeScript types and is ESM-only from v5.
Common errors
error Error: Cannot find module 'remark-lint-no-undefined-references' ↓
cause Package not installed or incorrect import path.
fix
npm install remark-lint-no-undefined-references
error TypeError: remarkLintNoUndefinedReferences is not a function ↓
cause Using named import instead of default import in ESM.
fix
Use
import remarkLintNoUndefinedReferences from 'remark-lint-no-undefined-references' (no braces). Warnings
breaking Package is now ESM-only. CJS require() no longer works without .default. ↓
fix Use dynamic import() or require('...').default if using CommonJS.
deprecated Options allowShortcutLink default changed from true to false in v5. ↓
fix Set allowShortcutLink: true explicitly if you need the old behavior.
breaking Node.js version requirement raised to 16+. ↓
fix Upgrade Node.js to 16 or later.
gotcha The rule does not check inline links like [text](url) or images  — only reference-style links. ↓
fix Use remark-lint-no-undefined-references only for reference links; for other link checks use additional rules.
Install
npm install remark-lint-no-undefined-references yarn add remark-lint-no-undefined-references pnpm add remark-lint-no-undefined-references Imports
- remarkLintNoUndefinedReferences wrong
import { remarkLintNoUndefinedReferences } from 'remark-lint-no-undefined-references'correctimport remarkLintNoUndefinedReferences from 'remark-lint-no-undefined-references' - Options wrong
import { Options } from 'remark-lint-no-undefined-references'correctimport type { Options } from 'remark-lint-no-undefined-references' - require() usage wrong
const remarkLintNoUndefinedReferences = require('remark-lint-no-undefined-references')correctconst remarkLintNoUndefinedReferences = require('remark-lint-no-undefined-references').default
Quickstart
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkLint from 'remark-lint'
import remarkLintNoUndefinedReferences from 'remark-lint-no-undefined-references'
import { read } from 'to-vfile'
import { reporter } from 'vfile-reporter'
const file = await read('example.md')
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintNoUndefinedReferences, { allowShortcutLink: true })
.use(remarkStringify)
.process(file)
console.error(reporter(file))