remark-lint-definition-spacing

raw JSON →
4.0.1 verified Fri May 01 auth: no javascript

remark-lint rule (v4.0.1, ESM-only) from the remark-lint monorepo that warns when consecutive whitespace (more than one space or non-space whitespace) is used in a definition label. Published as part of the remark-lint ecosystem, it ensures definition label whitespace consistency. Unlike general markdown linters, this rule is specific to definition labels and is included in the remark-preset-lint-markdown-style-guide preset.

error Cannot find module 'remark-lint-definition-spacing'
cause Missing package installation or wrong import path (ESM vs CJS).
fix
Run npm install remark-lint-definition-spacing and ensure you use ESM import syntax.
error TypeError: remarkLintDefinitionSpacing is not a function
cause Using named import `{ remarkLintDefinitionSpacing }` instead of default import.
fix
Use import remarkLintDefinitionSpacing from 'remark-lint-definition-spacing'.
error Error: It looks like you are using ESM but your Node.js version does not support it.
cause Node.js version < 16 or not configured for ESM.
fix
Update Node.js to >=16 or use --experimental-modules flag (older versions), or use dynamic import.
breaking Package is ESM-only starting from version 4.
fix Switch to ESM imports (import ... from ...). For CommonJS, use dynamic import() or stick to version 3.x.
breaking TypeScript types changed in version 4.0.0: `@import` syntax used; types may require TypeScript 5.0+.
fix Update TypeScript to 5.0+ or use a version with supported module resolution.
deprecated No known deprecations in this package.
gotcha This rule does not affect GFM footnotes; footnote labels cannot contain whitespace.
fix No fix needed; it's by design.
npm install remark-lint-definition-spacing
yarn add remark-lint-definition-spacing
pnpm add remark-lint-definition-spacing

Shows how to use the rule with unified: parse markdown, apply the lint rule, stringify, and report messages.

import remarkLint from 'remark-lint'
import remarkLintDefinitionSpacing from 'remark-lint-definition-spacing'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {read} from 'to-vfile'
import {unified} from 'unified'
import {reporter} from 'vfile-reporter'

const file = await read('example.md')

await unified()
  .use(remarkParse)
  .use(remarkLint)
  .use(remarkLintDefinitionSpacing)
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))