{"id":26250,"library":"remark-lint-no-empty-sections","title":"remark-lint-no-empty-sections","description":"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.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/vhf/remark-lint-no-empty-sections","tags":["javascript"],"install":[{"cmd":"npm install remark-lint-no-empty-sections","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-no-empty-sections","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-no-empty-sections","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"required to use as a remark plugin","package":"remark-lint","optional":false}],"imports":[{"note":"ESM only; no named export exists. Use default import.","wrong":"const { remarkLintNoEmptySections } = require('remark-lint-no-empty-sections')","symbol":"default","correct":"import remarkLintNoEmptySections from 'remark-lint-no-empty-sections'"},{"note":"remark v13+ is ESM-only, so require() will fail.","wrong":"const remark = require('remark')","symbol":"remark","correct":"import { remark } from 'remark'"},{"note":"The rule name is not exported as a named export; only default.","wrong":"import { noEmptySections } from 'remark-lint-no-empty-sections'","symbol":"No empty sections","correct":"import remarkLintNoEmptySections from 'remark-lint-no-empty-sections'"}],"quickstart":{"code":"import { remark } from 'remark';\nimport remarkLint from 'remark-lint';\nimport remarkLintNoEmptySections from 'remark-lint-no-empty-sections';\n\nconst result = await remark()\n  .use(remarkLint)\n  .use(remarkLintNoEmptySections)\n  .process('# Title\\n\\n## Subsection\\n\\nSome content.');\n\nconsole.log(result.messages);\n// []\n\nconst result2 = await remark()\n  .use(remarkLint)\n  .use(remarkLintNoEmptySections)\n  .process('# Title\\n\\n## Subsection\\n\\n### Empty Sub-sub');\n\nconsole.log(result2.messages);\n// [ [1:1-31:1] Empty section ]","lang":"typescript","description":"Shows how to use the plugin programmatically with ESM imports, including an example that triggers a warning."},"warnings":[{"fix":"Switch to ESM imports or use dynamic import() if needed.","message":"ESM-only since v4.0.0. CommonJS require() will throw.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Install @types/remark-lint and create a .d.ts file for this plugin.","message":"No longer ships TypeScript definitions; must use @types/remark-lint or declare module.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use additional lint rules (e.g., remark-lint-no-heading-punctuation) to catch other empty issues.","message":"Plugin will not warn if parent heading has content but child heading is empty — only same-level empty sections are flagged.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to import statement: import remarkLintNoEmptySections from 'remark-lint-no-empty-sections';","cause":"Trying to use require() with an ESM-only package, which is not allowed in Node.js 12+.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/node_modules/remark-lint-no-empty-sections/index.js ... not supported."},{"fix":"Ensure you call .use() before .process(): remark().use(remarkLint).use(remarkLintNoEmptySections).process(markdown)","cause":"Using .use() after processing has started or not properly chaining.","error":"TypeError: remark().use(...).use is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}