{"id":26231,"library":"remark-lint-maximum-heading-length","title":"remark-lint-maximum-heading-length","description":"remark-lint rule to warn when headings are too long. Current stable version is 4.1.1 (ESM-only, requires Node.js 16+). Part of the unified/remark ecosystem, this rule enforces a maximum heading length (default 60 characters) and is included in some presets like remark-preset-lint-markdown-style-guide. Provides an optional stringLength function for custom text measurement (e.g., to count display width). Active development with regular releases coordinated across the remark-lint monorepo.","status":"active","version":"4.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","heading","length","lint","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-maximum-heading-length","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-maximum-heading-length","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-maximum-heading-length","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency; this is a plugin for remark-lint","package":"remark-lint","optional":false},{"reason":"Required peer dependency; remark-lint builds on unified","package":"unified","optional":false},{"reason":"Required to parse Markdown; needed for any lint rule","package":"remark-parse","optional":false}],"imports":[{"note":"Package is ESM-only since v4. Use dynamic import() in CommonJS environments.","wrong":"const remarkLintMaximumHeadingLength = require('remark-lint-maximum-heading-length')","symbol":"remarkLintMaximumHeadingLength","correct":"import remarkLintMaximumHeadingLength from 'remark-lint-maximum-heading-length'"},{"note":"Options is a TypeScript type only; do not use value import.","wrong":"import { Options } from 'remark-lint-maximum-heading-length'","symbol":"Options (type)","correct":"import type { Options } from 'remark-lint-maximum-heading-length'"}],"quickstart":{"code":"import remarkLint from 'remark-lint'\nimport remarkLintMaximumHeadingLength from 'remark-lint-maximum-heading-length'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport { read } from 'to-vfile'\nimport { unified } from 'unified'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await read('example.md')\n\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintMaximumHeadingLength, { size: 80 })\n  .use(remarkStringify)\n  .process(file)\n\nconsole.error(reporter(file))","lang":"typescript","description":"Shows how to use the rule with unified, specifying a custom max heading length of 80 characters."},"warnings":[{"fix":"Use import or dynamic import(). For Node.js <16, upgrade or stay on v3.","message":"ESM-only since v4; CommonJS require() will throw.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Change `.use(remarkLintMaximumHeadingLength, 60)` to `.use(remarkLintMaximumHeadingLength, { size: 60 })`.","message":"Options structure changed: previously passed as number (max length), now must be an object with `size` property.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use default import: `import remarkLintMaximumHeadingLength from 'remark-lint-maximum-heading-length'`.","message":"Plugin no longer exports `remarkLintMaximumHeadingLength` as a named export; only default export.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Explicitly pass options after the preset.","message":"If using with a preset that overrides options, ensure your options object is merged correctly.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change require() to import or use dynamic import().","cause":"Package is ESM-only since v4, but used with require().","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported."},{"fix":"Use `.use(remarkLintMaximumHeadingLength, { size: 60 })` instead of `.use(remarkLintMaximumHeadingLength, 60)`.","cause":"Passing a number directly instead of options object in v4+.","error":"TypeError: Cannot read properties of undefined (reading 'length')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}