remark-lint
raw JSON → 10.0.1 verified Fri May 01 auth: no javascript
remark-lint is a modular linting system for Markdown files, built on the unified ecosystem. It provides a plugin for remark that enables configuration comments to selectively enable/disable rules inline. This package is part of the remark-lint monorepo (v10.0.1) which includes 60+ individual lint rules and presets like `remark-preset-lint-recommended`. It requires Node.js 16+ and is ESM-only. Released under MIT license by Titus Wormer. Unlike other Markdown linters (e.g., markdownlint), it integrates directly with the unified processor pipeline, making it extensible and composable.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported ↓
cause Using require() to import ESM-only package (remark-lint v10+).
fix
Convert to import statement or use dynamic import() inside CJS.
error TypeError: remarkLint is not a function ↓
cause Likely using the package without a unified pipeline; remark-lint expects to be used with .use().
fix
Use .use(remarkLint) in a unified processor, e.g., unified().use(remarkLint).
error Cannot find module 'remark-lint' or its corresponding type declarations. ↓
cause Package not installed or TypeScript cannot locate typings (should be bundled).
fix
Run 'npm install remark-lint' and ensure node_modules exists. It has built-in types.
Warnings
breaking Package is ESM-only since version 10.0.0. CommonJS require() will fail. ↓
fix Use import syntax (ESM) and ensure project is configured for ESM (e.g., type: module in package.json).
gotcha This package provides only configuration comment support, not individual lint rules. You must install separate lint rule packages or a preset. ↓
fix Install a preset like remark-preset-lint-recommended or individual rules such as remark-lint-heading-increment.
deprecated Older versions (< 9) required a different import path for the plugin; used to be included in the main remark-lint package but now is separate. ↓
fix Update to latest version; use import remarkLint from 'remark-lint'.
Install
npm install remark-lint yarn add remark-lint pnpm add remark-lint Imports
- remarkLint wrong
const remarkLint = require('remark-lint')correctimport remarkLint from 'remark-lint' - unified wrong
const unified = require('unified')correctimport { unified } from 'unified' - remarkParse wrong
const remarkParse = require('remark-parse')correctimport remarkParse from 'remark-parse'
Quickstart
import remarkLint from 'remark-lint'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import { read } from 'to-vfile'
import { unified } from 'unified'
import { reporter } from 'vfile-reporter'
const file = await read('example.md')
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkStringify)
.process(file)
console.error(reporter(file))