remark-lint-list-item-content-indent

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

remark-lint rule (v4.0.1, latest) that warns when list item content has inconsistent indentation. It checks the first child of each list item and flags subsequent children that do not align with it. This is part of the remark-lint ecosystem, ESM-only, ships TypeScript types. Key differentiator: it catches mixed indentation in multi-line list items, helping maintain consistent Markdown formatting. Compatible with Node.js 16+ and modern browsers via esm.sh.

error Cannot find module 'remark-lint-list-item-content-indent'
cause Package is not installed or typo in package name
fix
npm install remark-lint-list-item-content-indent
error ERR_REQUIRE_ESM
cause Using require() to import an ESM-only package in v4+
fix
Use import instead, or set type:"module" in package.json
error remark-lint-list-item-content-indent is not a function
cause Wrong import style: using named import instead of default import
fix
Use default import: import remarkLintListItemContentIndent from 'remark-lint-list-item-content-indent'
breaking Package is ESM-only since v4. Requiring with require() throws an error.
fix Use import or dynamic import(). For CommonJS projects, use a bundler or stay on v3.
deprecated In v3, the rule was called 'remark-lint-list-item-content-indent' but the exported function name was 'listItemContentIndent'. In v4, the export is 'remarkLintListItemContentIndent'.
fix Update import to match new export name: import remarkLintListItemContentIndent from 'remark-lint-list-item-content-indent'
gotcha Unlike some lint rules, this rule has no configuration options. It always checks consistent indentation, which may be too strict for some projects.
fix If you need different behavior, consider a custom rule or disabling this rule and using another method.
npm install remark-lint-list-item-content-indent
yarn add remark-lint-list-item-content-indent
pnpm add remark-lint-list-item-content-indent

Shows how to use the rule programmatically with unified: parse Markdown, lint for list item content indent issues, stringify back, and report messages.

import remarkLint from 'remark-lint'
import remarkLintListItemContentIndent from 'remark-lint-list-item-content-indent'
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(remarkLintListItemContentIndent)
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))