remark-lint-list-item-spacing
raw JSON → 5.0.1 verified Fri May 01 auth: no javascript
remark-lint rule to warn when lists violate a given style regarding blank lines between list items. Current stable version 5.0.1 is ESM-only and ships TypeScript types. Part of the remark-lint collection, it enforces consistent tight/loose list formatting based on options. Differentiators: defaults to markdown-style-guide preferences, supports custom checkBlanks option. Released as part of remark-lint monorepo with frequent updates; compatible with unified ecosystem.
Common errors
error Error: Cannot find module 'remark-lint-list-item-spacing' ↓
cause Package not installed or version mismatch.
fix
Run 'npm install remark-lint-list-item-spacing' or ensure it is in package.json.
error SyntaxError: Unexpected token 'export' ↓
cause Using CommonJS require() with ESM-only package.
fix
Use dynamic import() or switch to ESM: 'import remarkLintListItemSpacing from "remark-lint-list-item-spacing"'
error TypeError: (0 , remarkLint) is not a function ↓
cause Package possibly imported incorrectly (default vs named export).
fix
Ensure correct import: import remarkLint from 'remark-lint' (default export).
Warnings
breaking Package is ESM-only since v5. Requires Node.js 16+ and cannot be required with CommonJS. ↓
fix Use import syntax or update to a bundler that supports ESM.
gotcha The rule must be used after remarkLint in the unified plugins array, otherwise it won't work. ↓
fix Ensure .use(remarkLint) is called before .use(remarkLintListItemSpacing).
gotcha The default behavior expects blank lines between items only when items span multiple lines, not when they contain blank lines internally. This can cause unexpected warnings. ↓
fix Set checkBlanks: true to check blank lines based on internal blank lines instead.
deprecated The rule previously accepted a boolean option to enable/disable checking blank lines; in v5 this was replaced with the options object. ↓
fix Update to use object syntax: .use(remarkLintListItemSpacing, { checkBlanks: true })
Install
npm install remark-lint-list-item-spacing yarn add remark-lint-list-item-spacing pnpm add remark-lint-list-item-spacing Imports
- remarkLintListItemSpacing wrong
const remarkLintListItemSpacing = require('remark-lint-list-item-spacing')correctimport remarkLintListItemSpacing from 'remark-lint-list-item-spacing' - Options wrong
import { Options } from 'remark-lint-list-item-spacing'correctimport type { Options } from 'remark-lint-list-item-spacing' - remark-lint plugin usage wrong
.use(remarkLintListItemSpacing)correct.use(remarkLint).use(remarkLintListItemSpacing, { checkBlanks: true })
Quickstart
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import remarkLint from 'remark-lint';
import remarkLintListItemSpacing from 'remark-lint-list-item-spacing';
import { reporter } from 'vfile-reporter';
import { read } from 'to-vfile';
const file = await read('example.md');
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintListItemSpacing, { checkBlanks: true })
.use(remarkStringify)
.process(file);
console.error(reporter(file));