remark-lint-no-empty-image-alt-text
raw JSON → 1.0.3 verified Fri May 01 auth: no javascript
A remark-lint rule that warns when image alt text is missing or empty, promoting accessibility. Current version 1.0.3, stable maintenance mode. Lightweight, focused solely on detecting empty alt text in Markdown images, unlike broader lint rules that may cover other accessibility concerns.
Common errors
error Error: Cannot find module 'remark-lint-no-empty-image-alt-text' ↓
cause Missing installation of the package.
fix
npm install remark-lint-no-empty-image-alt-text
error TypeError: remark().use is not a function ↓
cause Importing remark incorrectly; using default import instead of named export.
fix
Use
import { remark } from 'remark' instead of import remark from 'remark'. error Warning: Missing alt text for image! no-empty-image-alt-text remark-lint ↓
cause Valid lint warning – no fix needed, but alt text should be added.
fix
Add alt text inside the brackets:
 Warnings
gotcha The rule only checks for empty alt text (e.g., ``) but does not check for missing alt attribute in HTML `<img>` tags within Markdown. ↓
fix Use additional lint rules to cover HTML img tags if needed.
gotcha When using CommonJS require, TypeScript may require esModuleInterop enabled to import default export. ↓
fix Set esModuleInterop: true in tsconfig.json, or use import syntax with .default.
deprecated The package is in maintenance mode with no recent updates. Consider that future remark versions may break compatibility. ↓
fix Monitor for newer versions or switch to a more active lint rule like `remark-lint-no-empty-alt-text`.
Install
npm install remark-lint-no-empty-image-alt-text yarn add remark-lint-no-empty-image-alt-text pnpm add remark-lint-no-empty-image-alt-text Imports
- default wrong
const imageAltText = require('remark-lint-no-empty-image-alt-text')correctimport imageAltText from 'remark-lint-no-empty-image-alt-text' - remarkLint wrong
const remarkLint = require('remark-lint')correctimport remarkLint from 'remark-lint' - remark wrong
import remark from 'remark'correctimport { remark } from 'remark'
Quickstart
import { remark } from 'remark';
import remarkLint from 'remark-lint';
import imageAltText from 'remark-lint-no-empty-image-alt-text';
const file = await remark()
.use(remarkLint)
.use(imageAltText)
.process('');
console.log(String(file));