remark-lint-no-shortcut-reference-link
raw JSON → 4.0.1 verified Fri May 01 auth: no javascript
A remark-lint rule that warns when shortcut reference links (`[text]` without explicit brackets for the label) are used in Markdown. Version 4.0.1 is the latest stable release, part of the remark-lint monorepo. It enforces consistency by recommending collapsed or full reference links instead. This rule is included in recommended and markdown style guide presets. Rules are updated regularly; check the main remark-lint releases.
Common errors
error Cannot find module 'remark-lint-no-shortcut-reference-link' ↓
cause Package not installed or ESM-only import used in CJS context.
fix
Install: npm install remark-lint-no-shortcut-reference-link. If using require, switch to import or use dynamic import().
error SyntaxError: Unexpected identifier 'remarkLintNoShortcutReferenceLink' ↓
cause Using import statement in a non-ESM file (no type:module or .mjs extension).
fix
Set type: "module" in package.json or rename file to .mjs.
error TypeError: remarkLintNoShortcutReferenceLink is not a function ↓
cause Trying to use the rule without unified, or passing options incorrectly.
fix
Use .use(remarkLintNoShortcutReferenceLink) without arguments (rule accepts no options).
error No warnings emitted even for shortcut reference links ↓
cause Missing remark-lint plugin itself; rules are inactive without it.
fix
Add .use(remarkLint) before the rule.
Warnings
breaking Package is ESM-only from v4.0.0. CommonJS require() will fail. ↓
fix Use import syntax or upgrade Node.js to 16+ and set type:"module" in package.json.
breaking Minimum Node.js version is 16, older versions are not supported. ↓
fix Upgrade to Node.js 16 or later.
gotcha This rule does not accept any options. Passing options silently ignored. ↓
fix Remove any options object: .use(remarkLintNoShortcutReferenceLink) with no arguments.
gotcha Rule only works with remark-lint plugin; using it directly without remark-lint has no effect. ↓
fix Ensure remark-lint is also used: .use(remarkLint).use(remarkLintNoShortcutReferenceLink).
deprecated No deprecations known in current version.
Install
npm install remark-lint-no-shortcut-reference-link yarn add remark-lint-no-shortcut-reference-link pnpm add remark-lint-no-shortcut-reference-link Imports
- remarkLintNoShortcutReferenceLink wrong
const remarkLintNoShortcutReferenceLink = require('remark-lint-no-shortcut-reference-link')correctimport remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link' - No default export; use default export wrong
import { remarkLintNoShortcutReferenceLink } from 'remark-lint-no-shortcut-reference-link'correctimport remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link' - TypeScript types
import type { Plugin } from 'unified'; import remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link'
Quickstart
import remarkLint from 'remark-lint'
import remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {unified} from 'unified'
import {reporter} from 'vfile-reporter'
const file = await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintNoShortcutReferenceLink)
.use(remarkStringify)
.process('[Mercury]\n\n[mercury]: https://example.com/mercury/')
console.error(reporter(file))