remark-lint-no-empty-url
raw JSON → 4.0.1 verified Fri May 01 auth: no javascript
remark-lint rule to warn on empty URLs in links, images, and definitions. Version 4.0.1 is the current stable release, compatible with unified ecosystem and Node.js 16+. ESM-only since v3. Differentiates from generic linting by providing focused, low-overhead checks for empty URLs in Markdown, with no configuration options needed.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported. ↓
cause Using require() on an ESM-only package.
fix
Change to dynamic import or use ESM syntax.
error TypeError: Cannot read properties of null (reading 'url') ↓
cause Missing unified plugins in pipeline.
fix
Add .use(remarkParse) and .use(remarkStringify) before processing.
error No files matching the pattern were found ↓
cause CLI glob pattern not matching Markdown files.
fix
Use correct pattern, e.g., '**/*.md'.
Warnings
breaking v3 dropped CommonJS support; package is ESM-only. ↓
fix Use ES module import syntax or switch to v2 if CJS required.
deprecated v2.x is deprecated and no longer maintained. ↓
fix Upgrade to v4.0.1 and use ESM import.
gotcha This rule must be used after remark-parse and remark-stringify in the pipeline, otherwise it may not detect empty URLs. ↓
fix Ensure pipeline order: .use(remarkParse).use(remarkLint).use(remarkLintNoEmptyUrl).use(remarkStringify)
gotcha The rule reports empty URLs even when the empty URL is intended (e.g., for placeholder). ↓
fix If intentional, use a different rule or disable this one.
Install
npm install remark-lint-no-empty-url yarn add remark-lint-no-empty-url pnpm add remark-lint-no-empty-url Imports
- remarkLintNoEmptyUrl wrong
const remarkLintNoEmptyUrl = require('remark-lint-no-empty-url')correctimport remarkLintNoEmptyUrl from 'remark-lint-no-empty-url' - remarkLint wrong
const remarkLint = require('remark-lint')correctimport remarkLint from 'remark-lint' - remarkParse
import remarkParse from 'remark-parse'
Quickstart
import remarkLint from 'remark-lint'
import remarkLintNoEmptyUrl from 'remark-lint-no-empty-url'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {read} from 'to-vfile'
import {unified} from 'unified'
import {reporter} from 'vfile-reporter'
const file = await read('example.md')
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintNoEmptyUrl)
.use(remarkStringify)
.process(file)
console.error(reporter(file))