remark-preset-lint-node
raw JSON → 5.1.2 verified Fri May 01 auth: no javascript
A remark preset for linting Markdown files in the Node.js repository with specific rules for Node.js documentation style. Current stable version is 5.1.2. Released on a cadence aligned with Node.js documentation updates. Key differentiators: includes custom rules for YAML comments, version validation via environment variables, and enforces Node.js project conventions like maximum line length of 120 characters. Preset is used in combination with remark-lint and is part of the Node.js toolchain.
Common errors
error Error: Cannot find module 'remark-preset-lint-node' ↓
cause Attempting to require() the package in a CommonJS context.
fix
Use ESM import or ensure package is installed and project is configured for ESM.
error TypeError: Preset must be an object or function ↓
cause Incorrect import: using named import when package only has default export.
fix
Use import preset from 'remark-preset-lint-node' instead of { preset }.
error Warning: Rule 'maximum-line-length' not found ↓
cause Missing remark-lint or too old version that does not include the rule.
fix
Install and configure remark-lint correctly.
Warnings
breaking v5.0.0 dropped CommonJS support; package is now ESM-only. ↓
fix Switch to ESM imports and ensure Node.js >=18.0.0.
breaking Maximum line length changed from 80 to 120 in v5.0.1. ↓
fix Update documentation to adhere to 120 characters per line, or override the rule.
deprecated The 'nodejs-yaml-comments' rule may not work with older versions of remark-lint. ↓
fix Upgrade to latest remark-lint and remark-preset-lint-node.
gotcha Environment variable NODE_RELEASED_VERSIONS must be set for full version validation; otherwise some checks are skipped. ↓
fix Set NODE_RELEASED_VERSIONS as a comma-separated list of version strings.
Install
npm install remark-preset-lint-node yarn add remark-preset-lint-node pnpm add remark-preset-lint-node Imports
- preset wrong
const preset = require('remark-preset-lint-node')correctimport preset from 'remark-preset-lint-node' - remarkPresetLintNode wrong
import { remarkPresetLintNode } from 'remark-preset-lint-node'correctimport remarkPresetLintNode from 'remark-preset-lint-node' - recommended wrong
export { recommended } from 'remark-preset-lint-node'correctimport { recommended } from 'remark-preset-lint-node'
Quickstart
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import remarkPresetLintNode from 'remark-preset-lint-node';
import remarkLint from 'remark-lint';
const file = await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkPresetLintNode)
.use(remarkStringify)
.process('# Hello\n\nSome text.');
console.log(file.messages);