remark-lint-rule-style
raw JSON → 4.0.1 verified Fri May 01 auth: no javascript
A remark-lint rule to warn when thematic breaks (horizontal rules) are inconsistent. Current stable version is 4.0.1, part of the remark-lint ecosystem (ESM-only, Node 16+). Enforces a consistent style for horizontal rule markers and spacing. Key differentiator: detects the first used style automatically (`'consistent'` option) or allows explicit string like `'---'`. Works with remark-lint presets like `remark-preset-lint-consistent` and `remark-preset-lint-markdown-style-guide`.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module ↓
cause Using CommonJS require() on an ESM-only package.
fix
Switch to import statement: import remarkLintRuleStyle from 'remark-lint-rule-style'
error TypeError: remarkLintRuleStyle is not a function ↓
cause Importing default export incorrectly (e.g., using named import for default).
fix
Use default import: import remarkLintRuleStyle from 'remark-lint-rule-style'
error Error: Cannot find module 'remark-lint-rule-style' ↓
cause Package not installed or typo in package name.
fix
Run: npm install remark-lint-rule-style
Warnings
breaking v4 dropped CommonJS support; require() will throw. ↓
fix Use ESM imports: import remarkLintRuleStyle from 'remark-lint-rule-style'
breaking v4 requires Node 16+. ↓
fix Upgrade Node.js to >=16
deprecated Passing string directly as options (e.g., '---') is deprecated in v4; use object form. ↓
fix Use { style: '---' } instead of '---'
gotcha Options type 'consistent' is a string, not an object. { style: 'consistent' } works but can be simplified to just the string. ↓
fix Use 'consistent' directly: .use(remarkLintRuleStyle, 'consistent')
gotcha TypeScript users may mistakenly import Options as a value; it's a type-only export. ↓
fix Use import type { Options } from 'remark-lint-rule-style'
Install
npm install remark-lint-rule-style yarn add remark-lint-rule-style pnpm add remark-lint-rule-style Imports
- remarkLintRuleStyle wrong
const remarkLintRuleStyle = require('remark-lint-rule-style')correctimport remarkLintRuleStyle from 'remark-lint-rule-style' - Options wrong
import { Options } from 'remark-lint-rule-style'correctimport type { Options } from 'remark-lint-rule-style' - default export (remarkLintRuleStyle) wrong
unified().use(remarkLintRuleStyle, '---')correctunified().use(remarkLintRuleStyle, { style: '---' })
Quickstart
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkLint from 'remark-lint'
import remarkLintRuleStyle from 'remark-lint-rule-style'
import { reporter } from 'vfile-reporter'
const file = await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintRuleStyle, { style: '---' })
.use(remarkStringify)
.process('***\n\n---')
console.error(reporter(file))