Registry / testing / remark-lint-definition-sort

remark-lint-definition-sort

JSON →
library1.0.1jsnpmunverified

A remark-lint rule that warns when markdown definitions (including footnote definitions) are not sorted alphabetically. Version 1.0.1 is current, released as part of the remark-lint monorepo. It requires remark-lint and unified, and is ESM-only since Node 16+. Unlike general linters, it enforces a consistent order for 'definition' nodes (e.g., [label]: url), helping maintain readability in long lists. Definitions and footnotes are sorted separately, and 'groups' separated by non-definition content are sorted independently.

npm install remark-lint-definition-sort
INSTALL
IMPORT
SIG · REMARK-LINT-DEFINI
R
remark-lint-definition-sort
testingjavascriptv1.0.1
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.

remarkLintDefinitionSort
✓ import remarkLintDefinitionSort from 'remark-lint-definition-sort'
✗ const remarkLintDefinitionSort = require('remark-lint-definition-sort')
Package is ESM-only since v1; require() will fail on Node 16+.
default export
✓ import remarkLintDefinitionSort from 'remark-lint-definition-sort'
✗ import { remarkLintDefinitionSort } from 'remark-lint-definition-sort'
Only default export exists; the named import does not work.
types
✓ import type { Plugin } from 'unified' // no types exported from this package
✗ import { Plugin } from 'remark-lint-definition-sort'
Package does not export TypeScript types; use unified types instead.

Demonstrates how to programmatically lint markdown definitions sorting using unified pipeline with remark-lint.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkStringify from 'remark-stringify'; import remarkLint from 'remark-lint'; import remarkLintDefinitionSort from 'remark-lint-definition-sort'; import { read } from 'to-vfile'; import { reporter } from 'vfile-reporter'; const file = await read('example.md'); await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintDefinitionSort) .use(remarkStringify) .process(file); console.error(reporter(file));
Debug
Known issues
breakingESM-only: Package does not support CommonJS require(); must use import syntax.
fix
Switch to ESM (import) or downgrade to a hypothetical CJS version (none exists).
affects: >=1.0.0
deprecatedThis rule is not part of any preset; may be superseded by a combined rule in the future.
fix
No action needed; monitor remark-lint releases for combined definitions linting.
affects: *
gotchaFootnotes and definitions are sorted separately: mixing them may produce unexpected 'unsorted' warnings.
fix
Ensure footnotes are in a separate block from regular definitions.
affects: *
gotchaGroups of definitions separated by non-definition content are sorted independently; sorting is not global across the entire file.
fix
If you need strict global sorting, avoid separating definitions with paragraphs.
affects: *
Errors
Common errors & fixes
Cannot find module 'remark-lint-definition-sort' Require stack: - /path/to/project/...
Using CommonJS require() on an ESM-only package.
fix
Use import syntax or set "type": "module" in package.json.
TypeError: remarkLintDefinitionSort is not a function
Using named import instead of default import.
fix
Change to 'import remarkLintDefinitionSort from 'remark-lint-definition-sort'' (default import).
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
unifiedoptionalrequired core engine for processing markdown with plugins
remark-lintoptionalparent linting plugin that must be used before this rule
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-definition-sort — npm install remark-lint-definition-sort · libregistry