remark-lint-no-unneeded-full-reference-image

raw JSON →
4.0.1 verified Fri May 01 auth: no javascript

remark-lint rule that warns when full reference images (`![Alt][alt]`) can be collapsed to `![Alt][]` because the label matches the alt text. Version 4.0.1 is the current stable release from the remark-lint monorepo. ESM-only, ships TypeScript types, no options. Ideal for maintaining image reference consistency in markdown projects. Compared to other lint rules, this one is narrowly focused on image reference style and integrates seamlessly into unified/remark ecosystem without configuration.

error Dynamic require of "remark-lint-no-unneeded-full-reference-image" is not supported
cause Using require() on an ESM-only package.
fix
Change to import or ensure Node.js is in ESM mode.
error Could not resolve "remark-lint"
cause Missing required peer dependency remark-lint.
fix
Install remark-lint alongside this package.
error Unexpected full reference image (`![text][label]`) where the identifier can be inferred from the text, expected collapsed reference (`![text][]`)
cause Image reference where label matches alt text can be collapsed.
fix
Change ![alt][alt] to ![alt][].
breaking ESM only since v3; no CommonJS support.
fix Use import syntax instead of require().
breaking v3+ requires remark-lint >=10.0.0 and unified >=11.0.0.
fix Update peer dependencies: unified@11, remark-lint@10.
deprecated v2 used a different default export name (index).
fix Upgrade to v3+ and use the default import as shown.
gotcha No options accepted; rule behavior cannot be customized.
fix Use a different rule or custom plugin if tailoring is needed.
gotcha Rule checks full reference images only; does not affect collapsed or shortcut references.
fix Understand scope: only triggers on images like `![alt][alt]`.
npm install remark-lint-no-unneeded-full-reference-image
yarn add remark-lint-no-unneeded-full-reference-image
pnpm add remark-lint-no-unneeded-full-reference-image

Shows how to import and use the lint rule with unified, parse, stringify, and the vfile reporter.

import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkLint from 'remark-lint'
import remarkLintNoUnneededFullReferenceImage from 'remark-lint-no-unneeded-full-reference-image'
import { reporter } from 'vfile-reporter'
import { read } from 'to-vfile'

const file = await read('example.md')

await unified()
  .use(remarkParse)
  .use(remarkLint)
  .use(remarkLintNoUnneededFullReferenceImage)
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))