remark-lint-no-reference-like-url
raw JSON → 4.0.1 verified Fri May 01 auth: no javascript
remark-lint rule that warns when URLs are also defined identifiers, helping catch likely broken references in Markdown. Current version 4.0.1, part of the remark-lint monorepo. ESM-only, requires Node.js 16+. No presets include it; use as a standalone lint rule. Differentiates from other lint rules by focusing on the specific pattern of resource links that should be reference links to avoid ambiguity.
Common errors
error Cannot find module 'remark-lint-no-reference-like-url' ↓
cause Package not installed or wrong version
fix
npm install remark-lint-no-reference-like-url
error TypeError: Illegal invocation: function must be called without new ↓
cause Calling the plugin instead of passing it directly
fix
.use(remarkLintNoReferenceLikeUrl) not .use(remarkLintNoReferenceLikeUrl())
error ERR_REQUIRE_ESM ↓
cause Trying to require() an ESM-only package
fix
Use import or dynamic import()
Warnings
breaking CommonJS require() is no longer supported. Use ESM imports. ↓
fix Change your code to use import or dynamic import()
deprecated The plugin is not included in any preset and must be added explicitly. ↓
fix Ensure you add it as a separate plugin in your remark configuration
gotcha The rule does not have options, but some users try to pass configuration; it's a simple boolean check. ↓
fix Do not pass any arguments to .use(). There are no options.
Install
npm install remark-lint-no-reference-like-url yarn add remark-lint-no-reference-like-url pnpm add remark-lint-no-reference-like-url Imports
- remarkLintNoReferenceLikeUrl wrong
import { remarkLintNoReferenceLikeUrl } from 'remark-lint-no-reference-like-url'correctimport remarkLintNoReferenceLikeUrl from 'remark-lint-no-reference-like-url' - plugin usage wrong
.use(remarkLintNoReferenceLikeUrl())correct.use(remarkLintNoReferenceLikeUrl) - require in CJS wrong
const { remarkLintNoReferenceLikeUrl } = require('remark-lint-no-reference-like-url')correctconst remarkLintNoReferenceLikeUrl = require('remark-lint-no-reference-like-url')
Quickstart
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import remarkLint from 'remark-lint';
import remarkLintNoReferenceLikeUrl from 'remark-lint-no-reference-like-url';
import { reporter } from 'vfile-reporter';
const file = await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintNoReferenceLikeUrl)
.use(remarkStringify)
.process('[**Mercury**](mercury) is the first planet from the sun.\n\n[mercury]: https://example.com/mercury/');
console.error(reporter(file));