remark-lint-no-emphasis-as-heading
raw JSON → 4.0.1 verified Fri May 01 auth: no javascript
remark-lint rule to warn when emphasis or strong is used instead of a heading. Current stable version: 4.0.1. Part of the remark-lint ecosystem, released as needed with other lint rules. Differentiator: specifically targets faux headings created with emphasis/strong, promoting proper heading usage. ESM-only, ships TypeScript types.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported ↓
cause Using require() with ESM-only package (v4+).
fix
Switch to import or set type: module in package.json.
error TypeError: remarkLintNoEmphasisAsHeading is not a function ↓
cause Named import attempt: import { remarkLintNoEmphasisAsHeading } from '...'
fix
Use default import: import remarkLintNoEmphasisAsHeading from '...'
Warnings
breaking Package is ESM-only since v4; require() will throw ERR_REQUIRE_ESM ↓
fix Use import or dynamic import() instead of require().
gotcha Default export only: import remarkLintNoEmphasisAsHeading from 'remark-lint-no-emphasis-as-heading' (not a named export) ↓
fix Use default import syntax.
gotcha The rule must be used after remark-lint plugin; order matters ↓
fix Ensure .use(remarkLint) precedes .use(remarkLintNoEmphasisAsHeading).
Install
npm install remark-lint-no-emphasis-as-heading yarn add remark-lint-no-emphasis-as-heading pnpm add remark-lint-no-emphasis-as-heading Imports
- remarkLintNoEmphasisAsHeading wrong
import { remarkLintNoEmphasisAsHeading } from 'remark-lint-no-emphasis-as-heading'correctimport remarkLintNoEmphasisAsHeading from 'remark-lint-no-emphasis-as-heading' - remarkLint wrong
import { remarkLint } from 'remark-lint'correctimport remarkLint from 'remark-lint' - unified wrong
import unified from 'unified'correctimport { unified } from 'unified'
Quickstart
import remarkLint from 'remark-lint'
import remarkLintNoEmphasisAsHeading from 'remark-lint-no-emphasis-as-heading'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import { unified } from 'unified'
import { reporter } from 'vfile-reporter'
const file = await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintNoEmphasisAsHeading)
.use(remarkStringify)
.process('# Hello\n\n**World**\n\nThis is a paragraph.')
console.error(reporter(file))