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.

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()
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.
npm install remark-lint-no-reference-like-url
yarn add remark-lint-no-reference-like-url
pnpm add remark-lint-no-reference-like-url

Demonstrates how to use the rule to lint Markdown and detect resource links that look like references.

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));