Registry / testing / remark-lint-no-empty-sections

remark-lint-no-empty-sections

JSON →
library4.0.0jsnpmunverified

A remark-lint rule that warns when a markdown section heading has no content before the next heading of the same or higher level. This package (v4.0.0) is part of the remark-lint ecosystem and is specifically designed for enforcing formatting guidelines in free-programming-books. It is released on demand, with no fixed cadence. Unlike generic lint rules, it targets empty sections, which can occur when headings are split incorrectly or content is missing. It integrates seamlessly with remark-cli.

npm install remark-lint-no-empty-sections
INSTALL
IMPORT
SIG · REMARK-LINT-NO-EMP
R
remark-lint-no-empty-sections
testingjavascriptv4.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import remarkLintNoEmptySections from 'remark-lint-no-empty-sections'
✗ const { remarkLintNoEmptySections } = require('remark-lint-no-empty-sections')
ESM only; no named export exists. Use default import.
remark
✓ import { remark } from 'remark'
✗ const remark = require('remark')
remark v13+ is ESM-only, so require() will fail.
No empty sections
✓ import remarkLintNoEmptySections from 'remark-lint-no-empty-sections'
✗ import { noEmptySections } from 'remark-lint-no-empty-sections'
The rule name is not exported as a named export; only default.

Shows how to use the plugin programmatically with ESM imports, including an example that triggers a warning.

import { remark } from 'remark'; import remarkLint from 'remark-lint'; import remarkLintNoEmptySections from 'remark-lint-no-empty-sections'; const result = await remark() .use(remarkLint) .use(remarkLintNoEmptySections) .process('# Title\n\n## Subsection\n\nSome content.'); console.log(result.messages); // [] const result2 = await remark() .use(remarkLint) .use(remarkLintNoEmptySections) .process('# Title\n\n## Subsection\n\n### Empty Sub-sub'); console.log(result2.messages); // [ [1:1-31:1] Empty section ]
remark --version
Debug
Known issues
breakingESM-only since v4.0.0. CommonJS require() will throw.
fix
Switch to ESM imports or use dynamic import() if needed.
affects: >=4.0.0
breakingNo longer ships TypeScript definitions; must use @types/remark-lint or declare module.
fix
Install @types/remark-lint and create a .d.ts file for this plugin.
affects: >=4.0.0
gotchaPlugin will not warn if parent heading has content but child heading is empty — only same-level empty sections are flagged.
fix
Use additional lint rules (e.g., remark-lint-no-heading-punctuation) to catch other empty issues.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/node_modules/remark-lint-no-empty-sections/index.js ... not supported.
Trying to use require() with an ESM-only package, which is not allowed in Node.js 12+.
fix
Change to import statement: import remarkLintNoEmptySections from 'remark-lint-no-empty-sections';
TypeError: remark().use(...).use is not a function
Using .use() after processing has started or not properly chaining.
fix
Ensure you call .use() before .process(): remark().use(remarkLint).use(remarkLintNoEmptySections).process(markdown)
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies
remark-lintrequiredrequired to use as a remark plugin
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-no-empty-sections — npm install remark-lint-no-empty-sections · libregistry